Title: [98757] trunk/Source/WebCore
- Revision
- 98757
- Author
- [email protected]
- Date
- 2011-10-28 13:44:58 -0700 (Fri, 28 Oct 2011)
Log Message
[chromium] Implicitly skip render surfaces that won't be drawn
https://bugs.webkit.org/show_bug.cgi?id=71038
Rather than having redundant checks in three places for how to walk
through a render surface list, instead don't add render surfaces that
don't need to get rendered to the render surface list.
Reviewed by James Robinson.
Covered by existing layout tests.
* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::drawLayersOntoRenderSurfaces):
* platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
(WebCore::CCLayerTreeHost::paintLayerContents):
(WebCore::CCLayerTreeHost::updateCompositorResources):
* platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
(WebCore::calculateDrawTransformsAndVisibilityInternal):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (98756 => 98757)
--- trunk/Source/WebCore/ChangeLog 2011-10-28 20:27:44 UTC (rev 98756)
+++ trunk/Source/WebCore/ChangeLog 2011-10-28 20:44:58 UTC (rev 98757)
@@ -1,3 +1,24 @@
+2011-10-28 Adrienne Walker <[email protected]>
+
+ [chromium] Implicitly skip render surfaces that won't be drawn
+ https://bugs.webkit.org/show_bug.cgi?id=71038
+
+ Rather than having redundant checks in three places for how to walk
+ through a render surface list, instead don't add render surfaces that
+ don't need to get rendered to the render surface list.
+
+ Reviewed by James Robinson.
+
+ Covered by existing layout tests.
+
+ * platform/graphics/chromium/LayerRendererChromium.cpp:
+ (WebCore::LayerRendererChromium::drawLayersOntoRenderSurfaces):
+ * platform/graphics/chromium/cc/CCLayerTreeHost.cpp:
+ (WebCore::CCLayerTreeHost::paintLayerContents):
+ (WebCore::CCLayerTreeHost::updateCompositorResources):
+ * platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:
+ (WebCore::calculateDrawTransformsAndVisibilityInternal):
+
2011-10-28 Adam Barth <[email protected]>
Autogenerate Exception-downcast code in bindings
Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (98756 => 98757)
--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp 2011-10-28 20:27:44 UTC (rev 98756)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp 2011-10-28 20:44:58 UTC (rev 98757)
@@ -312,19 +312,10 @@
CCLayerImpl* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get();
CCRenderSurface* renderSurface = renderSurfaceLayer->renderSurface();
ASSERT(renderSurface);
+ ASSERT(renderSurface->layerList().size());
+ ASSERT(renderSurface->drawOpacity());
- renderSurface->setSkipsDraw(true);
-
- if (!renderSurface->layerList().size())
- continue;
-
- // Skip completely transparent render surfaces.
- if (!renderSurface->drawOpacity())
- continue;
-
if (useRenderSurface(renderSurface)) {
- renderSurface->setSkipsDraw(false);
-
if (renderSurfaceLayer != rootDrawLayer) {
GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST));
GLC(m_context.get(), m_context->clearColor(0, 0, 0, 0));
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp (98756 => 98757)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-10-28 20:27:44 UTC (rev 98756)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp 2011-10-28 20:44:58 UTC (rev 98757)
@@ -330,15 +330,9 @@
LayerChromium* renderSurfaceLayer = renderSurfaceLayerList[surfaceIndex].get();
RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface();
ASSERT(renderSurface);
+ ASSERT(renderSurface->layerList().size());
+ ASSERT(renderSurface->drawOpacity());
- // Render surfaces whose drawable area has zero width or height
- // will have no layers associated with them and should be skipped.
- if (!renderSurface->layerList().size())
- continue;
-
- if (!renderSurface->drawOpacity())
- continue;
-
renderSurfaceLayer->setLayerTreeHost(this);
paintMaskAndReplicaForRenderSurface(renderSurfaceLayer);
@@ -370,10 +364,9 @@
LayerChromium* renderSurfaceLayer = m_updateList[surfaceIndex].get();
RenderSurfaceChromium* renderSurface = renderSurfaceLayer->renderSurface();
ASSERT(renderSurface);
+ ASSERT(renderSurface->layerList().size());
+ ASSERT(renderSurface->drawOpacity());
- if (!renderSurface->layerList().size() || !renderSurface->drawOpacity())
- continue;
-
if (renderSurfaceLayer->maskLayer())
updateCompositorResources(renderSurfaceLayer->maskLayer(), context, updater);
Modified: trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp (98756 => 98757)
--- trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp 2011-10-28 20:27:44 UTC (rev 98756)
+++ trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp 2011-10-28 20:44:58 UTC (rev 98757)
@@ -232,9 +232,20 @@
bool useSurfaceForReflection = layer->replicaLayer();
bool useSurfaceForFlatDescendants = layer->parent() && layer->parent()->preserves3D() && !layer->preserves3D() && layer->descendantDrawsContent();
if (useSurfaceForMasking || useSurfaceForReflection || useSurfaceForFlatDescendants || ((useSurfaceForClipping || useSurfaceForOpacity) && layer->descendantDrawsContent())) {
+ // Layer's opacity will be applied when drawing the render surface.
+ float drawOpacity = layer->opacity();
+ if (layer->parent() && layer->parent()->preserves3D())
+ drawOpacity *= layer->parent()->drawOpacity();
+
+ // If this render surface isn't drawn, we can also skip its children.
+ if (!drawOpacity)
+ return;
+
if (!layer->renderSurface())
layer->createRenderSurface();
+
RenderSurfaceType* renderSurface = layer->renderSurface();
+ renderSurface->clearLayerList();
// The origin of the new surface is the upper left corner of the layer.
TransformationMatrix drawTransform;
@@ -243,10 +254,6 @@
transformedLayerRect = IntRect(0, 0, bounds.width(), bounds.height());
- // Layer's opacity will be applied when drawing the render surface.
- float drawOpacity = layer->opacity();
- if (layer->parent() && layer->parent()->preserves3D())
- drawOpacity *= layer->parent()->drawOpacity();
renderSurface->setDrawOpacity(drawOpacity);
layer->setDrawOpacity(1);
@@ -262,8 +269,6 @@
// surface and is therefore expressed in the parent's coordinate system.
renderSurface->setScissorRect(layer->parent() ? layer->parent()->scissorRect() : layer->scissorRect());
- renderSurface->clearLayerList();
-
if (layer->maskLayer()) {
renderSurface->setMaskLayer(layer->maskLayer());
layer->maskLayer()->setTargetRenderSurface(renderSurface);
@@ -371,6 +376,20 @@
}
}
+ if (layer->renderSurface() && !layer->renderSurface()->layerList().size()) {
+ // If a render surface has no layer list, then it and none of its
+ // children needed to get drawn. Therefore, it should be the last layer
+ // in the render surface list and we can trivially remove it.
+ ASSERT(renderSurfaceLayerList.last() == layer);
+ renderSurfaceLayerList.removeLast();
+ layer->clearRenderSurface();
+ return;
+ }
+
+ // If neither this layer nor any of its children were added, early out.
+ if (sortingStartIndex == descendants.size())
+ return;
+
if (layer->masksToBounds() || useSurfaceForMasking) {
IntRect drawableContentRect = layer->drawableContentRect();
drawableContentRect.intersect(transformedLayerRect);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes