b=324698, disable bilinear filtering for upscaled images (upscaling causes misrendering), r=roc

This commit is contained in:
vladimir@pobox.com 2007-05-22 20:54:38 -07:00
parent 994839ba71
commit 351cd4311b

View File

@ -397,6 +397,21 @@ nsThebesImage::Draw(nsIRenderingContext &aContext,
nsRefPtr<gfxPattern> pat = new gfxPattern(ThebesSurface());
pat->SetMatrix(mat);
// XXX bug 324698
#ifndef XP_MACOSX
if (xscale > 1.0 || yscale > 1.0) {
// See bug 324698. This is a workaround.
//
// Set the filter to CAIRO_FILTER_FAST if we're scaling up -- otherwise,
// pixman's sampling will sample transparency for the outside edges and we'll
// get blurry edges. CAIRO_EXTEND_PAD would also work here, but it's not
// implemented for image sources.
//
// This effectively disables smooth upscaling for images.
pat->SetFilter(0);
}
#endif
ctx->NewPath();
ctx->SetPattern(pat);
ctx->Rectangle(destRect);
@ -504,6 +519,14 @@ nsThebesImage::ThebesDrawTile(gfxContext *thebesContext,
pat->SetExtend(gfxPattern::EXTEND_REPEAT);
pat->SetMatrix(patMat);
#ifndef XP_MACOSX
if (scale > 1.0) {
// See bug 324698. This is a workaround. See comments
// by the earlier SetFilter call.
pat->SetFilter(0);
}
#endif
thebesContext->SetPattern(pat);
}