Index: Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp |
=================================================================== |
--- Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp (revision 114754) |
+++ Source/WebCore/platform/graphics/chromium/cc/CCOcclusionTracker.cpp (working copy) |
@@ -194,26 +194,25 @@ |
// FIXME: Remove usePaintTracking when paint tracking is on for paint culling. |
template<typename LayerType> |
-static inline Region computeOcclusionBehindLayer(const LayerType* layer, const TransformationMatrix& transform, bool usePaintTracking) |
+static inline Region computeOcclusionBehindLayer(const LayerType* layer, const TransformationMatrix& transform, const Region& opaqueContents, bool usePaintTracking) |
{ |
- Region opaqueRegion; |
+ ASSERT(layer->visibleLayerRect().contains(opaqueContents.bounds())); |
FloatQuad unoccludedQuad = transform.mapQuad(FloatQuad(layer->visibleLayerRect())); |
bool isPaintedAxisAligned = unoccludedQuad.isRectilinear(); |
if (!isPaintedAxisAligned) |
- return opaqueRegion; |
+ return Region(); |
- if (layer->opaque()) |
- opaqueRegion = enclosedIntRect(unoccludedQuad.boundingBox()); |
- else if (usePaintTracking && transform.isIdentity()) |
- opaqueRegion = layer->visibleContentOpaqueRegion(); |
+ Region transformedOpaqueContents; |
+ if (usePaintTracking && transform.isIdentity()) |
+ transformedOpaqueContents = opaqueContents; |
else if (usePaintTracking) { |
- Region contentRegion = layer->visibleContentOpaqueRegion(); |
- Vector<IntRect> contentRects = contentRegion.rects(); |
+ Vector<IntRect> contentRects = opaqueContents.rects(); |
for (size_t i = 0; i < contentRects.size(); ++i) |
- opaqueRegion.unite(enclosedIntRect(transform.mapRect(FloatRect(contentRects[i])))); |
+ transformedOpaqueContents.unite(enclosedIntRect(transform.mapRect(FloatRect(contentRects[i])))); |
} |
- return opaqueRegion; |
+ |
+ return transformedOpaqueContents; |
} |
template<typename LayerType, typename RenderSurfaceType> |
@@ -227,11 +226,15 @@ |
if (!layerOpacityKnown(layer) || layer->drawOpacity() < 1) |
return; |
+ Region opaqueContents = layer->visibleContentOpaqueRegion(); |
+ if (opaqueContents.isEmpty()) |
+ return; |
+ |
// FIXME: Remove m_usePaintTracking when paint tracking is on for paint culling. |
if (layerTransformsToScreenKnown(layer)) |
- m_stack.last().occlusionInScreen.unite(computeOcclusionBehindLayer<LayerType>(layer, contentToScreenSpaceTransform<LayerType>(layer), m_usePaintTracking)); |
+ m_stack.last().occlusionInScreen.unite(computeOcclusionBehindLayer<LayerType>(layer, contentToScreenSpaceTransform<LayerType>(layer), opaqueContents, m_usePaintTracking)); |
if (layerTransformsToTargetKnown(layer)) |
- m_stack.last().occlusionInTarget.unite(computeOcclusionBehindLayer<LayerType>(layer, contentToTargetSurfaceTransform<LayerType>(layer), m_usePaintTracking)); |
+ m_stack.last().occlusionInTarget.unite(computeOcclusionBehindLayer<LayerType>(layer, contentToTargetSurfaceTransform<LayerType>(layer), opaqueContents, m_usePaintTracking)); |
} |
static inline bool testContentRectOccluded(const IntRect& contentRect, const TransformationMatrix& contentSpaceTransform, const IntRect& scissorRect, const Region& occlusion) |