Bug 55878

Summary: [Gtk] toDataURL uses incorrect quality value when saving GdkPixbuf to buffer
Product: WebKit Reporter: Zan Dobersek <zan>
Component: CanvasAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, mdelaney7
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Linux   
Bug Depends on:    
Bug Blocks: 54458    
Attachments:
Description Flags
Put quality into an appropriate range. none

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.