[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
commit-queue at webkit.org
commit-queue at webkit.org
Wed Dec 22 15:54:57 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit a3a994749bcf67fe7d5fcd49f0583fa3a1305305
Author: commit-queue at webkit.org <commit-queue at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Nov 16 17:14:42 2010 +0000
2010-11-16 Carlos Garcia Campos <cgarcia at igalia.com>
Reviewed by Martin Robinson.
[GTK] Use gdk_pixbuf_get_from_surface() when available
https://bugs.webkit.org/show_bug.cgi?id=49532
* platform/graphics/gtk/GdkCairoUtilities.cpp:
(cairoImageSurfaceToGdkPixbuf):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72106 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index a3cfd36..dd89e73 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-11-16 Carlos Garcia Campos <cgarcia at igalia.com>
+
+ Reviewed by Martin Robinson.
+
+ [GTK] Use gdk_pixbuf_get_from_surface() when available
+ https://bugs.webkit.org/show_bug.cgi?id=49532
+
+ * platform/graphics/gtk/GdkCairoUtilities.cpp:
+ (cairoImageSurfaceToGdkPixbuf):
+
2010-11-16 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Yury Semikhatsky.
diff --git a/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp b/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
index d768ce2..d8018a3 100644
--- a/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
+++ b/WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp
@@ -25,70 +25,15 @@
#include "config.h"
#include "GdkCairoUtilities.h"
+#include "GtkVersioning.h"
#include <cairo.h>
#include <gtk/gtk.h>
-static inline unsigned char* getCairoSurfacePixel(unsigned char* data, unsigned x, unsigned y, unsigned rowStride)
-{
- return data + (y * rowStride) + x * 4;
-}
-
-static inline guchar* getGdkPixbufPixel(guchar* data, unsigned x, unsigned y, unsigned rowStride)
-{
- return data + (y * rowStride) + x * 4;
-}
-
GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface)
{
- int width = cairo_image_surface_get_width(surface);
- int height = cairo_image_surface_get_height(surface);
- unsigned char* surfaceData = cairo_image_surface_get_data(surface);
- int surfaceRowStride = cairo_image_surface_get_stride(surface);
-
- GdkPixbuf* dest = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8, width, height);
- if (!dest)
- return 0;
-
- guchar* pixbufData = gdk_pixbuf_get_pixels(dest);
- int pixbufRowStride = gdk_pixbuf_get_rowstride(dest);
-
- /* From: http://cairographics.org/manual/cairo-image-surface.html#cairo-format-t
- * "CAIRO_FORMAT_ARGB32: each pixel is a 32-bit quantity, with alpha in
- * the upper 8 bits, then red, then green, then blue. The 32-bit
- * quantities are stored native-endian. Pre-multiplied alpha is used.
- * (That is, 50% transparent red is 0x80800000, not 0x80ff0000.)"
- *
- * See http://developer.gimp.org/api/2.0/gdk-pixbuf/gdk-pixbuf-gdk-pixbuf.html#GdkPixbuf
- * for information on the structure of GdkPixbufs stored with GDK_COLORSPACE_RGB.
- *
- * RGB color channels in CAIRO_FORMAT_ARGB32 are stored based on the
- * endianness of the machine and are also multiplied by the alpha channel.
- * To properly transfer the data from the Cairo surface we must divide each
- * of the RGB channels by the alpha channel and then reorder all channels
- * if this machine is little-endian.
- */
- for (int y = 0; y < height; y++) {
- for (int x = 0; x < width; x++) {
- unsigned char* source = getCairoSurfacePixel(surfaceData, x, y, surfaceRowStride);
- guchar* dest = getGdkPixbufPixel(pixbufData, x, y, pixbufRowStride);
-
-#if G_BYTE_ORDER == G_LITTLE_ENDIAN
- guchar alpha = source[3];
- dest[0] = alpha ? ((source[2] * 255) / alpha) : 0;
- dest[1] = alpha ? ((source[1] * 255) / alpha) : 0;
- dest[2] = alpha ? ((source[0] * 255) / alpha) : 0;
- dest[3] = alpha;
-#else
- guchar alpha = source[0];
- dest[0] = alpha ? ((source[1] * 255) / alpha) : 0;
- dest[1] = alpha ? ((source[2] * 255) / alpha) : 0;
- dest[2] = alpha ? ((source[3] * 255) / alpha) : 0;
- dest[3] = alpha;
-#endif
- }
- }
-
- return dest;
+ return gdk_pixbuf_get_from_surface(surface, 0, 0,
+ cairo_image_surface_get_width(surface),
+ cairo_image_surface_get_height(surface));
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list