Reviewed by Eric Seidel.
authorweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2007 18:14:27 +0000 (18:14 +0000)
committerweinig <weinig@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Jun 2007 18:14:27 +0000 (18:14 +0000)
        http://bugs.webkit.org/show_bug.cgi?id=14017
        Cairo: Unwanted gradient effect for small stretched images

        * platform/graphics/cairo/ImageCairo.cpp: Use CAIRO_FILTER_NEAREST to
        work around the issue.
        (WebCore::BitmapImage::draw):
        (WebCore::Image::drawPattern):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@22030 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebCore/ChangeLog
WebCore/platform/graphics/cairo/ImageCairo.cpp

index 34ab1fd88ba14a5b9d6c252e3261ebb4e5943d8f..0dfa25bccd0dd5d3836fd08578c4d89f79c51486 100644 (file)
@@ -1,3 +1,15 @@
+2007-06-06  Alp Toker  <alp.toker@collabora.co.uk>
+
+        Reviewed by Eric Seidel.
+
+        http://bugs.webkit.org/show_bug.cgi?id=14017
+        Cairo: Unwanted gradient effect for small stretched images
+
+        * platform/graphics/cairo/ImageCairo.cpp: Use CAIRO_FILTER_NEAREST to
+        work around the issue.
+        (WebCore::BitmapImage::draw):
+        (WebCore::Image::drawPattern):
+
 2007-06-06  Lars Knoll <lars@trolltech.com>
 
         Reviewed by Zack
index 0add53572edd528be27b97cabf9c41fd961418b4..c2559f1862fcecce1c5675d1b2f85137d718d1ec 100644 (file)
@@ -80,6 +80,13 @@ void BitmapImage::draw(GraphicsContext* ctxt, const FloatRect& dst, const FloatR
     // a pattern transformation on the image and draw the transformed pattern.
     // Test using example site at http://www.meyerweb.com/eric/css/edge/complexspiral/demo.html
     cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image);
+
+    // To avoid the unwanted gradient effect (#14017) we use
+    // CAIRO_FILTER_NEAREST now, but the real fix will be to have
+    // CAIRO_EXTEND_PAD implemented for surfaces in Cairo allowing us to still
+    // use bilinear filtering
+    cairo_pattern_set_filter(pattern, CAIRO_FILTER_NEAREST);
+
     float scaleX = srcRect.width() / dstRect.width();
     float scaleY = srcRect.height() / dstRect.height();
     cairo_matrix_t mat = { scaleX,  0, 0 , scaleY, srcRect.x(), srcRect.y() };
@@ -113,6 +120,9 @@ void Image::drawPattern(GraphicsContext* ctxt, const FloatRect& tileRect, const
     cairo_pattern_t* pattern = cairo_pattern_create_for_surface(image);
     cairo_pattern_set_extend(pattern, CAIRO_EXTEND_REPEAT);
 
+    // Workaround to avoid the unwanted gradient effect (#14017)
+    cairo_pattern_set_filter(pattern, CAIRO_FILTER_NEAREST);
+
     cairo_matrix_t pattern_matrix = cairo_matrix_t(patternTransform);
     cairo_matrix_t phase_matrix = {1, 0, 0, 1, phase.x(), phase.y()};
     cairo_matrix_t combined;