Title: [134676] trunk/Source
Revision
134676
Author
commit-qu...@webkit.org
Date
2012-11-14 15:02:37 -0800 (Wed, 14 Nov 2012)

Log Message

[TexMap][Cairo] Accelerated compositing debug visuals
https://bugs.webkit.org/show_bug.cgi?id=101883

Patch by Helder Correia <helder.corr...@nokia.com> on 2012-11-14
Reviewed by Kenneth Rohde Christiansen.

No new tests, just introducing a debug feature.

Add a Cairo implementation to complement the patch from bug 90116
(http://trac.webkit.org/changeset/122275).

For this feature to be enabled, the environment variable
WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS must be set to 1. Once enabled,
both repaint counters and tile borders will be painted.

A Cairo-specific drawRepaintCounter() implementation was added to
TextureMapperGL. A cairo_surface_t is used as scratch buffer to paint
the counters. It is then uploaded to a BitmapTexture acquired
from the pool and finally draw by TextureMapper. The actual compositing
happens inside LayerBackingStore::paintToTextureMapper(). Each
LayerBackingStoreTile has a repaint counter which gets incremented in
LayerBackingStore::updateTile().

Source/WebCore:

* platform/graphics/texmap/TextureMapperGL.cpp:
(WebCore::TextureMapperGL::drawRepaintCounter):

Source/WebKit2:

* UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp:
(WebKit::shouldShowTileDebugVisuals):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134675 => 134676)


--- trunk/Source/WebCore/ChangeLog	2012-11-14 23:01:14 UTC (rev 134675)
+++ trunk/Source/WebCore/ChangeLog	2012-11-14 23:02:37 UTC (rev 134676)
@@ -1,3 +1,30 @@
+2012-11-14  Helder Correia  <helder.corr...@nokia.com>
+
+        [TexMap][Cairo] Accelerated compositing debug visuals
+        https://bugs.webkit.org/show_bug.cgi?id=101883
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        No new tests, just introducing a debug feature.
+
+        Add a Cairo implementation to complement the patch from bug 90116
+        (http://trac.webkit.org/changeset/122275).
+
+        For this feature to be enabled, the environment variable
+        WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS must be set to 1. Once enabled,
+        both repaint counters and tile borders will be painted.
+
+        A Cairo-specific drawRepaintCounter() implementation was added to
+        TextureMapperGL. A cairo_surface_t is used as scratch buffer to paint
+        the counters. It is then uploaded to a BitmapTexture acquired
+        from the pool and finally draw by TextureMapper. The actual compositing
+        happens inside LayerBackingStore::paintToTextureMapper(). Each
+        LayerBackingStoreTile has a repaint counter which gets incremented in
+        LayerBackingStore::updateTile().
+
+        * platform/graphics/texmap/TextureMapperGL.cpp:
+        (WebCore::TextureMapperGL::drawRepaintCounter):
+
 2012-11-14  Michael Pruett  <mich...@68k.org>
 
         IndexedDB: Add JSNoStaticTables to IndexedDB interfaces

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp (134675 => 134676)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2012-11-14 23:01:14 UTC (rev 134675)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperGL.cpp	2012-11-14 23:02:37 UTC (rev 134676)
@@ -42,6 +42,7 @@
 #include "CairoUtilities.h"
 #include "RefPtrCairo.h"
 #include <cairo.h>
+#include <wtf/text/CString.h>
 #endif
 
 #if ENABLE(CSS_SHADERS)
@@ -350,6 +351,39 @@
     const uchar* bits = image.bits();
     texture->updateContents(bits, sourceRect, IntPoint::zero(), image.bytesPerLine(), BitmapTexture::UpdateCanModifyOriginalImageData);
     drawTexture(*texture, targetRect, modelViewMatrix, 1.0f, 0, AllEdges);
+
+#elif USE(CAIRO)
+    CString counterString = String::number(value).ascii();
+    // cairo_text_extents() requires a cairo_t, so dimensions need to be guesstimated.
+    int width = counterString.length() * pointSize * 1.2;
+    int height = pointSize * 1.5;
+
+    cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height);
+    cairo_t* cr = cairo_create(surface);
+    cairo_surface_destroy(surface);
+
+    cairo_set_source_rgb(cr, 1, 0, 0);
+    cairo_rectangle(cr, 0, 0, width, height);
+    cairo_fill(cr);
+
+    cairo_select_font_face(cr, "Monospace", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
+    cairo_set_font_size(cr, pointSize);
+    cairo_set_source_rgb(cr, 1, 1, 1);
+    cairo_move_to(cr, 2, pointSize);
+    cairo_show_text(cr, counterString.data());
+
+    IntSize size(width, height);
+    IntRect sourceRect(IntPoint::zero(), size);
+    IntRect targetRect(roundedIntPoint(targetPoint), size);
+
+    RefPtr<BitmapTexture> texture = acquireTextureFromPool(size);
+    const unsigned char* bits = cairo_image_surface_get_data(surface);
+    int stride = cairo_image_surface_get_stride(surface);
+    texture->updateContents(bits, sourceRect, IntPoint::zero(), stride, BitmapTexture::UpdateCanModifyOriginalImageData);
+    drawTexture(*texture, targetRect, modelViewMatrix, 1.0f, 0, AllEdges);
+
+    cairo_destroy(cr);
+
 #else
     UNUSED_PARAM(value);
     UNUSED_PARAM(pointSize);

Modified: trunk/Source/WebKit2/ChangeLog (134675 => 134676)


--- trunk/Source/WebKit2/ChangeLog	2012-11-14 23:01:14 UTC (rev 134675)
+++ trunk/Source/WebKit2/ChangeLog	2012-11-14 23:02:37 UTC (rev 134676)
@@ -1,3 +1,30 @@
+2012-11-14  Helder Correia  <helder.corr...@nokia.com>
+
+        [TexMap][Cairo] Accelerated compositing debug visuals
+        https://bugs.webkit.org/show_bug.cgi?id=101883
+
+        Reviewed by Kenneth Rohde Christiansen.
+
+        No new tests, just introducing a debug feature.
+
+        Add a Cairo implementation to complement the patch from bug 90116
+        (http://trac.webkit.org/changeset/122275).
+
+        For this feature to be enabled, the environment variable
+        WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS must be set to 1. Once enabled,
+        both repaint counters and tile borders will be painted.
+
+        A Cairo-specific drawRepaintCounter() implementation was added to
+        TextureMapperGL. A cairo_surface_t is used as scratch buffer to paint
+        the counters. It is then uploaded to a BitmapTexture acquired
+        from the pool and finally draw by TextureMapper. The actual compositing
+        happens inside LayerBackingStore::paintToTextureMapper(). Each
+        LayerBackingStoreTile has a repaint counter which gets incremented in
+        LayerBackingStore::updateTile().
+
+        * UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp:
+        (WebKit::shouldShowTileDebugVisuals):
+
 2012-11-14  No'am Rosenthal  <noam.rosent...@nokia.com>
 
         Coordinated Graphics: Rename m_CoordinatedGraphicsLayerClient to m_coordinator

Modified: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp (134675 => 134676)


--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp	2012-11-14 23:01:14 UTC (rev 134675)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp	2012-11-14 23:02:37 UTC (rev 134676)
@@ -110,6 +110,8 @@
 {
 #if PLATFORM(QT)
     return (qgetenv("QT_WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS") == "1");
+#elif USE(CAIRO)
+    return (String(getenv("WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS")) == "1");
 #endif
     return false;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to