Bug 49532 - [GTK] Use gdk_pixbuf_get_from_surface() when available
Summary: [GTK] Use gdk_pixbuf_get_from_surface() when available
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKitGTK (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on: 49549
Blocks:
  Show dependency treegraph
 
Reported: 2010-11-15 04:19 PST by Carlos Garcia Campos
Modified: 2010-11-16 10:08 PST (History)
5 users (show)

See Also:


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-
Details | Formatted Diff | Diff
Updated patch using GtkVersioning (3.84 KB, patch)
2010-11-16 00:13 PST, Carlos Garcia Campos
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos Garcia Campos 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.
Comment 1 Carlos Garcia Campos 2010-11-15 04:23:31 PST
Created attachment 73885 [details]
Patch to use gdk_pixbuf_get_from_surface()
Comment 2 Martin Robinson 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.
Comment 3 Carlos Garcia Campos 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.
Comment 4 Carlos Garcia Campos 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.
Comment 5 Martin Robinson 2010-11-16 08:25:04 PST
Comment on attachment 73970 [details]
Updated patch using GtkVersioning

Great.
Comment 6 Martin Robinson 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. :)
Comment 7 WebKit Commit Bot 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>
Comment 8 WebKit Commit Bot 2010-11-16 09:15:07 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 WebKit Review Bot 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