Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Issue 651243002: Clarify GraphicsContext::beginLayer()/endLayer() have unexpected behaviors. (Closed)

Created:
6 years, 2 months ago by dshwang
Modified:
6 years, 2 months ago
CC:
blink-reviews, eae+blinkwatch, fs, kouhei+svg_chromium.org, rwlbuis, krit, blink-reviews-html_chromium.org, rune+blink, danakj, dglazkov+blink, Rik, jchaffraix+rendering, aandrey+blink_chromium.org, pdr+svgwatchlist_chromium.org, zoltan1, jbroman, pdr+graphicswatchlist_chromium.org, gyuyoung.kim_webkit.org, blink-reviews-rendering, pdr+renderingwatchlist_chromium.org, leviw+renderwatch, mkwst+moarreviews_chromium.org, ed+blinkwatch_opera.com, Stephen Chennney
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Project:
blink
Visibility:
Public.

Description

Clarify GraphicsContext::beginLayer()/endLayer() have unexpected behaviors. beginLayer()/endLayer() behaves like save()/restore() for only CTM and clip states. SkCanvas::saveLayer() behaves the same as save(), but in addition it allocates an offscreen buffer. It causes the inconsistency for restoring states managed by between SkCanvas and SkPaint. For example, context.translate(1, 0); context.setCompositeOperation(CompositeDestinationIn); context.beginLayer(1, CompositeSourceIn); context.translate(-1, 0); context.setCompositeOperation(CompositeSourceOver); context.endLayer(); // At this moment, CTM is translate(1, 0) while current composite operator is CompositeSourceOver. It's because CTM is managed by SkCanvas, while current composite operator is managed by GraphicsContext. BUG=423414 Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=183902

Patch Set 1 #

Total comments: 3

Patch Set 2 : beginLayer()/endLayer() don't behave like save()/restore() #

Total comments: 5

Patch Set 3 : Copy part of clip stack, not whole #

Patch Set 4 : Just comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+7 lines, -4 lines) Patch
M Source/core/rendering/svg/RenderSVGResourceClipper.cpp View 1 chunk +1 line, -1 line 0 comments Download
M Source/platform/graphics/GraphicsContext.h View 1 2 3 3 chunks +6 lines, -3 lines 0 comments Download

Messages

