Fix side effect of pattern optimization.
authorYongGeol Jung <yg48.jung@samsung.com>
Mon, 3 Jun 2013 00:50:57 +0000 (09:50 +0900)
committerHurnjoo Lee <hurnjoo.lee@samsung.com>
Mon, 23 Sep 2013 09:35:09 +0000 (18:35 +0900)
[Title] Fix side effect of pattern optimization.
[Issue#] DCM-1635
[Problem] View of footer is displayed wrongly.
[Cause] Edge of pattern image is transparent.
[Solution] Pixels outside of the pattern copy the closest pixel from the source.

Change-Id: I013b9223b7b3e75285bebc0ef354aa04781cb898

Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp

index d4686b7..d1b2d18 100644 (file)
@@ -371,10 +371,14 @@ void drawPatternToCairoContext(cairo_t* cr, cairo_surface_t* image, const IntSiz
 #else
         scaledImageSurface = adoptRef(cairo_image_surface_create(CAIRO_FORMAT_ARGB32, destBitmapWidth, destBitmapHeight));
 #endif
+        RefPtr<cairo_pattern_t> scaledPattern = adoptRef(cairo_pattern_create_for_surface(image));
+        cairo_matrix_t matrix = { 1 / totalMatrix.xx, 0, 0, 1 / totalMatrix.yy, 0, 0 };
+        cairo_pattern_set_matrix(scaledPattern.get(), &matrix);
+        cairo_pattern_set_extend(scaledPattern.get(), CAIRO_EXTEND_PAD);
+
         RefPtr<cairo_t> scaledImageContext = adoptRef(cairo_create(scaledImageSurface.get()));
         cairo_set_operator(scaledImageContext.get(), CAIRO_OPERATOR_SOURCE);
-        cairo_scale(scaledImageContext.get(), totalMatrix.xx, totalMatrix.yy);
-        cairo_set_source_surface(scaledImageContext.get(), image, 0, 0);
+        cairo_set_source(scaledImageContext.get(), scaledPattern.get());
         cairo_paint(scaledImageContext.get());
         image = scaledImageSurface.get();
     }