[Webkit-unassigned] [Bug 72073] [Skia] Computing the resampling mode ignores scale applied to the canvas

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Wed Nov 16 17:42:18 PST 2011


https://bugs.webkit.org/show_bug.cgi?id=72073





--- Comment #8 from Daniel Sievers <sievers at chromium.org>  2011-11-16 17:42:18 PST ---
> > 
> > Hrm, this doesn't affect tiles/drawPattern, because the canvas scale is applied at the very end, right? I.e. we would only sample and cache one tile.
> 
> I was just thinking (perhaps naively) that if a pattern was drawn with full-page zoom applied, it should use the same heuristic as images.  For example, you could create an SVG pattern with a single image tile, drawn at 1:1 scale in SVG, then with a page zoom.  It seems strange that full-page zoom would affect the criteria for high-quality resize in one case but not the other.
>

Yes, it currently doesn't

> > I think the current bug/flaw is in the mismatch of how computeResamplingMode() is used in paintSkBitmap() (not incorporating canvas scale) vs. what drawResampledBitmap() does (incorporate canvas scale). It calculates the wrong mode for what it ends up scaling.
> 
> Fair enough.  Since this code has very little testing (and I only barely understand it myself), I'd like to see a test case that demonstrates the problem you're seeing, and its behaviour with and without this patch.
> 


Turns out the newly failing tests above show this. For example, fast/borders/border-image-scale-transform.html applies a '-webkit-transform scale(2)' which before my change was unnoticed when deciding on the filtering causing us to use simple filtering for the images, while with this change it uses awesome, so they need to be rebased. Similarly, in the other tests the svg 'viewBox' property in the other tests cause a scale on a canvas. Without this patch, we don't detect this scale, but only see scales on the content, e.g. from width/height in the img tag. 


> > Question about drawPattern(): Is patternTransform in that routine always going to be a pure scale/translate transform? I'm not sure I believe the way it undoes the scale in that routine (matrix.setScaleX(SkIntToScalar(1)) works if there is also a rotation or skew.
> 
> AFAICT, that code is only executed when computeResamplingMode() returns RESAMPLE_AWESOME, so we already know that there is no rotation or skew in that case.

It looks at the canvas matrix but not at patternTransform to detect if there is only scale+translate, so that might be a problem. It uses the function TransformDimensions() to figure out what scaling patternTransform does.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list