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

Issue 166583002: Factory methods for heap-allocated SkPathEffect and SkXfermode objects. (Closed)

Created:
6 years, 10 months ago by Dominik Grewe
Modified:
6 years, 10 months ago
CC:
skia-review_googlegroups.com, djsollen
Base URL:
https://skia.googlesource.com/skia.git@master
Visibility:
Public.

Description

Factory methods for heap-allocated SkPathEffect and SkXfermode objects. This is part of an effort to ensure that all SkPaint effects can only be allocated on the heap. This patch makes the constructors of SkPathEffect, SkXfermode and their subclasses non-public and instead provides factory methods for creating these objects on the heap. We temporarily keep the constructors of the following classes public to not break Chrome/Blink: SkXfermode SkCornerPathEffect SkDashPathEffect BUG=skia:2187 Committed: http://code.google.com/p/skia/source/detail?r=13519

Patch Set 1 : #

Patch Set 2 : Rebase #

Patch Set 3 : Update sampleapp & animator #

Total comments: 3

Patch Set 4 : Add TODOs to make remaining public constructors protected. #

Patch Set 5 : guard constructors by SK_SUPPORT_LEGACY_PUBLICEFFECTCONSTRUCTORS if used by Chrome. #

Total comments: 6

Patch Set 6 : Move comments from constructors to factory methods. #

Total comments: 2

Patch Set 7 : Guard all publicly visible constructors. #

Patch Set 8 : Update experimental/PdfViewer #

