Changeset 106311 in webkit
- Timestamp:
- Jan 30, 2012 6:04:09 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r106310 r106311 1 2012-01-30 Anders Carlsson <andersca@apple.com> 2 3 Show repaint counters in individual tiles 4 https://bugs.webkit.org/show_bug.cgi?id=77390 5 <rdar://problem/10767967> 6 7 Reviewed by Darin Adler. 8 9 * platform/graphics/ca/mac/TileCache.h: 10 * platform/graphics/ca/mac/TileCache.mm: 11 (WebCore::TileCache::setNeedsDisplayInRect): 12 Make sure to invalidate the repaint counter rect if necessary. 13 14 (WebCore::TileCache::drawLayer): 15 Draw the repaint counter. 16 17 (WebCore::TileCache::showRepaintCounter): 18 New function that determines whether we should show repaint counters for the given tile cache. 19 20 * platform/graphics/ca/mac/WebTileLayer.h: 21 * platform/graphics/ca/mac/WebTileLayer.mm: 22 (-[WebTileLayer incrementRepaintCount]): 23 Add method for getting the repaint count. 24 1 25 2012-01-30 Dan Bernstein <mitz@apple.com> 2 26 -
trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.h
r106304 r106311 76 76 RetainPtr<WebTileLayer> createTileLayer(); 77 77 78 bool shouldShowRepaintCounters() const; 79 78 80 WebTileCacheLayer* m_tileCacheLayer; 79 81 const IntSize m_tileSize; -
trunk/Source/WebCore/platform/graphics/ca/mac/TileCache.mm
r106304 r106311 92 92 CGRect tileRect = [m_tileCacheLayer convertRect:rect toLayer:tileLayer]; 93 93 94 if (!CGRectIsEmpty(tileRect)) 94 if (!CGRectIsEmpty(tileRect)) { 95 95 [tileLayer setNeedsDisplayInRect:tileRect]; 96 97 if (shouldShowRepaintCounters()) { 98 CGRect bounds = [tileLayer bounds]; 99 CGRect indicatorRect = CGRectMake(bounds.origin.x, bounds.origin.y, 52, 27); 100 [tileLayer setNeedsDisplayInRect:indicatorRect]; 101 } 102 } 96 103 } 97 104 } … … 110 117 drawLayerContents(context, layer, platformLayer); 111 118 119 CGContextRestoreGState(context); 120 121 unsigned repaintCount = [layer incrementRepaintCount]; 122 if (!shouldShowRepaintCounters()) 123 return; 124 125 // FIXME: Some of this code could be shared with WebLayer. 126 char text[16]; // that's a lot of repaints 127 snprintf(text, sizeof(text), "%d", repaintCount); 128 129 CGRect indicatorBox = [layer bounds]; 130 indicatorBox.size.width = 12 + 10 * strlen(text); 131 indicatorBox.size.height = 27; 132 CGContextSaveGState(context); 133 134 CGContextSetAlpha(context, 0.5f); 135 CGContextBeginTransparencyLayerWithRect(context, indicatorBox, 0); 136 137 CGContextSetFillColorWithColor(context, m_tileDebugBorderColor.get()); 138 CGContextFillRect(context, indicatorBox); 139 140 if (platformLayer->acceleratesDrawing()) 141 CGContextSetRGBFillColor(context, 1, 0, 0, 1); 142 else 143 CGContextSetRGBFillColor(context, 1, 1, 1, 1); 144 145 CGContextSetTextMatrix(context, CGAffineTransformMakeScale(1, -1)); 146 CGContextSelectFont(context, "Helvetica", 22, kCGEncodingMacRoman); 147 CGContextShowTextAtPoint(context, indicatorBox.origin.x + 5, indicatorBox.origin.y + 22, text, strlen(text)); 148 149 CGContextEndTransparencyLayer(context); 112 150 CGContextRestoreGState(context); 113 151 } … … 225 263 } 226 264 265 bool TileCache::shouldShowRepaintCounters() const 266 { 267 PlatformCALayer* platformLayer = PlatformCALayer::platformCALayer(m_tileCacheLayer); 268 if (!platformLayer) 269 return false; 270 271 WebCore::PlatformCALayerClient* layerContents = platformLayer->owner(); 272 ASSERT(layerContents); 273 if (!layerContents) 274 return false; 275 276 return layerContents->platformCALayerShowRepaintCounter(); 277 } 278 227 279 } // namespace WebCore -
trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.h
r103114 r106311 33 33 @interface WebTileLayer : CALayer { 34 34 WebCore::TileCache* _tileCache; 35 unsigned _repaintCount; 35 36 } 37 36 38 - (void)setTileCache:(WebCore::TileCache*)tileCache; 39 - (unsigned)incrementRepaintCount; 37 40 @end 38 41 -
trunk/Source/WebCore/platform/graphics/ca/mac/WebTileLayer.mm
r103114 r106311 53 53 } 54 54 55 - (unsigned)incrementRepaintCount 56 { 57 return ++_repaintCount; 58 } 59 55 60 @end 56 61
Note: See TracChangeset
for help on using the changeset viewer.