Bug 89018 - [Chromium] webkitImageSmoothingEnabled canvas property does not work on redraw
Summary: [Chromium] webkitImageSmoothingEnabled canvas property does not work on redraw
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Unspecified
: P2 Normal
Assignee: Justin Novosad
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-13 10:30 PDT by Justin Novosad
Modified: 2012-06-21 11:36 PDT (History)
5 users (show)

See Also:


Attachments
test html file (1.71 KB, text/html)
2012-06-13 10:31 PDT, Justin Novosad
no flags Details
Patch (7.87 KB, patch)
2012-06-14 06:41 PDT, Justin Novosad
no flags Details | Formatted Diff | Diff
Patch (8.39 KB, patch)
2012-06-14 07:25 PDT, Justin Novosad
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Justin Novosad 2012-06-13 10:30:55 PDT
This is in reference to chromium bug: crbug.com/130925

Attached test page shows canvas to canvas copy that appears to be filtered despite having set the webkitImageSmoothingEnabled property set to false.
Eliminating the animation loop makes the problem go away.  The problem only manifests itself on redraw.

The source of the problem is that the accelerated compositor modifies the state of an openGL texture object (sets filtering to linear).  That object is shared with a skia rendering context and the compositor does not sending a state invalidation signal to skia. Therefore, the state cache maintained by skia is no longer in sync.  This explains why the problem only happens on redraw, i.e. the second draw happens after the compositor has drawn the source canvas to screen at least once.
Comment 1 Justin Novosad 2012-06-13 10:31:57 PDT
Created attachment 147358 [details]
test html file
Comment 2 Justin Novosad 2012-06-14 06:41:02 PDT
Created attachment 147573 [details]
Patch
Comment 3 Stephen White 2012-06-14 07:05:26 PDT
Comment on attachment 147573 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=147573&action=review

Clean up the ChangeLog a bit, and you're good to go.

> Source/WebCore/ChangeLog:10
> +        When an accelerated canvas layer prepares it texture for the

Nit:  it -> its

> Source/WebCore/ChangeLog:12
> +        proprties that are cached by skia, since the compositor may modify them.

Since the bug title above is not very precise, I'd further describe the problematic case here.  Something like "webkitImageSmoothingEnabled=false on a canvas used as a source for canvas-to-canvas draws does not work on compositor redraw, since the compositor sets the texture filtering mode back to linear at draw time.  Since texture attributes are associated with the texture object in GL, this leaves the value stored in the skia state cache out-of-date."

> LayoutTests/fast/canvas/script-tests/canvas-imageSmoothingEnabled-repaint.js:72
> +window.onload = onLoadHandler;

Thanks for taking the extra time to make a test for this tricky case!
Comment 4 Justin Novosad 2012-06-14 07:25:22 PDT
Created attachment 147579 [details]
Patch
Comment 5 Stephen White 2012-06-14 08:02:09 PDT
Comment on attachment 147579 [details]
Patch

Thanks.  r=me
Comment 6 WebKit Review Bot 2012-06-14 11:33:17 PDT
Comment on attachment 147579 [details]
Patch

Clearing flags on attachment: 147579

Committed r120344: <http://trac.webkit.org/changeset/120344>
Comment 7 WebKit Review Bot 2012-06-14 11:33:22 PDT
All reviewed patches have been landed.  Closing bug.
Comment 8 Beth Dakin 2012-06-21 11:26:40 PDT
This test fails on the Mac bots. I will skip it.
Comment 9 Beth Dakin 2012-06-21 11:36:10 PDT
(In reply to comment #8)
> This test fails on the Mac bots. I will skip it.

Skipped with r120952. Filed https://bugs.webkit.org/show_bug.cgi?id=89680