本文整理汇总了C++中LayerChromium类的典型用法代码示例。如果您正苦于以下问题:C++ LayerChromium类的具体用法?C++ LayerChromium怎么用?C++ LayerChromium使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了LayerChromium类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: while
void LayerChromium::removeAllChildren()
{
while (m_children.size()) {
LayerChromium* layer = m_children[0].get();
ASSERT(layer->parent());
layer->removeFromParent();
}
}
示例2: hasAncestor
bool LayerChromium::hasAncestor(LayerChromium* ancestor) const
{
for (LayerChromium* layer = parent(); layer; layer = layer->parent()) {
if (layer == ancestor)
return true;
}
return false;
}
示例3: setMaskLayer
void GraphicsLayerChromium::setMaskLayer(GraphicsLayer* maskLayer)
{
if (maskLayer == m_maskLayer)
return;
GraphicsLayer::setMaskLayer(maskLayer);
LayerChromium* maskLayerChromium = m_maskLayer ? m_maskLayer->platformLayer() : 0;
if (maskLayerChromium)
maskLayerChromium->setIsMask(true);
m_layer->setMaskLayer(maskLayerChromium);
}
示例4: update
void CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, PaintType paintType, CCTextureUpdater& updater)
{
// Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point
// in code, we already know that at least something will be drawn into this render surface, so the
// mask and replica should be painted.
LayerChromium* maskLayer = renderSurfaceLayer->maskLayer();
if (maskLayer) {
maskLayer->setVisibleLayerRect(IntRect(IntPoint(), renderSurfaceLayer->contentBounds()));
update(maskLayer, paintType, updater, 0);
}
LayerChromium* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurfaceLayer->replicaLayer()->maskLayer() : 0;
if (replicaMaskLayer) {
replicaMaskLayer->setVisibleLayerRect(IntRect(IntPoint(), renderSurfaceLayer->contentBounds()));
update(replicaMaskLayer, paintType, updater, 0);
}
}
示例5: if
void CCLayerTreeHost::prioritizeTextures(const LayerList& updateList)
{
// Use BackToFront since it's cheap and this isn't order-dependent.
typedef CCLayerIterator<LayerChromium, Vector<RefPtr<LayerChromium> >, RenderSurfaceChromium, CCLayerIteratorActions::BackToFront> CCLayerIteratorType;
m_contentsTextureManager->clearPriorities();
CCPriorityCalculator calculator;
CCLayerIteratorType end = CCLayerIteratorType::end(&updateList);
for (CCLayerIteratorType it = CCLayerIteratorType::begin(&updateList); it != end; ++it) {
if (it.representsItself())
it->setTexturePriorities(calculator);
else if (it.representsTargetRenderSurface()) {
if (it->maskLayer())
it->maskLayer()->setTexturePriorities(calculator);
if (it->replicaLayer() && it->replicaLayer()->maskLayer())
it->replicaLayer()->maskLayer()->setTexturePriorities(calculator);
}
}
size_t readbackBytes = 0;
size_t maxBackgroundTextureBytes = 0;
size_t contentsTextureBytes = 0;
// Start iteration at 1 to skip the root surface as it does not have a texture cost.
for (size_t i = 1; i < updateList.size(); ++i) {
LayerChromium* renderSurfaceLayer = updateList[i].get();
RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface();
size_t bytes = TextureManager::memoryUseBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA);
contentsTextureBytes += bytes;
if (renderSurface->backgroundFilters().isEmpty())
continue;
if (bytes > maxBackgroundTextureBytes)
maxBackgroundTextureBytes = bytes;
if (!readbackBytes)
readbackBytes = TextureManager::memoryUseBytes(m_deviceViewportSize, GraphicsContext3D::RGBA);
}
size_t renderSurfacesBytes = readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes;
m_contentsTextureManager->prioritizeTextures(renderSurfacesBytes);
}
示例6: findFirstScrollableLayer
void CCLayerTreeHost::applyScrollAndScale(const CCScrollAndScaleSet& info)
{
if (!m_rootLayer)
return;
LayerChromium* rootScrollLayer = findFirstScrollableLayer(m_rootLayer.get());
IntSize rootScrollDelta;
for (size_t i = 0; i < info.scrolls.size(); ++i) {
LayerChromium* layer = CCLayerTreeHostCommon::findLayerInSubtree(m_rootLayer.get(), info.scrolls[i].layerId);
if (!layer)
continue;
if (layer == rootScrollLayer)
rootScrollDelta += info.scrolls[i].scrollDelta;
else
layer->scrollBy(info.scrolls[i].scrollDelta);
}
if (!rootScrollDelta.isZero() || info.pageScaleDelta != 1)
m_client->applyScrollAndScale(rootScrollDelta, info.pageScaleDelta);
}
示例7: calculateMemoryForRenderSurfaces
size_t CCLayerTreeHost::calculateMemoryForRenderSurfaces(const LayerList& updateList)
{
size_t readbackBytes = 0;
size_t maxBackgroundTextureBytes = 0;
size_t contentsTextureBytes = 0;
// Start iteration at 1 to skip the root surface as it does not have a texture cost.
for (size_t i = 1; i < updateList.size(); ++i) {
LayerChromium* renderSurfaceLayer = updateList[i].get();
RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface();
size_t bytes = CCTexture::memorySizeBytes(renderSurface->contentRect().size(), GraphicsContext3D::RGBA);
contentsTextureBytes += bytes;
if (renderSurfaceLayer->backgroundFilters().isEmpty())
continue;
if (bytes > maxBackgroundTextureBytes)
maxBackgroundTextureBytes = bytes;
if (!readbackBytes)
readbackBytes = CCTexture::memorySizeBytes(m_deviceViewportSize, GraphicsContext3D::RGBA);
}
return readbackBytes + maxBackgroundTextureBytes + contentsTextureBytes;
}
示例8: paintMasksForRenderSurface
bool CCLayerTreeHost::paintMasksForRenderSurface(LayerChromium* renderSurfaceLayer, CCTextureUpdateQueue& queue)
{
// Note: Masks and replicas only exist for layers that own render surfaces. If we reach this point
// in code, we already know that at least something will be drawn into this render surface, so the
// mask and replica should be painted.
bool needMoreUpdates = false;
LayerChromium* maskLayer = renderSurfaceLayer->maskLayer();
if (maskLayer) {
maskLayer->update(queue, 0, m_renderingStats);
needMoreUpdates |= maskLayer->needMoreUpdates();
}
LayerChromium* replicaMaskLayer = renderSurfaceLayer->replicaLayer() ? renderSurfaceLayer->replicaLayer()->maskLayer() : 0;
if (replicaMaskLayer) {
replicaMaskLayer->update(queue, 0, m_renderingStats);
needMoreUpdates |= replicaMaskLayer->needMoreUpdates();
}
return needMoreUpdates;
}
示例9: clearLayerBackgroundColor
static void clearLayerBackgroundColor(LayerChromium& layer)
{
layer.setBackgroundColor(static_cast<RGBA32>(0));
}
示例10: setLayerBackgroundColor
static void setLayerBackgroundColor(LayerChromium& layer, const Color& color)
{
layer.setBackgroundColor(color);
}
示例11: clearBorderColor
static void clearBorderColor(LayerChromium& layer)
{
layer.setBorderColor(static_cast<RGBA32>(0));
}
示例12: setLayerBorderColor
static void setLayerBorderColor(LayerChromium& layer, const Color& color)
{
layer.setBorderColor(color);
}
示例13: rootLayer
const LayerChromium* LayerChromium::rootLayer() const
{
const LayerChromium* layer = this;
for (LayerChromium* superlayer = layer->superlayer(); superlayer; layer = superlayer, superlayer = superlayer->superlayer()) { }
return layer;
}
示例14: rootLayer
const LayerChromium* LayerChromium::rootLayer() const
{
const LayerChromium* layer = this;
for (LayerChromium* parent = layer->parent(); parent; layer = parent, parent = parent->parent()) { }
return layer;
}
示例15: ASSERT
void LayerRendererChromium::paintLayerContents(const LayerList& renderSurfaceLayerList)
{
for (int surfaceIndex = renderSurfaceLayerList.size() - 1; surfaceIndex >= 0 ; --surfaceIndex) {
CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get();
RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface();
ASSERT(renderSurface);
// Make sure any renderSurfaceLayer is associated with this layerRenderer.
// This is a defensive assignment in case the owner of this layer hasn't
// set the layerRenderer on this layer already.
renderSurfaceLayer->setLayerRenderer(this);
// Render surfaces whose drawable area has zero width or height
// will have no layers associated with them and should be skipped.
if (!renderSurface->m_layerList.size())
continue;
LayerList& layerList = renderSurface->m_layerList;
ASSERT(layerList.size());
for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex) {
CCLayerImpl* ccLayerImpl = layerList[layerIndex].get();
// Layers that start a new render surface will be painted when the render
// surface's list is processed.
if (ccLayerImpl->renderSurface() && ccLayerImpl->renderSurface() != renderSurface)
continue;
LayerChromium* layer = ccLayerImpl->owner();
layer->setLayerRenderer(this);
if (layer->maskLayer())
layer->maskLayer()->setLayerRenderer(this);
if (layer->replicaLayer()) {
layer->replicaLayer()->setLayerRenderer(this);
if (layer->replicaLayer()->maskLayer())
layer->replicaLayer()->maskLayer()->setLayerRenderer(this);
}
if (layer->bounds().isEmpty())
continue;
IntRect targetSurfaceRect = ccLayerImpl->targetRenderSurface() ? ccLayerImpl->targetRenderSurface()->contentRect() : m_defaultRenderSurface->contentRect();
IntRect scissorRect = layer->ccLayerImpl()->scissorRect();
if (!scissorRect.isEmpty())
targetSurfaceRect.intersect(scissorRect);
if (layer->drawsContent())
layer->paintContentsIfDirty(targetSurfaceRect);
if (layer->maskLayer() && layer->maskLayer()->drawsContent())
layer->maskLayer()->paintContentsIfDirty(targetSurfaceRect);
if (layer->replicaLayer() && layer->replicaLayer()->drawsContent())
layer->replicaLayer()->paintContentsIfDirty(targetSurfaceRect);
if (layer->replicaLayer() && layer->replicaLayer()->maskLayer() && layer->replicaLayer()->maskLayer()->drawsContent())
layer->replicaLayer()->maskLayer()->paintContentsIfDirty(targetSurfaceRect);
}
}
}