[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
Mon Nov 14 12:47:36 PST 2011


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





--- Comment #7 from Stephen White <senorblanco at chromium.org>  2011-11-14 12:47:36 PST ---
(In reply to comment #5)
> (In reply to comment #4)
> > (From update of attachment 114597 [details] [details])
> > I'm not sure about this change.  Checking the affine mask means the mapping won't be done when a bitmap is rotated.  Could this mean that an object would switch from high to low quality as it falls in and out of the zero rotation position?
> 
> 
> Yes, but that is already the case now whenever we hit the cached awesome sampling path. (Probably more likely from high to bilinear rather than low.)

Sorry, you're right; this not new to this patch.  (And it's probably not a big problem anyway, since we don't do Lanczos resampling while animating, only on first draw or after animation stops).  Ignore that.

> Are you suggesting we should allow awesome filtering with all rotations or multiples of 90 degrees only? It's probably a bit tricky and would require rewriting drawResampledBitmap() to handle this by transforming the dimensions only in this case etc.

No, I don't think we should do that.

> > Also, the check should probably be done in computeResamplingMode itself, and we just pass in the canvas matrix, so that it applies to patterns as well as images.  Also, there is already a check for the perspective flag in computeResamplingMode, so this change should probably be unified with that check somehow.  I must admit that this logic is already getting so complex that I'm loathe to add more complexity to it.
> 
> 
> 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.

> 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.

> 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.

-- 
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