Skip to content

Commit 739e32f

Browse files
[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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131941 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent ba5ba84 commit 739e32f

File tree

2 files changed

+46
-1
lines changed

2 files changed

+46
-1
lines changed

Tools/ChangeLog

+15
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
2012-10-19 Raphael Kubo da Costa <[email protected]>
2+
3+
[Cairo][WTR] Implement the painting of repaint rectangles.
4+
https://bugs.webkit.org/show_bug.cgi?id=99839
5+
6+
Reviewed by Martin Robinson.
7+
8+
Implement the required code to paint the gray overlay with
9+
transparent regions for the repaint rectangles, as other ports
10+
already do and as is already done in most WK1 ports.
11+
12+
* WebKitTestRunner/cairo/TestInvocationCairo.cpp:
13+
(WTR::paintRepaintRectOverlay):
14+
(WTR::TestInvocation::dumpPixelsAndCompareWithExpected):
15+
116
2012-09-08 Alpha Lam <[email protected]>
217

318
[chromium] Implement deferred image decoding

Tools/WebKitTestRunner/cairo/TestInvocationCairo.cpp

+31-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
* Copyright (C) 2009 Apple Inc. All rights reserved.
33
* (C) 2011 Brent Fulgham <[email protected]>. All rights reserved.
44
* (C) 2010, 2011 Igalia S.L
5+
* (C) 2012 Intel Corporation. All rights reserved.
56
*
67
* Redistribution and use in source and binary forms, with or without
78
* modification, are permitted provided that the following conditions
@@ -77,10 +78,39 @@ static void dumpBitmap(cairo_surface_t* surface, const char* checksum)
7778
printPNG(data, dataLength, checksum);
7879
}
7980

80-
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef /*repaintRects*/)
81+
static void paintRepaintRectOverlay(cairo_surface_t* surface, WKArrayRef repaintRects)
82+
{
83+
cairo_t* context = cairo_create(surface);
84+
85+
cairo_push_group(context);
86+
87+
// Paint the gray mask over the original image.
88+
cairo_set_source_rgba(context, 0, 0, 0, 0.66);
89+
cairo_paint(context);
90+
91+
// Paint transparent rectangles over the mask to show the repainted regions.
92+
cairo_set_source_rgba(context, 0, 0, 0, 0);
93+
cairo_set_operator(context, CAIRO_OPERATOR_SOURCE);
94+
size_t count = WKArrayGetSize(repaintRects);
95+
for (size_t i = 0; i < count; ++i) {
96+
WKRect rect = WKRectGetValue(static_cast<WKRectRef>(WKArrayGetItemAtIndex(repaintRects, i)));
97+
cairo_rectangle(context, rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
98+
cairo_fill(context);
99+
}
100+
101+
cairo_pop_group_to_source(context);
102+
cairo_paint(context);
103+
104+
cairo_destroy(context);
105+
}
106+
107+
void TestInvocation::dumpPixelsAndCompareWithExpected(WKImageRef wkImage, WKArrayRef repaintRects)
81108
{
82109
cairo_surface_t* surface = WKImageCreateCairoSurface(wkImage);
83110

111+
if (repaintRects)
112+
paintRepaintRectOverlay(surface, repaintRects);
113+
84114
char actualHash[33];
85115
computeMD5HashStringForCairoSurface(surface, actualHash);
86116
if (!compareActualHashToExpectedAndDumpResults(actualHash))

0 commit comments

Comments
 (0)