RESOLVED DUPLICATE of bug 73059 72965
[chromium] Use blending on opaque non-axis-aligned layers.
https://bugs.webkit.org/show_bug.cgi?id=72965
Summary [chromium] Use blending on opaque non-axis-aligned layers.
Dana Jansens
Reported 2011-11-22 09:53:41 PST
These layers will have non-orthogonal edges. If marked opaque, and not blended, they will have strongly aliased edges.
Attachments
Patch (3.97 KB, patch)
2011-11-22 10:12 PST, Dana Jansens
no flags
use transformed quad to determine axis-aligned (1.72 KB, patch)
2011-11-23 14:02 PST, Dana Jansens
no flags
use transformed quad to determine axis-aligned v2 (1.72 KB, patch)
2011-11-23 14:06 PST, Dana Jansens
no flags
Patch (3.76 KB, patch)
2011-11-23 16:41 PST, Dana Jansens
no flags
Patch (3.97 KB, patch)
2011-12-09 15:06 PST, Dana Jansens
no flags
Dana Jansens
Comment 1 2011-11-22 10:12:44 PST
W. James MacLean
Comment 2 2011-11-23 06:43:33 PST
(In reply to comment #1) > Created an attachment (id=116239) [details] > Patch You might want to take a look at Dave Reveman's comment on https://bugs.webkit.org/show_bug.cgi?id=70533 about making the axis-align (and pixel-aligned) test more consistent with what is used elsewhere in the compositor. He recommends: > This also needs to snap to the pixel grid to be correct. Instead of analyzing the transform, I think we should use the same logic as the anti-aliasing code, which is: > transformedQuad.isRectilinear() && transformedQuad.boundingBox().isExpressibleAsIntRect()
Dana Jansens
Comment 3 2011-11-23 07:10:56 PST
(In reply to comment #2) > (In reply to comment #1) > > Created an attachment (id=116239) [details] [details] > > Patch > > You might want to take a look at Dave Reveman's comment on https://bugs.webkit.org/show_bug.cgi?id=70533 about making the axis-align (and pixel-aligned) test more consistent with what is used elsewhere in the compositor. > > He recommends: > > > This also needs to snap to the pixel grid to be correct. Instead of analyzing the transform, I think we should use the same logic as the anti-aliasing code, which is: > > transformedQuad.isRectilinear() && transformedQuad.boundingBox().isExpressibleAsIntRect() If an opaque rect is half inside a pixel, but axis aligned, would it want blending? It would be possible to apply the layer's drawTransform() to its visibleLayerRect() and see if the resulting quad passes the above test. @reveman would this be preferable?
David Reveman
Comment 4 2011-11-23 11:05:36 PST
(In reply to comment #3) > (In reply to comment #2) > > (In reply to comment #1) > > > Created an attachment (id=116239) [details] [details] [details] > > > Patch > > > > You might want to take a look at Dave Reveman's comment on https://bugs.webkit.org/show_bug.cgi?id=70533 about making the axis-align (and pixel-aligned) test more consistent with what is used elsewhere in the compositor. > > > > He recommends: > > > > > This also needs to snap to the pixel grid to be correct. Instead of analyzing the transform, I think we should use the same logic as the anti-aliasing code, which is: > > > transformedQuad.isRectilinear() && transformedQuad.boundingBox().isExpressibleAsIntRect() > > If an opaque rect is half inside a pixel, but axis aligned, would it want blending? Yes, we need blending enabled whenever an anti-aliasing shader is used. > > It would be possible to apply the layer's drawTransform() to its visibleLayerRect() and see if the resulting quad passes the above test. > > @reveman would this be preferable? Yes, have a look at: http://trac.webkit.org/browser/trunk/Source/WebCore/platform/graphics/chromium/cc/CCTiledLayerImpl.cpp#L115 this is exactly what we're doing there.
Dana Jansens
Comment 5 2011-11-23 14:02:14 PST
Created attachment 116421 [details] use transformed quad to determine axis-aligned
Dana Jansens
Comment 6 2011-11-23 14:06:53 PST
Created attachment 116424 [details] use transformed quad to determine axis-aligned v2
David Reveman
Comment 7 2011-11-23 14:48:48 PST
Comment on attachment 116424 [details] use transformed quad to determine axis-aligned v2 This will fix the problem but we could do better for tiled layers. Only the tiles that have edges at the borders of the layer will need blending. The inner tiles don't. Maybe we should move the disable blend code into CCLayerImpl::Draw?
W. James MacLean
Comment 8 2011-11-23 15:46:15 PST
(In reply to comment #7) > (From update of attachment 116424 [details]) > This will fix the problem but we could do better for tiled layers. Only the tiles that have edges at the borders of the layer will need blending. The inner tiles don't. > > Maybe we should move the disable blend code into CCLayerImpl::Draw? Given that CCTileLayerImpl is about to be heavily refactored, I think we should defer blending just the edge-tiles until after that time. It can be marked as a FIXME in this patch.
David Reveman
Comment 9 2011-11-23 15:57:03 PST
(In reply to comment #8) > (In reply to comment #7) > > (From update of attachment 116424 [details] [details]) > > This will fix the problem but we could do better for tiled layers. Only the tiles that have edges at the borders of the layer will need blending. The inner tiles don't. > > > > Maybe we should move the disable blend code into CCLayerImpl::Draw? > > Given that CCTileLayerImpl is about to be heavily refactored, I think we should defer blending just the edge-tiles until after that time. It can be marked as a FIXME in this patch. That's fine with me. Please create another bugzilla entry for this and have it depend on the CCTileLayerImpl refactoring changes.
Dana Jansens
Comment 10 2011-11-23 16:41:35 PST
Dana Jansens
Comment 11 2011-11-23 16:43:49 PST
Pushed the decision to blend off to CCLayerImpl. This way CCTiledLayerImpl can override the behavior, but have access to the CCLayerImpl versions of the functions to help make consistent decisions on a per-tile basis.
Dana Jansens
Comment 12 2011-12-09 15:06:29 PST
Created attachment 118650 [details] Patch Put the blending decision behind a single public function: bool drawWithBlending(). Made protected methods to decide blending based on the contents of the layer (i.e. are all pixels opaque), and the edges of the layer (i.e. is it rectilinear or does it require anti-aliasing for the edges).
Adrienne Walker
Comment 13 2011-12-09 15:38:39 PST
(In reply to comment #12) > Created an attachment (id=118650) [details] > Patch > > Put the blending decision behind a single public function: bool drawWithBlending(). > > Made protected methods to decide blending based on the contents of the layer (i.e. are all pixels opaque), and the edges of the layer (i.e. is it rectilinear or does it require anti-aliasing for the edges). Not all layer types have antialiased edges. Don't we want to draw any opaque layer without antialiased edges with blending off, regardless of whether it lines up on integer coordinates? (I think https://bugs.webkit.org/show_bug.cgi?id=73059 might do some of this?)
Dana Jansens
Comment 14 2011-12-09 16:09:14 PST
Yes, 73059 is going to do exactly the right thing I think :) Hooray. *** This bug has been marked as a duplicate of bug 73059 ***
Eric Seidel (no email)
Comment 15 2011-12-19 11:10:33 PST
Comment on attachment 118650 [details] Patch How can we test this?
Eric Seidel (no email)
Comment 16 2011-12-19 11:24:09 PST
Comment on attachment 118650 [details] Patch Cleared review? from attachment 118650 [details] so that this bug does not appear in http://webkit.org/pending-review. If you would like this patch reviewed, please attach it to a new bug (or re-open this bug before marking it for review again).
Note You need to log in before you can comment on or make changes to this bug.