When zooming (via css or using the zoom patch in bug #18281) scaled images look ugly.
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.
Created attachment 21362 [details] Use Good filtering Oups, forgot Copyrights
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.
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.
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).
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.
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());
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 =).
*** Bug 31026 has been marked as a duplicate of this bug. ***
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.
Comment on attachment 42509 [details] updated patch Ah, progress!
Comment on attachment 42509 [details] updated patch Clearing flags on attachment: 42509 Committed r50527: <http://trac.webkit.org/changeset/50527>
All reviewed patches have been landed. Closing bug.