Bug 55878 - [Gtk] toDataURL uses incorrect quality value when saving GdkPixbuf to buffer
Summary: [Gtk] toDataURL uses incorrect quality value when saving GdkPixbuf to buffer
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 54458
  Show dependency treegraph
 
Reported: 2011-03-07 07:35 PST by Zan Dobersek
Modified: 2011-03-08 00:10 PST (History)
2 users (show)

See Also:


Attachments
Put quality into an appropriate range. (2.81 KB, patch)
2011-03-07 07:44 PST, Zan Dobersek
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Zan Dobersek 2011-03-07 07:35:57 PST
Gtk uses ImageBuffer::toDataURL in ImageBufferGtk.cpp to get data URL for a buffer. If data URL should be of mimetype image/jpeg, current code uses quality parameter if passed and utilizes it when saving a GdkPixbuf (which we get from the cairo surface) to a buffer.

The problem is that quality passed to the gdk_pixbuf_save_to_buffer function should be in range of [0, 100] while we currently keep it in range [0.0, 1.0]. This results in canvas/philip/tests/toDataURL.jpeg.quality.basic.html failing.
Comment 1 Zan Dobersek 2011-03-07 07:44:12 PST
Created attachment 84944 [details]
Put quality into an appropriate range.

This patch multiplies quality variable, which is originally in range [0.0, 1.0] by 100.0 to ensure it is in the correct range of [0, 100], as seen in gdk_pixbuf_save function documentation[1].

[1] http://library.gnome.org/devel/gdk-pixbuf/2.22/gdk-pixbuf-file-saving.html#gdk-pixbuf-save
Comment 2 Martin Robinson 2011-03-07 13:08:10 PST
Comment on attachment 84944 [details]
Put quality into an appropriate range.

Nice catch.
Comment 3 WebKit Commit Bot 2011-03-08 00:10:25 PST
Comment on attachment 84944 [details]
Put quality into an appropriate range.

Clearing flags on attachment: 84944

Committed r80546: <http://trac.webkit.org/changeset/80546>
Comment 4 WebKit Commit Bot 2011-03-08 00:10:30 PST
All reviewed patches have been landed.  Closing bug.