Total messages: 31 (8 generated)
dshwang
junov@, could you review? The changes in CanvasRenderingContext2D.cpp are covered by existing canvas layout tests; ...
6 years, 2 months ago (2014-10-14 17:25:07 UTC) #2
Justin Novosad
On 2014/10/14 17:25:07, dshwang wrote: From an API ease of use standpoint, this change makes ...
6 years, 2 months ago (2014-10-14 17:50:15 UTC) #3
Justin Novosad
https://codereview.chromium.org/651243002/diff/1/Source/core/html/canvas/CanvasRenderingContext2D.cpp File Source/core/html/canvas/CanvasRenderingContext2D.cpp (left): https://codereview.chromium.org/651243002/diff/1/Source/core/html/canvas/CanvasRenderingContext2D.cpp#oldcode1585 Source/core/html/canvas/CanvasRenderingContext2D.cpp:1585: validateStateStack(); why are you removing this?
6 years, 2 months ago (2014-10-14 17:50:26 UTC) #4
f(malita)
I also think this should be a client fix: if state needs to be preserved, ...
6 years, 2 months ago (2014-10-14 18:28:20 UTC) #8
dshwang
Thank you for review. Here's my questions. On 2014/10/14 18:28:20, Florin Malita wrote: > I ...
6 years, 2 months ago (2014-10-14 19:00:29 UTC) #9
Justin Novosad
On 2014/10/14 19:00:29, dshwang wrote: > Thank you for review. Here's my questions. > > ...
6 years, 2 months ago (2014-10-14 19:21:44 UTC) #10
f(malita)
On 2014/10/14 19:00:29, dshwang wrote: > Thank you for review. Here's my questions. > > ...
6 years, 2 months ago (2014-10-14 19:35:43 UTC) #11
f(malita)
On 2014/10/14 19:21:44, junov wrote: > I am suggesting having a bit mask (like in ...
6 years, 2 months ago (2014-10-14 19:48:58 UTC) #12
dshwang
Thank you for fast response! On 2014/10/14 19:21:44, junov wrote: > To be more accurate, ...
6 years, 2 months ago (2014-10-14 20:47:23 UTC) #13
f(malita)
On 2014/10/14 20:47:23, dshwang wrote: > > I agree. Moreover, I don't understand why we ...
6 years, 2 months ago (2014-10-14 21:34:24 UTC) #14
dshwang
Hi Florin and Justin, could you review again? Now beginLayer()/endLayer() don't behave like save()/restore() as ...
6 years, 2 months ago (2014-10-16 15:53:51 UTC) #15
dshwang
https://codereview.chromium.org/651243002/diff/20001/Source/platform/graphics/GraphicsContext.cpp File Source/platform/graphics/GraphicsContext.cpp (right): https://codereview.chromium.org/651243002/diff/20001/Source/platform/graphics/GraphicsContext.cpp#newcode257 Source/platform/graphics/GraphicsContext.cpp:257: } Feel like using implementation detail of skia, but ...
6 years, 2 months ago (2014-10-16 15:58:20 UTC) #16
Justin Novosad
https://codereview.chromium.org/651243002/diff/20001/Source/platform/graphics/GraphicsContext.cpp File Source/platform/graphics/GraphicsContext.cpp (right): https://codereview.chromium.org/651243002/diff/20001/Source/platform/graphics/GraphicsContext.cpp#newcode220 Source/platform/graphics/GraphicsContext.cpp:220: SkClipStack currentSkClipStack(*m_canvas->getClipStack()); Seems unfortunate to duplicate the entire clip ...
6 years, 2 months ago (2014-10-16 17:51:58 UTC) #17
dshwang
On 2014/10/16 17:51:58, junov wrote: > https://codereview.chromium.org/651243002/diff/20001/Source/platform/graphics/GraphicsContext.cpp > File Source/platform/graphics/GraphicsContext.cpp (right): > > https://codereview.chromium.org/651243002/diff/20001/Source/platform/graphics/GraphicsContext.cpp#newcode220 > ...
6 years, 2 months ago (2014-10-16 18:44:59 UTC) #21
Stephen White
I'm not fond of the current patch, and I agree with Florin that this should ...
6 years, 2 months ago (2014-10-16 18:55:27 UTC) #22
Justin Novosad
And if you do want to inspect the content of a clip stack, you should ...
6 years, 2 months ago (2014-10-16 19:16:05 UTC) #23
dshwang
On 2014/10/16 18:55:27, Stephen White wrote: > I'm not fond of the current patch, and ...
6 years, 2 months ago (2014-10-16 19:31:10 UTC) #24
dshwang
Now this CL just adds comments explaining CTM and clip. Could you review again?
6 years, 2 months ago (2014-10-16 19:40:36 UTC) #25
Justin Novosad
On 2014/10/16 19:40:36, dshwang wrote: > Now this CL just adds comments explaining CTM and ...
6 years, 2 months ago (2014-10-17 16:10:49 UTC) #26
f(malita)
lgtm++
6 years, 2 months ago (2014-10-17 16:55:34 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/651243002/60001
6 years, 2 months ago (2014-10-17 16:56:34 UTC) #29
commit-bot: I haz the power
Committed patchset #4 (id:60001) as 183902
6 years, 2 months ago (2014-10-17 17:00:50 UTC) #30
dshwang
6 years, 2 months ago (2014-10-17 20:31:12 UTC) #31
Message was sent while issue was closed.
On 2014/10/17 16:10:49, junov wrote:
> On 2014/10/16 19:40:36, dshwang wrote:
> > Now this CL just adds comments explaining CTM and clip.
> > Could you review again?
> 
> lgtm
> 
> Sorry about all the back and forth we did in this code review.

On 2014/10/17 16:55:34, Florin Malita wrote:
> lgtm++

Thank you for lgtm! Justin, no problem. Now I know how to manipulate clip stack
:)

Powered by Google App Engine
This is Rietveld 408576698