Title: [106304] trunk/Source/WebCore
Revision
106304
Author
[email protected]
Date
2012-01-30 17:07:43 -0800 (Mon, 30 Jan 2012)

Log Message

Show debug borders for individual tile cache tiles
https://bugs.webkit.org/show_bug.cgi?id=77388

Reviewed by Sam Weinig.

* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::updateDebugIndicators):
Give tile cache tiles a thin dark blue border.

* platform/graphics/ca/mac/TileCache.h:
(WebCore::TileCache::tileDebugBorderWidth):
(WebCore::TileCache::tileDebugBorderColor):
Add getters and member variables for the tile debug border width and color.

* platform/graphics/ca/mac/TileCache.mm:
(WebCore::TileCache::TileCache):
Initialize m_tileDebugBorderWidth.

(WebCore::TileCache::setTileDebugBorderWidth):
Update the border width of each tile layer.

(WebCore::TileCache::setTileDebugBorderColor):
Update the border color of each tile layer.

(WebCore::TileCache::createTileLayer):
Set the border color and border width.

* platform/graphics/ca/mac/WebTileCacheLayer.h:
* platform/graphics/ca/mac/WebTileCacheLayer.mm:
(-[WebTileCacheLayer borderColor]):
(-[WebTileCacheLayer setBorderColor:]):
(-[WebTileCacheLayer borderWidth]):
(-[WebTileCacheLayer setBorderWidth:]):
Call through to the TileCache.

* platform/graphics/mac/WebLayer.mm:
(drawLayerContents):
Don't draw the repaint counter for tile cache layers, each tile will maintain its own repaint counter.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106303 => 106304)


--- trunk/Source/WebCore/ChangeLog	2012-01-31 01:07:00 UTC (rev 106303)
+++ trunk/Source/WebCore/ChangeLog	2012-01-31 01:07:43 UTC (rev 106304)
@@ -1,3 +1,44 @@
+2012-01-30  Anders Carlsson  <[email protected]>
+
+        Show debug borders for individual tile cache tiles
+        https://bugs.webkit.org/show_bug.cgi?id=77388
+
+        Reviewed by Sam Weinig.
+
+        * platform/graphics/GraphicsLayer.cpp:
+        (WebCore::GraphicsLayer::updateDebugIndicators):
+        Give tile cache tiles a thin dark blue border.
+
+        * platform/graphics/ca/mac/TileCache.h:
+        (WebCore::TileCache::tileDebugBorderWidth):
+        (WebCore::TileCache::tileDebugBorderColor):
+        Add getters and member variables for the tile debug border width and color.
+
+        * platform/graphics/ca/mac/TileCache.mm:
+        (WebCore::TileCache::TileCache):
+        Initialize m_tileDebugBorderWidth.
+
+        (WebCore::TileCache::setTileDebugBorderWidth):
+        Update the border width of each tile layer.
+
+        (WebCore::TileCache::setTileDebugBorderColor):
+        Update the border color of each tile layer.
+
+        (WebCore::TileCache::createTileLayer):
+        Set the border color and border width.
+
+        * platform/graphics/ca/mac/WebTileCacheLayer.h:
+        * platform/graphics/ca/mac/WebTileCacheLayer.mm:
+        (-[WebTileCacheLayer borderColor]):
+        (-[WebTileCacheLayer setBorderColor:]):
+        (-[WebTileCacheLayer borderWidth]):
+        (-[WebTileCacheLayer setBorderWidth:]):
+        Call through to the TileCache.
+
+        * platform/graphics/mac/WebLayer.mm:
+        (drawLayerContents):
+        Don't draw the repaint counter for tile cache layers, each tile will maintain its own repaint counter.
+
 2012-01-30  Rakesh KN  <[email protected]>
 
         single-file input elements should refuse multi-file drags

Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (106303 => 106304)


