Modified: trunk/Source/WebCore/ChangeLog (118060 => 118061)
--- trunk/Source/WebCore/ChangeLog 2012-05-22 21:56:36 UTC (rev 118060)
+++ trunk/Source/WebCore/ChangeLog 2012-05-22 22:08:20 UTC (rev 118061)
@@ -1,3 +1,20 @@
+2012-05-22 Martin Robinson <[email protected]>
+
+ [TextureMapper] [Cairo] Implement repaint counters
+ https://bugs.webkit.org/show_bug.cgi?id=87062
+
+ Reviewed by Gustavo Noronha Silva.
+
+ No new tests. This just adds a debugging feature that shouldn't
+ affect the normal drawing of a page.
+
+ * platform/graphics/texmap/TextureMapperLayer.cpp:
+ (WebCore::TextureMapperLayer::updateBackingStore): Now, if repaint counters are
+ enabled, increment the repaint count and call drawRepaintCounter.
+ (WebCore::TextureMapperLayer::drawRepaintCounter): Added.
+ * platform/graphics/texmap/TextureMapperLayer.h:
+ (TextureMapperLayer): Added declaration for drawRepaintCounter.
+
2012-05-22 Simon Fraser <[email protected]>
Use the same animation begin time while updating compositing layers
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (118060 => 118061)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2012-05-22 21:56:36 UTC (rev 118060)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp 2012-05-22 22:08:20 UTC (rev 118061)
@@ -26,9 +26,13 @@
#include "GraphicsLayerTextureMapper.h"
#include "ImageBuffer.h"
-
+#include "NotImplemented.h"
#include <wtf/MathExtras.h>
+#if USE(CAIRO)
+#include "CairoUtilities.h"
+#endif
+
namespace WebCore {
TextureMapperLayer* toTextureMapperLayer(GraphicsLayer* layer)
@@ -122,8 +126,12 @@
context->translate(-dirtyRect.x(), -dirtyRect.y());
layer->paintGraphicsLayerContents(*context, dirtyRect);
+ if (layer->showRepaintCounter()) {
+ layer->incrementRepaintCount();
+ drawRepaintCounter(context, layer);
+ }
+
RefPtr<Image> image = imageBuffer->copyImage(DontCopyBackingStore);
-
TextureMapperTiledBackingStore* backingStore = static_cast<TextureMapperTiledBackingStore*>(m_backingStore.get());
backingStore->updateContents(textureMapper, image.get(), m_size, dirtyRect);
@@ -562,5 +570,40 @@
m_debugBorderWidth = width * 2;
}
+#if USE(CAIRO)
+void TextureMapperLayer::drawRepaintCounter(GraphicsContext* context, GraphicsLayer* layer)
+{
+
+ cairo_t* cr = context->platformContext()->cr();
+ cairo_save(cr);
+
+ CString repaintCount = String::format("%i", layer->repaintCount()).utf8();
+ cairo_select_font_face(cr, "sans-serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+ cairo_set_font_size(cr, 18);
+
+ cairo_text_extents_t repaintTextExtents;
+ cairo_text_extents(cr, repaintCount.data(), &repaintTextExtents);
+
+ static const int repaintCountBorderWidth = 10;
+ setSourceRGBAFromColor(cr, layer->showDebugBorders() ? m_debugBorderColor : Color(0, 255, 0, 127));
+ cairo_rectangle(cr, 0, 0,
+ repaintTextExtents.width + (repaintCountBorderWidth * 2),
+ repaintTextExtents.height + (repaintCountBorderWidth * 2));
+ cairo_fill(cr);
+
+ cairo_set_source_rgb(cr, 1, 1, 1);
+ cairo_move_to(cr, repaintCountBorderWidth, repaintTextExtents.height + repaintCountBorderWidth);
+ cairo_show_text(cr, repaintCount.data());
+
+ cairo_restore(cr);
}
+#else
+void TextureMapperLayer::drawRepaintCounter(GraphicsContext* context, GraphicsLayer* layer)
+{
+ notImplemented();
+}
+
#endif
+
+}
+#endif
Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (118060 => 118061)
--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2012-05-22 21:56:36 UTC (rev 118060)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h 2012-05-22 22:08:20 UTC (rev 118061)
@@ -157,6 +157,8 @@
void paintSelfAndChildrenWithReplica(const TextureMapperPaintOptions&);
void updateBackingStore(TextureMapper*, GraphicsLayerTextureMapper*);
+ void drawRepaintCounter(GraphicsContext*, GraphicsLayer*);
+
void syncAnimations();
bool isVisible() const;
enum ContentsLayerCount {