Bug 463938: Fix smooth downscaling for images on Linux. r=vlad a=beltzner
☠☠ backed out by d0c342436fa8 ☠ ☠
authorMichael Ventnor <ventnor.bugzilla@gmail.com>
Fri, 14 Nov 2008 10:42:31 -0800
changeset 21696 e4690fcf6f7c741c62bb7793bc36afd0b81b1c9e
parent 21695 b7a7180130d53429b82ee2ed09c149e8a65403a4
child 21697 26eff4ebdfbff822b2ef96a565bdc52ffab92775
child 21698 d0c342436fa89f4d72c4ff14e98115a640f52b4e
push id3642
push userdholbert@mozilla.com
push dateFri, 14 Nov 2008 19:53:23 +0000
treeherdermozilla-central@26eff4ebdfbf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersvlad, beltzner
bugs463938
milestone1.9.1b2pre
Bug 463938: Fix smooth downscaling for images on Linux. r=vlad a=beltzner
gfx/src/thebes/nsThebesImage.cpp
--- a/gfx/src/thebes/nsThebesImage.cpp
+++ b/gfx/src/thebes/nsThebesImage.cpp
@@ -630,18 +630,22 @@ nsThebesImage::Draw(gfxContext*        a
             // See bug 324698.  This is a workaround for EXTEND_PAD not being
             // implemented correctly on linux in the X server.
             //
             // Set the filter to CAIRO_FILTER_FAST --- otherwise,
             // pixman's sampling will sample transparency for the outside edges and we'll
             // get blurry edges.  CAIRO_EXTEND_PAD would also work here, if
             // available
             //
-            // This effectively disables smooth upscaling for images.
-            pattern->SetFilter(0);
+            // This effectively disables smooth upscaling for images. So only set the
+            // FAST filter on upscaling. We must NEVER use FAST on downscaling otherwise
+            // very ugly images will result all over chrome and the web.
+            // xx is x scaling, yy is y scaling. Lower number is higher scale.
+            if (userSpaceToImageSpace.xx < 1.0 || userSpaceToImageSpace.yy < 1.0)
+              pattern->SetFilter(0);
             break;
   
         case gfxASurface::SurfaceTypeQuartz:
         case gfxASurface::SurfaceTypeQuartzImage:
             // Do nothing, Mac seems to be OK. Really?
             break;
 
         default: