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

Issue 23545017: Create a semi-stable API for capturing the state of an SkCanvas and reconstructing that state acros… (Closed)

Created:
7 years, 3 months ago by djsollen
Modified:
7 years, 3 months ago
Reviewers:
joth, mtklein, scroggo, reed1
CC:
skia-review_googlegroups.com
Visibility:
Public.

Description

Create a semi-stable API for capturing the state of an SkCanvas and reconstructing that state across different versions of Skia. R=joth@chromium.org, mtklein@google.com, reed@google.com, scroggo@google.com Committed: https://code.google.com/p/skia/source/detail?r=11010 Committed: https://code.google.com/p/skia/source/detail?r=11013

Patch Set 1 #

Total comments: 86

Patch Set 2 : addressing comments #

Total comments: 4

Patch Set 3 : fixing nits #

Total comments: 2

Patch Set 4 : rebase #

Total comments: 3
Unified diffs Side-by-side diffs Delta from patch set Stats (+563 lines, -4 lines) Patch
M gm/canvasstate.cpp View 1 2 chunks +0 lines, -4 lines 0 comments Download
M gyp/tests.gyp View 1 1 chunk +1 line, -0 lines 0 comments Download
M gyp/utils.gyp View 1 2 chunks +2 lines, -0 lines 0 comments Download
M include/core/SkWriter32.h View 1 chunk +4 lines, -0 lines 0 comments Download
A include/utils/SkCanvasStateUtils.h View 1 2 3 1 chunk +76 lines, -0 lines 0 comments Download
A src/utils/SkCanvasStateUtils.cpp View 1 2 3 1 chunk +340 lines, -0 lines 3 comments Download
A tests/CanvasStateTest.cpp View 1 2 3 1 chunk +140 lines, -0 lines 0 comments Download

Messages

