RESOLVED FIXED 49532
[GTK] Use gdk_pixbuf_get_from_surface() when available
https://bugs.webkit.org/show_bug.cgi?id=49532
Summary [GTK] Use gdk_pixbuf_get_from_surface() when available
Carlos Garcia Campos
Reported 2010-11-15 04:19:27 PST
Since gtk3, there's gdk_pixbuf_get_from_surface() to convert an image cairo surface into a GdkPixbuf.
Attachments
Patch to use gdk_pixbuf_get_from_surface() (1.51 KB, patch)
2010-11-15 04:23 PST, Carlos Garcia Campos
mrobinson: review-
mrobinson: commit-queue-
Updated patch using GtkVersioning (3.84 KB, patch)
2010-11-16 00:13 PST, Carlos Garcia Campos
no flags
Carlos Garcia Campos
Comment 1 2010-11-15 04:23:31 PST
Created attachment 73885 [details] Patch to use gdk_pixbuf_get_from_surface()
Martin Robinson
Comment 2 2010-11-15 10:40:28 PST
Comment on attachment 73885 [details] Patch to use gdk_pixbuf_get_from_surface() View in context: https://bugs.webkit.org/attachment.cgi?id=73885&action=review > WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp:37 > +#ifndef GTK_API_VERSION_2 > +GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface) > +{ > + return gdk_pixbuf_get_from_surface(surface, 0, 0, > + cairo_image_surface_get_width(surface), > + cairo_image_surface_get_height(surface)); Is this new method used anywhere? Ideally a code change like this should be accompanied by a corresponding change in functionality somewhere. If there is some hidden functionality change it should be outlined in the ChangeLog.
Carlos Garcia Campos
Comment 3 2010-11-16 00:08:06 PST
This is not a new method: ./WebCore/platform/graphics/gtk/ImageBufferGtk.cpp: PlatformRefPtr<GdkPixbuf> pixbuf = cairoImageSurfaceToGdkPixbuf(m_data.m_surface); ./WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp:GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface) ./WebCore/platform/graphics/gtk/ImageGtk.cpp: return cairoImageSurfaceToGdkPixbuf(frameAtIndex(currentFrame())); and there isn't any new functionality hidden, it's just a new implementation for the method using gdk api to make the code simpler and easier tom maintain. This method is used when, for example, when creating the image during a drag and drop operation, or when saving an image as jpeg, png, etc.
Carlos Garcia Campos
Comment 4 2010-11-16 00:13:39 PST
Created attachment 73970 [details] Updated patch using GtkVersioning I had forgotten I already added gdk_pixbuf_get_from_surface() to GtkVersioning, we can use it unconditionally.
Martin Robinson
Comment 5 2010-11-16 08:25:04 PST
Comment on attachment 73970 [details] Updated patch using GtkVersioning Great.
Martin Robinson
Comment 6 2010-11-16 08:27:46 PST
(In reply to comment #3) > This is not a new method: > ./WebCore/platform/graphics/gtk/ImageBufferGtk.cpp: PlatformRefPtr<GdkPixbuf> pixbuf = cairoImageSurfaceToGdkPixbuf(m_data.m_surface); > ./WebCore/platform/graphics/gtk/GdkCairoUtilities.cpp:GdkPixbuf* cairoImageSurfaceToGdkPixbuf(cairo_surface_t* surface) > ./WebCore/platform/graphics/gtk/ImageGtk.cpp: return cairoImageSurfaceToGdkPixbuf(frameAtIndex(currentFrame())); Right. I was just a little confused that because it didn't remove the old implementation of the method. :)
WebKit Commit Bot
Comment 7 2010-11-16 09:15:02 PST
Comment on attachment 73970 [details] Updated patch using GtkVersioning Clearing flags on attachment: 73970 Committed r72106: <http://trac.webkit.org/changeset/72106>
WebKit Commit Bot
Comment 8 2010-11-16 09:15:07 PST
All reviewed patches have been landed. Closing bug.
WebKit Review Bot
Comment 9 2010-11-16 10:08:19 PST
http://trac.webkit.org/changeset/72106 might have broken GTK Linux 64-bit Debug The following tests are not passing: editing/selection/move-past-trailing-space.html fast/blockflow/japanese-ruby-horizontal-bt.html fast/blockflow/japanese-ruby-vertical-lr.html fast/blockflow/japanese-ruby-vertical-rl.html
Note You need to log in before you can comment on or make changes to this bug.