本文整理汇总了C++中PaintLayer::setCompositingReasons方法的典型用法代码示例。如果您正苦于以下问题:C++ PaintLayer::setCompositingReasons方法的具体用法?C++ PaintLayer::setCompositingReasons怎么用?C++ PaintLayer::setCompositingReasons使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PaintLayer
的用法示例。
在下文中一共展示了PaintLayer::setCompositingReasons方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateRecursive
//.........这里部分代码省略.........
ASSERT(willBeCompositedOrSquashed);
// A foreground layer effectively is a new backing for all subsequent children, so
// we don't need to test for overlap with anything behind this. So, we can finish
// the previous context that was accumulating rects for the negative z-index
// children, and start with a fresh new empty context.
overlapMap.finishCurrentOverlapTestingContext();
overlapMap.beginNewOverlapTestingContext();
// This layer is going to be composited, so children can safely ignore the fact that there's an
// animation running behind this layer, meaning they can rely on the overlap map testing again
childRecursionData.m_testingOverlap = true;
}
PaintLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren);
while (PaintLayerStackingNode* curNode = iterator.next()) {
IntRect absoluteChildDescendantBoundingBox;
updateRecursive(layer, curNode->layer(), overlapMap, childRecursionData, anyDescendantHas3DTransform, unclippedDescendants, absoluteChildDescendantBoundingBox);
absoluteDescendantBoundingBox.unite(absoluteChildDescendantBoundingBox);
}
// Now that the subtree has been traversed, we can check for compositing reasons that depended on the state of the subtree.
if (layer->stackingNode()->isStackingContext()) {
layer->setShouldIsolateCompositedDescendants(childRecursionData.m_hasUnisolatedCompositedBlendingDescendant);
} else {
layer->setShouldIsolateCompositedDescendants(false);
currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = childRecursionData.m_hasUnisolatedCompositedBlendingDescendant;
}
// Subsequent layers in the parent's stacking context may also need to composite.
if (childRecursionData.m_subtreeIsCompositing)
currentRecursionData.m_subtreeIsCompositing = true;
// Set the flag to say that this SC has compositing children.
layer->setHasCompositingDescendant(childRecursionData.m_subtreeIsCompositing);
if (layer->isRootLayer()) {
// The root layer needs to be composited if anything else in the tree is composited.
// Otherwise, we can disable compositing entirely.
if (childRecursionData.m_subtreeIsCompositing || requiresCompositingOrSquashing(reasonsToComposite) || compositor->rootShouldAlwaysComposite()) {
reasonsToComposite |= CompositingReasonRoot;
currentRecursionData.m_subtreeIsCompositing = true;
} else {
compositor->setCompositingModeEnabled(false);
reasonsToComposite = CompositingReasonNone;
}
} else {
// All layers (even ones that aren't being composited) need to get added to
// the overlap map. Layers that are not separately composited will paint into their
// compositing ancestor's backing, and so are still considered for overlap.
if (childRecursionData.m_compositingAncestor && !childRecursionData.m_compositingAncestor->isRootLayer())
overlapMap.add(layer, absBounds);
// Now check for reasons to become composited that depend on the state of descendant layers.
CompositingReasons subtreeCompositingReasons = subtreeReasonsForCompositing(layer, childRecursionData.m_subtreeIsCompositing, anyDescendantHas3DTransform);
reasonsToComposite |= subtreeCompositingReasons;
if (!willBeCompositedOrSquashed && canBeComposited && requiresCompositingOrSquashing(subtreeCompositingReasons)) {
childRecursionData.m_compositingAncestor = layer;
// FIXME: this context push is effectively a no-op but needs to exist for
// now, because the code is designed to push overlap information to the
// second-from-top context of the stack.
overlapMap.beginNewOverlapTestingContext();
overlapMap.add(layer, absoluteDescendantBoundingBox);
willBeCompositedOrSquashed = true;
}
if (willBeCompositedOrSquashed)
reasonsToComposite |= layer->potentialCompositingReasonsFromStyle() & CompositingReasonInlineTransform;
// If the original layer is composited, the reflection needs to be, too.
if (layer->reflectionInfo()) {
// FIXME: Shouldn't we call computeCompositingRequirements to handle a reflection overlapping with another layoutObject?
PaintLayer* reflectionLayer = layer->reflectionInfo()->reflectionLayer();
CompositingReasons reflectionCompositingReason = willBeCompositedOrSquashed ? CompositingReasonReflectionOfCompositedParent : CompositingReasonNone;
reflectionLayer->setCompositingReasons(reflectionCompositingReason, CompositingReasonReflectionOfCompositedParent);
}
if (willBeCompositedOrSquashed && layer->layoutObject()->style()->hasBlendMode())
currentRecursionData.m_hasUnisolatedCompositedBlendingDescendant = true;
// Tell the parent it has compositing descendants.
if (willBeCompositedOrSquashed)
currentRecursionData.m_subtreeIsCompositing = true;
// Turn overlap testing off for later layers if it's already off, or if we have an animating transform.
// Note that if the layer clips its descendants, there's no reason to propagate the child animation to the parent layers. That's because
// we know for sure the animation is contained inside the clipping rectangle, which is already added to the overlap map.
bool isCompositedClippingLayer = canBeComposited && (reasonsToComposite & CompositingReasonClipsCompositingDescendants);
bool isCompositedWithInlineTransform = reasonsToComposite & CompositingReasonInlineTransform;
if ((!childRecursionData.m_testingOverlap && !isCompositedClippingLayer) || layer->layoutObject()->style()->hasCurrentTransformAnimation() || isCompositedWithInlineTransform)
currentRecursionData.m_testingOverlap = false;
if (childRecursionData.m_compositingAncestor == layer)
overlapMap.finishCurrentOverlapTestingContext();
descendantHas3DTransform |= anyDescendantHas3DTransform || layer->has3DTransform();
}
// At this point we have finished collecting all reasons to composite this layer.
layer->setCompositingReasons(reasonsToComposite);
}