Title: [98255] trunk/Source/WebCore
Revision
98255
Author
simon.fra...@apple.com
Date
2011-10-24 11:05:57 -0700 (Mon, 24 Oct 2011)

Log Message

Improve debug compositing border colors
https://bugs.webkit.org/show_bug.cgi?id=70742

Reviewed by Dean Jackson.

Improve the appearance of the debug borders used to indicate compositing:
1. Use green for normal layers, orange for tiled layers
2. Make the repaint counter translucent
3. Change the color of the repaint counter to show when accelerated drawing is enabled.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::updateDebugIndicators):
* platform/graphics/mac/WebLayer.mm:
(drawLayerContents):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (98254 => 98255)


--- trunk/Source/WebCore/ChangeLog	2011-10-24 17:54:40 UTC (rev 98254)
+++ trunk/Source/WebCore/ChangeLog	2011-10-24 18:05:57 UTC (rev 98255)
@@ -1,3 +1,20 @@
+2011-10-24  Simon Fraser  <simon.fra...@apple.com>
+
+        Improve debug compositing border colors
+        https://bugs.webkit.org/show_bug.cgi?id=70742
+
+        Reviewed by Dean Jackson.
+
+        Improve the appearance of the debug borders used to indicate compositing:
+        1. Use green for normal layers, orange for tiled layers
+        2. Make the repaint counter translucent
+        3. Change the color of the repaint counter to show when accelerated drawing is enabled.
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::updateDebugIndicators):
+        * platform/graphics/mac/WebLayer.mm:
+        (drawLayerContents):
+
 2011-10-24  Carlos Garcia Campos  <cgar...@igalia.com>
 
         [GTK] Fix make distcheck build

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (98254 => 98255)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2011-10-24 17:54:40 UTC (rev 98254)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2011-10-24 18:05:57 UTC (rev 98255)
@@ -306,15 +306,13 @@
     if (GraphicsLayer::showDebugBorders()) {
         if (drawsContent()) {
             if (m_usingTiledLayer)
-                setDebugBorder(Color(0, 255, 0, 204), 2.0f);    // tiled layer: green
+                setDebugBorder(Color(255, 128, 0, 128), 2); // tiled layer: orange
             else
-                setDebugBorder(Color(255, 0, 0, 204), 2.0f);    // normal layer: red
+                setDebugBorder(Color(0, 128, 32, 128), 2); // normal layer: green
         } else if (masksToBounds()) {
-            setDebugBorder(Color(128, 255, 255, 178), 2.0f);    // masking layer: pale blue
-            if (GraphicsLayer::showDebugBorders())
-                setDebugBackgroundColor(Color(128, 255, 255, 52));
+            setDebugBorder(Color(128, 255, 255, 48), 20); // masking layer: pale blue
         } else
-            setDebugBorder(Color(255, 255, 0, 204), 2.0f);      // container: yellow
+            setDebugBorder(Color(255, 255, 0, 192), 2); // container: yellow
     }
 }
 

Modified: trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm (98254 => 98255)


--- trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2011-10-24 17:54:40 UTC (rev 98254)
+++ trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2011-10-24 18:05:57 UTC (rev 98255)
@@ -87,24 +87,31 @@
         char text[16]; // that's a lot of repaints
         snprintf(text, sizeof(text), "%d", layerContents->platformCALayerIncrementRepaintCount());
 
+        CGRect indicatorBox = layerBounds;
+        indicatorBox.size.width = 12 + 10 * strlen(text);
+        indicatorBox.size.height = 27;
         CGContextSaveGState(context);
+        
+        CGContextSetAlpha(context, 0.5);
+        CGContextBeginTransparencyLayerWithRect(context, indicatorBox, 0);
+
         if (isTiledLayer)
-            CGContextSetRGBFillColor(context, 0.0f, 1.0f, 0.0f, 0.8f);
+            CGContextSetRGBFillColor(context, 1, 0.5f, 0, 1);
         else
-            CGContextSetRGBFillColor(context, 1.0f, 0.0f, 0.0f, 0.8f);
+            CGContextSetRGBFillColor(context, 0, 0.5f, 0.25f, 1);
         
-        CGRect aBounds = layerBounds;
-
-        aBounds.size.width = 10 + 12 * strlen(text);
-        aBounds.size.height = 25;
-        CGContextFillRect(context, aBounds);
+        CGContextFillRect(context, indicatorBox);
         
-        CGContextSetRGBFillColor(context, 0.0f, 0.0f, 0.0f, 1.0f);
+        if (platformLayer->acceleratesDrawing())
+            CGContextSetRGBFillColor(context, 1, 0, 0, 1);
+        else
+            CGContextSetRGBFillColor(context, 1, 1, 1, 1);
 
-        CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1.0f, -1.0f));
-        CGContextSelectFont(context, "Helvetica", 25, kCGEncodingMacRoman);
-        CGContextShowTextAtPoint(context, aBounds.origin.x + 3.0f, aBounds.origin.y + 20.0f, text, strlen(text));
+        CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1, -1));
+        CGContextSelectFont(context, "Helvetica", 22, kCGEncodingMacRoman);
+        CGContextShowTextAtPoint(context, indicatorBox.origin.x + 5, indicatorBox.origin.y + 22, text, strlen(text));
         
+        CGContextEndTransparencyLayer(context);
         CGContextRestoreGState(context);        
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to