From: YongGeol Jung Date: Mon, 3 Jun 2013 00:50:57 +0000 (+0900) Subject: Fix side effect of pattern optimization. X-Git-Tag: 2.2.1_release~196 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=580dce7cef4c82dec1cca64070268ac9adc74925;p=framework%2Fweb%2Fwebkit-efl.git Fix side effect of pattern optimization. [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 --- diff --git a/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp b/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp index d4686b7..d1b2d18 100644 --- a/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp +++ b/Source/WebCore/platform/graphics/cairo/CairoUtilities.cpp @@ -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 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 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(); }