Title: [131941] trunk/Tools
Revision
131941
Author
[email protected]
Date
2012-10-19 13:47:15 -0700 (Fri, 19 Oct 2012)

Log Message

[Cairo][WTR] Implement the painting of repaint rectangles.
https://bugs.webkit.org/show_bug.cgi?id=99839

Reviewed by Martin Robinson.

Implement the required code to paint the gray overlay with
transparent regions for the repaint rectangles, as other ports
already do and as is already done in most WK1 ports.

* WebKitTestRunner/cairo/TestInvocationCairo.cpp:
(WTR::paintRepaintRectOverlay):
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (131940 => 131941)


--- trunk/Tools/ChangeLog	2012-10-19 20:43:46 UTC (rev 131940)
+++ trunk/Tools/ChangeLog	2012-10-19 20:47:15 UTC (rev 131941)
@@ -1,3 +1,18 @@
+2012-10-19  Raphael Kubo da Costa  <[email protected]>
+
+        [Cairo][WTR] Implement the painting of repaint rectangles.
+        https://bugs.webkit.org/show_bug.cgi?id=99839
+
+        Reviewed by Martin Robinson.
+
+        Implement the required code to paint the gray overlay with
+        transparent regions for the repaint rectangles, as other ports
+        already do and as is already done in most WK1 ports.
+
+        * WebKitTestRunner/cairo/TestInvocationCairo.cpp:
+        (WTR::paintRepaintRectOverlay):
+        (WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
+
 2012-09-08  Alpha Lam  <[email protected]>
 
         [chromium] Implement deferred image decoding

Modified: trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp (131940 => 131941)


--- trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp	2012-10-19 20:43:46 UTC (rev 131940)
+++ trunk/Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp	2012-10-19 20:47:15 UTC (rev 131941)
@@ -2,6 +2,7 @@
  * Copyright (C) 2009 Apple Inc. All rights reserved.
  *           (C) 2011 Brent Fulgham <[email protected]>. All rights reserved.
  *           (C) 2010, 2011 Igalia S.L
+ *           (C) 2012 Intel Corporation. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -77,10 +78,39 @@
     printPNG(data, dataLength, checksum);
 }
 
-void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef /*repaintRects*/)
+static void paintRepaintRectOverlay(cairo_surface_t* surface, WKArrayRef repaintRects)
 {
+    cairo_t* context = cairo_create(surface);
+
+    cairo_push_group(context);
+
+    // Paint the gray mask over the original image.
+    cairo_set_source_rgba(context, 0, 0, 0, 0.66);
+    cairo_paint(context);
+
+    // Paint transparent rectangles over the mask to show the repainted regions.
+    cairo_set_source_rgba(context, 0, 0, 0, 0);
+    cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
+    size_t count = WKArrayGetSize(repaintRects);
+    for (size_t i = 0; i < count; ++i) {
+        WKRect rect = WKRectGetValue(static_cast<WKRectRef>(WKArrayGetItemAtIndex(repaintRects, i)));
+        cairo_rectangle(context, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
+        cairo_fill(context);
+    }
+
+    cairo_pop_group_to_source(context);
+    cairo_paint(context);
+
+    cairo_destroy(context);
+}
+
+void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef repaintRects)
+{
     cairo_surface_t* surface = WKImageCreateCairoSurface(wkImage);
 
+    if (repaintRects)
+        paintRepaintRectOverlay(surface, repaintRects);
+
     char actualHash[33];
     computeMD5HashStringForCairoSurface(surface, actualHash);
     if (!compareActualHashToExpectedAndDumpResults(actualHash))
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to