--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-01-31 01:07:00 UTC (rev 106303)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp	2012-01-31 01:07:43 UTC (rev 106304)
@@ -326,7 +326,11 @@
 {
     if (GraphicsLayer::showDebugBorders()) {
         if (drawsContent()) {
-            if (m_usingTiledLayer)
+            // FIXME: It's weird to ask the client if this layer is a tile cache layer.
+            // Maybe we should just cache that information inside GraphicsLayer?
+            if (m_client->shouldUseTileCache(this)) // tile cache layer: dark blue
+                setDebugBorder(Color(0, 0, 128, 128), 0.5);
+            else if (m_usingTiledLayer)
                 setDebugBorder(Color(255, 128, 0, 128), 2); // tiled layer: orange
             else
                 setDebugBorder(Color(0, 128, 32, 128), 2); // normal layer: green

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h (106303 => 106304)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-01-31 01:07:00 UTC (rev 106303)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h	2012-01-31 01:07:43 UTC (rev 106304)
@@ -57,6 +57,12 @@
 
     CALayer *tileContainerLayer() const { return m_tileContainerLayer.get(); }
 
+    float tileDebugBorderWidth() const { return m_tileDebugBorderWidth; }
+    void setTileDebugBorderWidth(float);
+
+    CGColorRef tileDebugBorderColor() const { return m_tileDebugBorderColor.get(); }
+    void setTileDebugBorderColor(CGColorRef);
+
 private:
     TileCache(WebTileCacheLayer*, const IntSize& tileSize);
 
@@ -74,6 +80,9 @@
 
     RetainPtr<CALayer> m_tileContainerLayer;
 
+    RetainPtr<CGColorRef> m_tileDebugBorderColor;
+    float m_tileDebugBorderWidth;
+
     // Number of tiles in each dimension.
     IntSize m_numTilesInGrid;
 

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm (106303 => 106304)


--- trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-01-31 01:07:00 UTC (rev 106303)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm	2012-01-31 01:07:43 UTC (rev 106304)
@@ -52,6 +52,7 @@
     : m_tileCacheLayer(tileCacheLayer)
     , m_tileSize(tileSize)
     , m_tileContainerLayer(adoptCF([[CALayer alloc] init]))
+    , m_tileDebugBorderWidth(0)
     , m_acceleratesDrawing(false)
 {
     [CATransaction begin];
@@ -114,7 +115,7 @@
 void TileCache::setAcceleratesDrawing(bool acceleratesDrawing)
 {
 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
-    if (acceleratesDrawing == m_acceleratesDrawing)
+    if (m_acceleratesDrawing == acceleratesDrawing)
         return;
 
     m_acceleratesDrawing = acceleratesDrawing;
@@ -126,6 +127,26 @@
 #endif
 }
 
+void TileCache::setTileDebugBorderWidth(float borderWidth)
+{
+    if (m_tileDebugBorderWidth == borderWidth)
+        return;
+
+    m_tileDebugBorderWidth = borderWidth;
+    for (WebTileLayer* tileLayer in [m_tileContainerLayer.get() sublayers])
+        [tileLayer setBorderWidth:m_tileDebugBorderWidth];
+}
+
+void TileCache::setTileDebugBorderColor(CGColorRef borderColor)
+{
+    if (m_tileDebugBorderColor == borderColor)
+        return;
+
+    m_tileDebugBorderColor = borderColor;
+    for (WebTileLayer* tileLayer in [m_tileContainerLayer.get() sublayers])
+        [tileLayer setBorderColor:m_tileDebugBorderColor.get()];
+}
+
 IntRect TileCache::bounds() const
 {
     return IntRect(IntPoint(), IntSize([m_tileCacheLayer bounds].size));
@@ -193,6 +214,8 @@
     [layer.get() setBounds:CGRectMake(0, 0, m_tileSize.width(), m_tileSize.height())];
     [layer.get() setAnchorPoint:CGPointZero];
     [layer.get() setTileCache:this];
+    [layer.get() setBorderColor:m_tileDebugBorderColor.get()];
+    [layer.get() setBorderWidth:m_tileDebugBorderWidth];
 
 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
     [layer.get() setAcceleratesDrawing:m_acceleratesDrawing];

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h (106303 => 106304)


--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h	2012-01-31 01:07:00 UTC (rev 106303)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.h	2012-01-31 01:07:43 UTC (rev 106304)
@@ -35,4 +35,5 @@
 }
 
 - (CALayer *)tileContainerLayer;
+
 @end

Modified: trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm (106303 => 106304)


--- trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm	2012-01-31 01:07:00 UTC (rev 106303)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/WebTileCacheLayer.mm	2012-01-31 01:07:43 UTC (rev 106304)
@@ -77,4 +77,24 @@
     return _tileCache->tileContainerLayer();
 }
 
+- (CGColorRef)borderColor
+{
+    return _tileCache->tileDebugBorderColor();
+}
+
+- (void)setBorderColor:(CGColorRef)borderColor
+{
+    _tileCache->setTileDebugBorderColor(borderColor);
+}
+
+- (CGFloat)borderWidth
+{
+    return _tileCache->tileDebugBorderWidth();
+}
+
+- (void)setBorderWidth:(CGFloat)borderWidth
+{
+    _tileCache->setTileDebugBorderWidth(borderWidth);
+}
+
 @end

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


--- trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2012-01-31 01:07:00 UTC (rev 106303)
+++ trunk/Source/WebCore/platform/graphics/mac/WebLayer.mm	2012-01-31 01:07:43 UTC (rev 106304)
@@ -85,7 +85,7 @@
     // Re-fetch the layer owner, since <rdar://problem/9125151> indicates that it might have been destroyed during painting.
     layerContents = platformLayer->owner();
     ASSERT(layerContents);
-    if (layerContents && layerContents->platformCALayerShowRepaintCounter()) {
+    if (platformLayer->layerType() != PlatformCALayer::LayerTypeTileCacheLayer && layerContents && layerContents->platformCALayerShowRepaintCounter()) {
         bool isTiledLayer = [layer isKindOfClass:[CATiledLayer class]];
 
         char text[16]; // that's a lot of repaints
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to