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

Issue 372003002: Change SkCanvasState to use inheritance. (Closed)

Created:
6 years, 5 months ago by scroggo
Modified:
6 years, 5 months ago
Reviewers:
mtklein, djsollen, reed1
CC:
reviews_skia.org
Base URL:
https://skia.googlesource.com/skia.git@master
Project:
skia
Visibility:
Public.

Description

Change SkCanvasState to use inheritance. The base class, SkCanvasState, now holds the version, width, and height. These fields will always be a necessary part of the class. (Also add in some padding.) The other fields, which may change, have been moved into the subclass, SkCanvasState_v1. If/when the version changes, it will correspond to a new subclass. In SkCanvasStateUtils::CreateFromCanvasState, check the version on the base class, then do a static_cast to the version corresponding to SkCanvasState::version. Remove CANVAS_STATE_VERSION, which is redundant with the version specified by the subclass. Use unambiguous type for rowBytes. Build Android with SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG. This allows us to run the full suite of CanvasState tests. It is also representative of what will be used on Android by WebView. Fix CanvasStateTest where it was broken inside ifdef'ed out code. Use SkCanvas::getBaseLayerSize() instead of the deprecated SkCanvas::getDeviceSize(). Update the comments in the header to be more clear. In particular, an SkCanvasState can only be used to pass an SkCanvas' state to a future version of Skia (or the same); not an older version. NOTREECHECKS=true BUG=b/15693384 Committed: https://skia.googlesource.com/skia/+/352c2181d15ed053c3b759f08ff1f51d50e2d3bb

Patch Set 1 #

Patch Set 2 : Add an assert that the version is correct. #

Total comments: 6

Patch Set 3 : Specify the version of the bad SkCanvasState. #

Total comments: 2

Patch Set 4 : Remove virtual destructor; upcast for delete. #

Patch Set 5 : Add a clarifying comment for the upcast. #

Patch Set 6 : Assume that version is 1. #

Total comments: 4

Patch Set 7 : Build Android with SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG. #

Patch Set 8 : Use unambiguous type for rowBytes. #

Patch Set 9 : Fix CanvasStateTest. #

Patch Set 10 : Remove CANVAS_STATE_VERSION. #

Patch Set 11 : Update header's comments for clarity. #

Patch Set 12 : Rebase . #

Patch Set 13 : Fix Windows failures. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+60 lines, -47 lines) Patch
M include/utils/SkCanvasStateUtils.h View 1 2 3 4 5 6 7 8 9 10 4 chunks +8 lines, -7 lines 0 comments Download
M src/utils/SkCanvasStateUtils.cpp View 1 2 3 4 5 6 7 8 9 10 11 12 10 chunks +52 lines, -40 lines 0 comments Download

Messages

