Title: [102294] trunk/Source/WebCore
Revision
102294
Author
[email protected]
Date
2011-12-07 18:02:13 -0800 (Wed, 07 Dec 2011)

Log Message

[chromium] Clearing root surface should happen after damage tracking
https://bugs.webkit.org/show_bug.cgi?id=73958

Patch by Shawn Singh <[email protected]> on 2011-12-07
Reviewed by James Robinson.

No new semantics, covered by existing layout tests.

* platform/graphics/chromium/LayerRendererChromium.cpp:
(WebCore::LayerRendererChromium::clearSurfaceForDebug):
(WebCore::LayerRendererChromium::drawLayersOntoRenderSurfaces):
(WebCore::LayerRendererChromium::drawLayersInternal):
* platform/graphics/chromium/LayerRendererChromium.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (102293 => 102294)


--- trunk/Source/WebCore/ChangeLog	2011-12-08 02:01:56 UTC (rev 102293)
+++ trunk/Source/WebCore/ChangeLog	2011-12-08 02:02:13 UTC (rev 102294)
@@ -1,3 +1,18 @@
+2011-12-07  Shawn Singh  <[email protected]>
+
+        [chromium] Clearing root surface should happen after damage tracking
+        https://bugs.webkit.org/show_bug.cgi?id=73958
+
+        Reviewed by James Robinson.
+
+        No new semantics, covered by existing layout tests.
+
+        * platform/graphics/chromium/LayerRendererChromium.cpp:
+        (WebCore::LayerRendererChromium::clearSurfaceForDebug):
+        (WebCore::LayerRendererChromium::drawLayersOntoRenderSurfaces):
+        (WebCore::LayerRendererChromium::drawLayersInternal):
+        * platform/graphics/chromium/LayerRendererChromium.h:
+
 2011-12-07  Florin Malita  <[email protected]>
 
         <li value="0"> behaves like <li> (the same for negative numbers)

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp (102293 => 102294)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-12-08 02:01:56 UTC (rev 102293)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.cpp	2011-12-08 02:02:13 UTC (rev 102294)
@@ -365,6 +365,28 @@
     }
 }
 
+void LayerRendererChromium::clearSurfaceForDebug(CCLayerImpl* renderSurfaceLayer, CCLayerImpl* rootDrawLayer, const FloatRect& surfaceDamageRect)
+{
+    // Non-root layers should clear their entire contents to transparent. The root layer
+    // is cleared to blue to easily see regions that were not drawn on the screen. If we
+    // are using partial swap / scissor optimization, then the surface should only
+    // clear the damaged region, so that we don't accidentally clear un-changed portions
+    // of the screen.
+
+    if (renderSurfaceLayer != rootDrawLayer)
+        GLC(m_context.get(), m_context->clearColor(0, 0, 0, 0));
+    else
+        GLC(m_context.get(), m_context->clearColor(0, 0, 1, 1));
+
+    if (m_capabilities.usingPartialSwap)
+        setScissorToRect(enclosingIntRect(surfaceDamageRect));
+    else
+        GLC(m_context.get(), m_context->disable(GraphicsContext3D::SCISSOR_TEST));
+
+    m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
+    GLC(m_context.get(), m_context->enable(GraphicsContext3D::SCISSOR_TEST));
+}
+
 void LayerRendererChromium::drawLayersOntoRenderSurfaces(CCLayerImpl* rootDrawLayer, const CCLayerList& renderSurfaceLayerList)
 {
     TRACE_EVENT("LayerRendererChromium::drawLayersOntoRenderSurfaces", this, 0);
@@ -399,12 +421,8 @@
                 }
             }
 
-            if (renderSurfaceLayer != rootDrawLayer) {
-                if (m_capabilities.usingPartialSwap)
-                    setScissorToRect(enclosingIntRect(surfaceDamageRect));
-                GLC(m_context.get(), m_context->clearColor(0, 0, 0, 0));
-                GLC(m_context.get(), m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT));
-            }
+            // FIXME: eventually we should place this under a debug flag.
+            clearSurfaceForDebug(renderSurfaceLayer, rootDrawLayer, surfaceDamageRect);
 
             const CCLayerList& layerList = renderSurface->layerList();
             for (unsigned layerIndex = 0; layerIndex < layerList.size(); ++layerIndex)
@@ -461,16 +479,7 @@
 
     GLC(m_context.get(), m_context->disable(GraphicsContext3D::DEPTH_TEST));
     GLC(m_context.get(), m_context->disable(GraphicsContext3D::CULL_FACE));
-
-    useRenderSurface(m_defaultRenderSurface);
-
-    // Clear to blue to make it easier to spot unrendered regions.
-    if (m_capabilities.usingPartialSwap)
-        setScissorToRect(enclosingIntRect(m_rootDamageRect));
-    m_context->clearColor(0, 0, 1, 1);
-    m_context->colorMask(true, true, true, true);
-    m_context->clear(GraphicsContext3D::COLOR_BUFFER_BIT);
-
+    GLC(m_context.get(), m_context->colorMask(true, true, true, true));
     GLC(m_context.get(), m_context->enable(GraphicsContext3D::BLEND));
     GLC(m_context.get(), m_context->blendFunc(GraphicsContext3D::ONE, GraphicsContext3D::ONE_MINUS_SRC_ALPHA));
 

Modified: trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h (102293 => 102294)


--- trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-12-08 02:01:56 UTC (rev 102293)
+++ trunk/Source/WebCore/platform/graphics/chromium/LayerRendererChromium.h	2011-12-08 02:02:13 UTC (rev 102294)
@@ -179,6 +179,7 @@
     void releaseRenderSurfaceTextures();
 
     bool useRenderSurface(CCRenderSurface*);
+    void clearSurfaceForDebug(CCLayerImpl* renderSurfaceLayer, CCLayerImpl* rootDrawLayer, const FloatRect& surfaceDamageRect);
 
     bool makeContextCurrent();
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to