Total messages: 17 (0 generated)
djsollen
7 years, 3 months ago (2013-08-28 15:44:10 UTC) #1
djsollen
https://codereview.chromium.org/23545017/diff/1/gm/canvasstate.cpp File gm/canvasstate.cpp (right): https://codereview.chromium.org/23545017/diff/1/gm/canvasstate.cpp#newcode14 gm/canvasstate.cpp:14: #include "SkCanvasUtils.h" need to move this inline with other ...
7 years, 3 months ago (2013-08-28 15:45:11 UTC) #2
reed1
lgtm, but please wait for others
7 years, 3 months ago (2013-08-28 15:56:25 UTC) #3
reed1
can we put the new header in src/utils for now, so it ain't exactly public? ...
7 years, 3 months ago (2013-08-28 15:57:07 UTC) #4
scroggo
https://codereview.chromium.org/23545017/diff/1/gm/canvasstate.cpp File gm/canvasstate.cpp (right): https://codereview.chromium.org/23545017/diff/1/gm/canvasstate.cpp#newcode168 gm/canvasstate.cpp:168: newCanvas->drawRect(fRect, fBluePaint); I know this is just a test, ...
7 years, 3 months ago (2013-08-28 17:22:01 UTC) #5
mtklein
Might have doubled up on some of scroggo's comments. They count double! https://codereview.chromium.org/23545017/diff/1/gm/canvasstate.cpp File gm/canvasstate.cpp ...
7 years, 3 months ago (2013-08-28 18:20:46 UTC) #6
scroggo
https://codereview.chromium.org/23545017/diff/1/src/utils/SkCanvasUtils.cpp File src/utils/SkCanvasUtils.cpp (right): https://codereview.chromium.org/23545017/diff/1/src/utils/SkCanvasUtils.cpp#newcode256 src/utils/SkCanvasUtils.cpp:256: SkAutoTUnref<SkCanvas> canvas(SkNEW_ARGS(SkCanvas, (device.get()))); On 2013/08/28 18:20:46, mtklein wrote: > ...
7 years, 3 months ago (2013-08-28 20:42:02 UTC) #7
joth
I just looked at the main API .h lgtm w.r.t. what I need. Thank you! ...
7 years, 3 months ago (2013-08-28 21:04:58 UTC) #8
djsollen
https://codereview.chromium.org/23545017/diff/1/gm/canvasstate.cpp File gm/canvasstate.cpp (right): https://codereview.chromium.org/23545017/diff/1/gm/canvasstate.cpp#newcode168 gm/canvasstate.cpp:168: newCanvas->drawRect(fRect, fBluePaint); On 2013/08/28 17:22:01, scroggo wrote: > I ...
7 years, 3 months ago (2013-08-29 15:09:19 UTC) #9
mtklein
lgtm just some nits i noticed reading through again. https://codereview.chromium.org/23545017/diff/15001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/23545017/diff/15001/src/utils/SkCanvasStateUtils.cpp#newcode136 src/utils/SkCanvasStateUtils.cpp:136: ...
7 years, 3 months ago (2013-08-29 16:27:54 UTC) #10
scroggo
Overall lgtm (I wish code review figured out you moved the new file and compared ...
7 years, 3 months ago (2013-08-29 17:24:06 UTC) #11
djsollen
Committed patchset #3 manually as r11010 (presubmit successful).
7 years, 3 months ago (2013-08-29 19:29:19 UTC) #12
djsollen
reverted prior to the rebase with https://skia.googlecode.com/svn/trunk@11011
7 years, 3 months ago (2013-08-29 20:10:48 UTC) #13
djsollen
Committed patchset #4 manually as r11013 (presubmit successful).
7 years, 3 months ago (2013-08-29 20:20:51 UTC) #14
joth
One late comment.... (from playing with the patch rather than from reading it) https://codereview.chromium.org/23545017/diff/12001/src/utils/SkCanvasStateUtils.cpp File ...
7 years, 3 months ago (2013-08-30 06:45:57 UTC) #15
joth
https://codereview.chromium.org/23545017/diff/12001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/23545017/diff/12001/src/utils/SkCanvasStateUtils.cpp#newcode330 src/utils/SkCanvasStateUtils.cpp:330: canvas->addCanvas(canvasLayer.get()); On 2013/08/30 06:45:57, joth wrote: > I think ...
7 years, 3 months ago (2013-08-30 07:05:03 UTC) #16
djsollen
7 years, 3 months ago (2013-08-30 11:51:19 UTC) #17
Message was sent while issue was closed.
https://codereview.chromium.org/23545017/diff/12001/src/utils/SkCanvasStateUt...
File src/utils/SkCanvasStateUtils.cpp (right):

https://codereview.chromium.org/23545017/diff/12001/src/utils/SkCanvasStateUt...
src/utils/SkCanvasStateUtils.cpp:330: canvas->addCanvas(canvasLayer.get());
On 2013/08/30 07:05:04, joth wrote:
> On 2013/08/30 06:45:57, joth wrote:
> > I think there's a bug here that you never look at the restored layer's x & y
> > values. I believe this is the reason for the symptoms I'm seeing over in
> > https://b/10152369#ISSUE_HistoryHeader64 although I can't exactly explain
the
> > link.
> > 
> > I tried translating canvasLayer by -x & -y prior to adding it, but that
seemed
> > to have no effect what-so-ever. So I'm not quite sure. (Aside: as you have a
> > clip and matrix exported per layer, maybe the x & y are redundant in the
> > flattened state. Just need to work out how to pre-apply them into the other
> > fields on the export side).
> 
> Hmm OK x & y maybe a red-herring.
> 
> I looked a bit more at how this is implemented using  SkNWayCanvas vs a stack
of
> devices (as I had in
>
https://codereview.chromium.org/22799011/diff/3001/android_webview/browser/in...)
> and I see SkNWayCanvas::setMatrix is just forwarded verbatim to each
underlying
> canvas -- there's not way for each layer canvas to retain it's own "device"
> layer translation indenpendent of how the user uses the public API translate /
> matrix.
>  
> the cc software_renderer makes pretty extensive use of setMatrix which as I
> understand it will blow away and translate  and result in each layer having
> exact same matrix. This is why I see the top of the logical page appear in all
> the layers - even the one that is positioned at the bottom of the page.
> 

Yes, the setMatrix will cause some havoc with this solution.  I'll work on
coding something up so that if someone overwrites the entire matrix like that we
preserve the original x,y position for every canvas that we insert into the
n-way canvas.

Powered by Google App Engine
This is Rietveld 408576698