Total messages: 25 (0 generated)
scroggo
6 years, 5 months ago (2014-07-07 19:54:34 UTC) #1
djsollen
lgtm
6 years, 5 months ago (2014-07-07 20:02:16 UTC) #2
mtklein
https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp#newcode82 src/utils/SkCanvasStateUtils.cpp:82: virtual ~SkCanvasState() {} Drop virtual? https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp#newcode346 src/utils/SkCanvasStateUtils.cpp:346: SkDebugf("CreateFromCanvasState version ...
6 years, 5 months ago (2014-07-07 20:02:28 UTC) #3
reed1
https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp#newcode82 src/utils/SkCanvasStateUtils.cpp:82: virtual ~SkCanvasState() {} On 2014/07/07 20:02:28, mtklein wrote: > ...
6 years, 5 months ago (2014-07-07 20:05:12 UTC) #4
mtklein
https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp#newcode82 src/utils/SkCanvasStateUtils.cpp:82: virtual ~SkCanvasState() {} On 2014/07/07 20:05:12, reed1 wrote: > ...
6 years, 5 months ago (2014-07-07 20:05:53 UTC) #5
scroggo
https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp#newcode82 src/utils/SkCanvasStateUtils.cpp:82: virtual ~SkCanvasState() {} On 2014/07/07 20:05:53, mtklein wrote: > ...
6 years, 5 months ago (2014-07-07 20:30:17 UTC) #6
mtklein
https://codereview.chromium.org/372003002/diff/40001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/372003002/diff/40001/src/utils/SkCanvasStateUtils.cpp#newcode354 src/utils/SkCanvasStateUtils.cpp:354: SkDELETE(state); Can't we do the same check-version-and-static-cast trick?
6 years, 5 months ago (2014-07-07 20:32:41 UTC) #7
reed1
On 2014/07/07 20:30:17, scroggo wrote: > https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp > File src/utils/SkCanvasStateUtils.cpp (right): > > https://codereview.chromium.org/372003002/diff/20001/src/utils/SkCanvasStateUtils.cpp#newcode82 > ...
6 years, 5 months ago (2014-07-07 20:35:13 UTC) #8
scroggo
https://codereview.chromium.org/372003002/diff/40001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/372003002/diff/40001/src/utils/SkCanvasStateUtils.cpp#newcode354 src/utils/SkCanvasStateUtils.cpp:354: SkDELETE(state); On 2014/07/07 20:32:40, mtklein wrote: > Can't we ...
6 years, 5 months ago (2014-07-07 21:44:02 UTC) #9
mtklein
Some suggestions, but LGTM as it is. https://codereview.chromium.org/372003002/diff/100001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/372003002/diff/100001/src/utils/SkCanvasStateUtils.cpp#newcode76 src/utils/SkCanvasStateUtils.cpp:76: version = ...
6 years, 5 months ago (2014-07-07 22:09:16 UTC) #10
mtklein
Some suggestions, but LGTM as it is.
6 years, 5 months ago (2014-07-07 22:09:16 UTC) #11
scroggo
I've made several changes since the last review. PTAL. https://codereview.chromium.org/372003002/diff/100001/src/utils/SkCanvasStateUtils.cpp File src/utils/SkCanvasStateUtils.cpp (right): https://codereview.chromium.org/372003002/diff/100001/src/utils/SkCanvasStateUtils.cpp#newcode76 src/utils/SkCanvasStateUtils.cpp:76: ...
6 years, 5 months ago (2014-07-08 18:45:13 UTC) #12
mtklein
On 2014/07/08 18:45:13, scroggo wrote: > I've made several changes since the last review. PTAL. ...
6 years, 5 months ago (2014-07-08 19:17:24 UTC) #13
scroggo
On 2014/07/08 19:17:24, mtklein wrote: > On 2014/07/08 18:45:13, scroggo wrote: > > I've made ...
6 years, 5 months ago (2014-07-08 19:25:53 UTC) #14
djsollen
we should be ok if we land simultaneously. It looks like their automerger is current ...
6 years, 5 months ago (2014-07-08 19:39:54 UTC) #15
scroggo
The CQ bit was checked by scroggo@google.com
6 years, 5 months ago (2014-07-15 17:57:57 UTC) #16
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/scroggo@google.com/372003002/220001
6 years, 5 months ago (2014-07-15 17:58:36 UTC) #17
commit-bot: I haz the power
The CQ bit was unchecked by commit-bot@chromium.org
6 years, 5 months ago (2014-07-15 17:58:38 UTC) #18
commit-bot: I haz the power
Presubmit check for 372003002-220001 failed and returned exit status 1. Running presubmit commit checks ...
6 years, 5 months ago (2014-07-15 17:58:39 UTC) #19
scroggo
On 2014/07/15 17:58:39, I haz the power (commit-bot) wrote: > Presubmit check for 372003002-220001 failed ...
6 years, 5 months ago (2014-07-15 17:59:55 UTC) #20
reed1
lgtm
6 years, 5 months ago (2014-07-15 19:01:22 UTC) #21
commit-bot: I haz the power
FYI, CQ is re-trying this CL (attempt #1). The failing builders are: Build-Win7-VS2010-x86-Debug-Trybot on tryserver.skia ...
6 years, 5 months ago (2014-07-15 19:16:36 UTC) #22
scroggo
The CQ bit was checked by scroggo@google.com
6 years, 5 months ago (2014-07-15 19:20:22 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/scroggo@google.com/372003002/240001
6 years, 5 months ago (2014-07-15 19:20:26 UTC) #24
commit-bot: I haz the power
6 years, 5 months ago (2014-07-15 19:34:36 UTC) #25
Message was sent while issue was closed.
Change committed as 352c2181d15ed053c3b759f08ff1f51d50e2d3bb

Powered by Google App Engine
This is Rietveld 408576698