[Mac] Show repaint counters in tile coverage map.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Oct 2014 06:26:07 +0000 (06:26 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Oct 2014 06:26:07 +0000 (06:26 +0000)
<https://webkit.org/b/137544>

Reviewed by Simon Fraser.

Add repaint counters to the tile layers in the "tiled scrolling
indicator" display. This will be helpful for diagnosing issues with
excessive tile repaints outside the visible viewport.

* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::setNeedsDisplayInRect):
* platform/graphics/ca/TileGrid.cpp:
(WebCore::TileGrid::drawTileMapContents):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@174496 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ca/TileController.cpp
Source/WebCore/platform/graphics/ca/TileGrid.cpp

index 548b9d8..d41dbe4 100644 (file)
@@ -1,3 +1,19 @@
+2014-10-08  Andreas Kling  <akling@apple.com>
+
+        [Mac] Show repaint counters in tile coverage map.
+        <https://webkit.org/b/137544>
+
+        Reviewed by Simon Fraser.
+
+        Add repaint counters to the tile layers in the "tiled scrolling
+        indicator" display. This will be helpful for diagnosing issues with
+        excessive tile repaints outside the visible viewport.
+
+        * platform/graphics/ca/TileController.cpp:
+        (WebCore::TileController::setNeedsDisplayInRect):
+        * platform/graphics/ca/TileGrid.cpp:
+        (WebCore::TileGrid::drawTileMapContents):
+
 2014-10-08  Myles C. Maxfield  <mmaxfield@apple.com>
 
         Unreviewed build fix after r174480. Broke iOS build.
index 91d3940..f59b4d7 100644 (file)
@@ -95,6 +95,7 @@ void TileController::setNeedsDisplayInRect(const IntRect& rect)
     tileGrid().setNeedsDisplayInRect(rect);
     if (m_zoomedOutTileGrid)
         m_zoomedOutTileGrid->dropTilesInRect(rect);
+    updateTileCoverageMap();
 }
 
 void TileController::setContentsScale(float scale)
index 5fcd55a..44d144e 100644 (file)
@@ -31,6 +31,7 @@
 #include "PlatformCALayer.h"
 #include "TileController.h"
 #include <wtf/MainThread.h>
+#include <wtf/text/CString.h>
 
 #if PLATFORM(IOS)
 #include "TileControllerMemoryHandlerIOS.h"
@@ -633,6 +634,21 @@ void TileGrid::drawTileMapContents(CGContextRef context, CGRect layerBounds) con
         CGRect frame = CGRectMake(tileLayer->position().x(), tileLayer->position().y(), tileLayer->bounds().size().width(), tileLayer->bounds().size().height());
         CGContextFillRect(context, frame);
         CGContextStrokeRect(context, frame);
+
+        CGContextSetRGBFillColor(context, 0, 0, 0, 0.5);
+
+        String repaintCount = String::number(m_tileRepaintCounts.get(tileLayer));
+
+        CGContextSaveGState(context);
+        CGContextSetTextMatrix(context, CGAffineTransformMakeScale(3, -3));
+
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wdeprecated-declarations"
+        CGContextSelectFont(context, "Helvetica", 58, kCGEncodingMacRoman);
+        CGContextShowTextAtPoint(context, frame.origin.x + 64, frame.origin.y + 192, repaintCount.ascii().data(), repaintCount.length());
+#pragma clang diagnostic pop
+
+        CGContextRestoreGState(context);
     }
 }