Unified diffs Side-by-side diffs Delta from patch set Stats (+221 lines, -113 lines) Patch
M bench/DashBench.cpp View 1 2 3 4 5 chunks +7 lines, -7 lines 0 comments Download
M experimental/PdfViewer/SkPdfGraphicsState.cpp View 1 2 3 4 5 6 7 1 chunk +3 lines, -3 lines 0 comments Download
M gm/dashcubics.cpp View 1 chunk +1 line, -1 line 0 comments Download
M gm/dashing.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M gm/patheffects.cpp View 5 chunks +7 lines, -7 lines 0 comments Download
M gm/texteffects.cpp View 3 chunks +3 lines, -3 lines 0 comments Download
M include/core/SkPathEffect.h View 1 2 3 4 5 6 7 chunks +20 lines, -7 lines 0 comments Download
M include/core/SkXfermode.h View 1 2 3 4 5 6 4 chunks +13 lines, -3 lines 0 comments Download
M include/effects/Sk1DPathEffect.h View 1 2 3 4 5 6 2 chunks +9 lines, -1 line 0 comments Download
M include/effects/Sk2DPathEffect.h View 1 2 3 4 5 6 6 chunks +25 lines, -4 lines 0 comments Download
M include/effects/SkAvoidXfermode.h View 1 2 3 4 5 6 2 chunks +8 lines, -1 line 0 comments Download
M include/effects/SkCornerPathEffect.h View 1 2 3 4 5 2 chunks +8 lines, -1 line 0 comments Download
M include/effects/SkDashPathEffect.h View 1 2 3 4 5 2 chunks +10 lines, -2 lines 0 comments Download
M include/effects/SkDiscretePathEffect.h View 1 2 3 4 5 6 2 chunks +8 lines, -1 line 0 comments Download
M include/effects/SkPixelXorXfermode.h View 1 2 3 4 5 6 2 chunks +8 lines, -1 line 0 comments Download
M samplecode/SampleAll.cpp View 1 2 4 chunks +8 lines, -8 lines 0 comments Download
M samplecode/SampleAvoid.cpp View 1 2 1 chunk +3 lines, -3 lines 0 comments Download
M samplecode/SamplePathEffects.cpp View 1 2 3 4 3 chunks +8 lines, -7 lines 0 comments Download
M samplecode/SamplePathUtils.cpp View 1 2 3 4 1 chunk +4 lines, -4 lines 0 comments Download
M samplecode/SampleSlides.cpp View 1 2 3 4 8 chunks +11 lines, -11 lines 0 comments Download
M src/animator/SkDrawDash.cpp View 1 2 3 4 1 chunk +1 line, -1 line 0 comments Download
M src/animator/SkDrawDiscrete.cpp View 1 2 1 chunk +1 line, -1 line 0 comments Download
M src/animator/SkDrawExtraPathEffect.cpp View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M src/core/SkXfermode.cpp View 9 chunks +21 lines, -9 lines 0 comments Download
M src/core/SkXfermode_proccoeff.h View 2 chunks +10 lines, -6 lines 0 comments Download
M src/effects/SkArithmeticMode.cpp View 3 chunks +10 lines, -6 lines 0 comments Download
M src/utils/debugger/SkDebugCanvas.cpp View 1 chunk +1 line, -1 line 0 comments Download
M tests/DrawPathTest.cpp View 1 4 chunks +7 lines, -8 lines 0 comments Download
M tests/XfermodeTest.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 27 (0 generated)
Dominik Grewe
Following discussion on skia:1770 I've started to introduce factory methods for SkPaint effects to make ...
6 years, 10 months ago (2014-02-14 11:05:40 UTC) #1
reed1
6 years, 10 months ago (2014-02-14 21:38:33 UTC) #2
mtklein
lgtm A thought for the weekend / next CL: There's nothing preventing a subclass right ...
6 years, 10 months ago (2014-02-14 22:42:55 UTC) #3
Dominik Grewe
Yeah, if we could enforce that, it would be even better. We'd have to wait ...
6 years, 10 months ago (2014-02-14 22:54:52 UTC) #4
mtklein
On 2014/02/14 22:54:52, Dominik Grewe wrote: > @reed: Did you mean to leave a comment? ...
6 years, 10 months ago (2014-02-14 23:13:08 UTC) #5
Dominik Grewe
Had to update some uses in sampleapp and animator. PTAL.
6 years, 10 months ago (2014-02-18 11:11:26 UTC) #6
mtklein
On 2014/02/18 11:11:26, Dominik Grewe wrote: > Had to update some uses in sampleapp and ...
6 years, 10 months ago (2014-02-18 13:25:40 UTC) #7
reed1
Do we have any idea what the impact on Chrome will be when we try ...
6 years, 10 months ago (2014-02-18 14:06:22 UTC) #8
Dominik Grewe
On 2014/02/18 14:06:22, reed1 wrote: > Do we have any idea what the impact on ...
6 years, 10 months ago (2014-02-18 14:13:10 UTC) #9
reed1
On 2014/02/18 14:13:10, Dominik Grewe wrote: > On 2014/02/18 14:06:22, reed1 wrote: > > Do ...
6 years, 10 months ago (2014-02-18 14:18:38 UTC) #10
Dominik Grewe
Added TODOs to annotate public constructors that will be made protected.
6 years, 10 months ago (2014-02-18 14:18:45 UTC) #11
Dominik Grewe
On 2014/02/18 14:18:38, reed1 wrote: > On 2014/02/18 14:13:10, Dominik Grewe wrote: > > On ...
6 years, 10 months ago (2014-02-18 14:29:44 UTC) #12
reed1
On 2014/02/18 14:29:44, Dominik Grewe wrote: > On 2014/02/18 14:18:38, reed1 wrote: > > On ...
6 years, 10 months ago (2014-02-18 14:37:10 UTC) #13
Dominik Grewe
On 2014/02/18 14:37:10, reed1 wrote: > On 2014/02/18 14:29:44, Dominik Grewe wrote: > > On ...
6 years, 10 months ago (2014-02-18 14:41:54 UTC) #14
reed1
On 2014/02/18 14:41:54, Dominik Grewe wrote: > On 2014/02/18 14:37:10, reed1 wrote: > > On ...
6 years, 10 months ago (2014-02-18 15:20:07 UTC) #15
Dominik Grewe
I've added the guards for the constructors. It uncovered a few more places within Skia ...
6 years, 10 months ago (2014-02-18 16:46:21 UTC) #16
scroggo
https://codereview.chromium.org/166583002/diff/490001/include/core/SkPathEffect.h File include/core/SkPathEffect.h (right): https://codereview.chromium.org/166583002/diff/490001/include/core/SkPathEffect.h#newcode110 include/core/SkPathEffect.h:110: SkPathEffect() {} I guess the constructors that aren't public ...
6 years, 10 months ago (2014-02-18 16:53:11 UTC) #17
Dominik Grewe
https://codereview.chromium.org/166583002/diff/490001/include/core/SkPathEffect.h File include/core/SkPathEffect.h (right): https://codereview.chromium.org/166583002/diff/490001/include/core/SkPathEffect.h#newcode110 include/core/SkPathEffect.h:110: SkPathEffect() {} On 2014/02/18 16:53:11, scroggo wrote: > I ...
6 years, 10 months ago (2014-02-18 17:05:29 UTC) #18
scroggo
As I commented in line, some of the formerly public constructors are still used by ...
6 years, 10 months ago (2014-02-19 00:37:12 UTC) #19
scroggo
On 2014/02/19 00:37:12, scroggo wrote: > As I commented in line, some of the formerly ...
6 years, 10 months ago (2014-02-19 00:37:26 UTC) #20
Dominik Grewe
Just to avoid any surprises I've guarded all constructors in publicly visible classes.
6 years, 10 months ago (2014-02-19 11:31:24 UTC) #21
reed1
lgtm
6 years, 10 months ago (2014-02-19 13:15:08 UTC) #22
Dominik Grewe
The CQ bit was checked by dominikg@chromium.org
6 years, 10 months ago (2014-02-19 16:20:53 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/dominikg@chromium.org/166583002/750001
6 years, 10 months ago (2014-02-19 16:20:59 UTC) #24
Dominik Grewe
The CQ bit was checked by dominikg@chromium.org
6 years, 10 months ago (2014-02-20 10:49:22 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://skia-tree-status.appspot.com/cq/dominikg@chromium.org/166583002/860001
6 years, 10 months ago (2014-02-20 10:49:30 UTC) #26
commit-bot: I haz the power
6 years, 10 months ago (2014-02-20 20:40:31 UTC) #27
Message was sent while issue was closed.
Change committed as 13519

Powered by Google App Engine
This is Rietveld 408576698