Title: [115058] trunk
Revision
115058
Author
carlo...@webkit.org
Date
2012-04-24 08:25:13 -0700 (Tue, 24 Apr 2012)

Log Message

[GTK] Should pass canvas/philip/tests/toDataURL.jpeg.alpha.html
https://bugs.webkit.org/show_bug.cgi?id=83973

Reviewed by Philippe Normand.

Source/WebCore:

Test: canvas/philip/tests/toDataURL.jpeg.alpha.html

* platform/graphics/gtk/ImageBufferGtk.cpp:
(WebCore::encodeImage): Convert ARGB32 cairo surface into RGB24
when encoding JPEG images since JPEG encoder doesn't support alpha
channel.

LayoutTests:

* platform/gtk/test_expectations.txt: Unskip
canvas/philip/tests/toDataURL.jpeg.alpha.html

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (115057 => 115058)


--- trunk/LayoutTests/ChangeLog	2012-04-24 15:18:40 UTC (rev 115057)
+++ trunk/LayoutTests/ChangeLog	2012-04-24 15:25:13 UTC (rev 115058)
@@ -1,3 +1,13 @@
+2012-04-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        [GTK] Should pass canvas/philip/tests/toDataURL.jpeg.alpha.html
+        https://bugs.webkit.org/show_bug.cgi?id=83973
+
+        Reviewed by Philippe Normand.
+
+        * platform/gtk/test_expectations.txt: Unskip
+        canvas/philip/tests/toDataURL.jpeg.alpha.html
+
 2012-04-24  Florin Malita  <fmal...@google.com>
 
         WebCore::EventTarget::addEventListener crash

Modified: trunk/LayoutTests/platform/gtk/test_expectations.txt (115057 => 115058)


--- trunk/LayoutTests/platform/gtk/test_expectations.txt	2012-04-24 15:18:40 UTC (rev 115057)
+++ trunk/LayoutTests/platform/gtk/test_expectations.txt	2012-04-24 15:25:13 UTC (rev 115058)
@@ -989,7 +989,6 @@
 BUGWKGTK : canvas/philip/tests/2d.text.font.parse.size.percentage.default.html = FAIL
 BUGWKGTK : canvas/philip/tests/2d.text.font.parse.system.html = FAIL
 BUGWKGTK : canvas/philip/tests/2d.text.measure.width.space.html = FAIL
-BUGWKGTK : canvas/philip/tests/toDataURL.jpeg.alpha.html = FAIL
 BUGWKGTK : canvas/philip/tests/type.prototype.html = FAIL
 
 

Modified: trunk/Source/WebCore/ChangeLog (115057 => 115058)


--- trunk/Source/WebCore/ChangeLog	2012-04-24 15:18:40 UTC (rev 115057)
+++ trunk/Source/WebCore/ChangeLog	2012-04-24 15:25:13 UTC (rev 115058)
@@ -1,5 +1,19 @@
 2012-04-24  Carlos Garcia Campos  <cgar...@igalia.com>
 
+        [GTK] Should pass canvas/philip/tests/toDataURL.jpeg.alpha.html
+        https://bugs.webkit.org/show_bug.cgi?id=83973
+
+        Reviewed by Philippe Normand.
+
+        Test: canvas/philip/tests/toDataURL.jpeg.alpha.html
+
+        * platform/graphics/gtk/ImageBufferGtk.cpp:
+        (WebCore::encodeImage): Convert ARGB32 cairo surface into RGB24
+        when encoding JPEG images since JPEG encoder doesn't support alpha
+        channel.
+
+2012-04-24  Carlos Garcia Campos  <cgar...@igalia.com>
+
         [GTK] Add WebKitCookieManager::changed signal to WebKit2 GTK+ API
         https://bugs.webkit.org/show_bug.cgi?id=82598
 

Modified: trunk/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp (115057 => 115058)


--- trunk/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp	2012-04-24 15:18:40 UTC (rev 115057)
+++ trunk/Source/WebCore/platform/graphics/gtk/ImageBufferGtk.cpp	2012-04-24 15:25:13 UTC (rev 115058)
@@ -40,7 +40,18 @@
     if (type != "jpeg" && type != "png" && type != "tiff" && type != "ico" && type != "bmp")
         return false;
 
-    GRefPtr<GdkPixbuf> pixbuf = cairoImageSurfaceToGdkPixbuf(surface);
+    GRefPtr<GdkPixbuf> pixbuf;
+    if (type == "jpeg") {
+        // JPEG doesn't support alpha channel. The <canvas> spec states that toDataURL() must encode a Porter-Duff
+        // composite source-over black for image types that do not support alpha.
+        RefPtr<cairo_surface_t> newSurface = adoptRef(cairo_image_surface_create_for_data(cairo_image_surface_get_data(surface),
+                                                                                          CAIRO_FORMAT_RGB24,
+                                                                                          cairo_image_surface_get_width(surface),
+                                                                                          cairo_image_surface_get_height(surface),
+                                                                                          cairo_image_surface_get_stride(surface)));
+        pixbuf = adoptGRef(cairoImageSurfaceToGdkPixbuf(newSurface.get()));
+    } else
+        pixbuf = adoptGRef(cairoImageSurfaceToGdkPixbuf(surface));
     if (!pixbuf)
         return false;
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to