Since gtk3, there's gdk_pixbuf_get_from_surface() to convert an image cairo surface into a GdkPixbuf.
Created attachment 73885 [details] Patch to use gdk_pixbuf_get_from_surface()
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.
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.
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.
Comment on attachment 73970 [details] Updated patch using GtkVersioning Great.
(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. :)
Comment on attachment 73970 [details] Updated patch using GtkVersioning Clearing flags on attachment: 73970 Committed r72106: <http://trac.webkit.org/changeset/72106>
All reviewed patches have been landed. Closing bug.
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