RESOLVED FIXED Bug 19266
[CAIRO] scaled images are ugly
https://bugs.webkit.org/show_bug.cgi?id=19266
Summary [CAIRO] scaled images are ugly
Marco Barisione
Reported 2008-05-27 05:45:44 PDT
When zooming (via css or using the zoom patch in bug #18281) scaled images look ugly.
Attachments
Use Good filtering (2.18 KB, patch)
2008-05-27 08:58 PDT, Pierre-Luc Beaudoin
no flags
Use Good filtering (2.50 KB, patch)
2008-05-27 09:01 PDT, Pierre-Luc Beaudoin
alp: review-
Address Alp and Dave's comments (2.32 KB, patch)
2008-05-29 12:55 PDT, Pierre-Luc Beaudoin
no flags
updated patch (7.86 KB, patch)
2009-11-04 12:22 PST, Benjamin Otte
no flags
Pierre-Luc Beaudoin
Comment 1 2008-05-27 08:58:59 PDT
Created attachment 21361 [details] Use Good filtering Now that CAIRO_EXTEND_PAD have been implemented, we can use a better filter for stretched images. I removed the references to bug #14017 since it doesn't apply anymore.
Pierre-Luc Beaudoin
Comment 2 2008-05-27 09:01:18 PDT
Created attachment 21362 [details] Use Good filtering Oups, forgot Copyrights
Alp Toker
Comment 3 2008-05-29 09:36:30 PDT
Comment on attachment 21362 [details] Use Good filtering CAIRO_EXTEND_PAD is defined but not supported for surface patterns in Cairo versions before 1.6, so this patch is a regression for users who don't yet have 1.6. You need to wrap the use of CAIRO_EXTEND_PAD with either a run-time or compile-time Cairo version check.
Dave Hyatt
Comment 4 2008-05-29 12:04:25 PDT
Note that the engine now has a cross-platform notion of using high quality vs. low quality scaling. If/when you add this to Cairo, you need to support the rendering of images using both scale modes. Look at the low quality interpolation bool on the GraphicsContext drawImage method to see what I mean.
Pierre-Luc Beaudoin
Comment 5 2008-05-29 12:55:40 PDT
Created attachment 21419 [details] Address Alp and Dave's comments Add checks for Cairo >= 1.6.0 and check if low quality interpolation should be used (even though the current code in GraphicContext would always say no for cairo).
Alp Toker
Comment 6 2008-05-29 18:56:11 PDT
Comment on attachment 21419 [details] Address Alp and Dave's comments CAIRO_EXTEND_PAD causes very bizarre effects during image load, so we need to adjust the rect based on the current available height as CG does. I have a WIP patch that does this (and also addresses the coding style change we discussed). We should probably land the two changes around the same time to avoid regressing trunk. Clearing flag until the fix is up.
Alp Toker
Comment 7 2008-06-01 09:27:54 PDT
This is part of the fix, just to give you an idea of what I mean (not able to attach it right now, sorry): + IntSize selfSize = size(); + FloatRect adjustedDestRect = dstRect; + // If the image is only partially loaded, then shrink the destination rect that we're drawing into accordingly. + float currHeight = cairo_image_surface_get_height(image); + if (currHeight < selfSize.height()) + adjustedDestRect.setHeight(adjustedDestRect.height() * currHeight / selfSize.height());
Gustavo Noronha (kov)
Comment 8 2009-03-05 18:26:36 PST
Ping on this? I volunteer to try to get the patch up-to-date and push its inclusion, but would be good to have your WIP, Alp =).
Benjamin Otte
Comment 9 2009-11-03 02:49:35 PST
*** Bug 31026 has been marked as a duplicate of this bug. ***
Benjamin Otte
Comment 10 2009-11-04 12:22:10 PST
Created attachment 42509 [details] updated patch Here's a patch against current master respecting the comments from bug 31026. It does not take care of imageInterpolationMode() as the previous patches to this bug, as I think this belongs in a separate patch. I'm not sure anyway if imageInterpolationMode() should apply to only images or also to video.
Gustavo Noronha (kov)
Comment 11 2009-11-04 12:48:37 PST
Comment on attachment 42509 [details] updated patch Ah, progress!
WebKit Commit Bot
Comment 12 2009-11-04 13:00:19 PST
Comment on attachment 42509 [details] updated patch Clearing flags on attachment: 42509 Committed r50527: <http://trac.webkit.org/changeset/50527>
WebKit Commit Bot
Comment 13 2009-11-04 13:00:25 PST
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.