diff options
author | Cary Clark <caryclark@skia.org> | 2018-04-26 08:32:37 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-04-26 17:11:53 +0000 |
commit | d98f78cd019d96f902197711c5e7e43afec3c3de (patch) | |
tree | 376d0bae10124bc51f150a8834c1e54d989d6a7e /include/core/SkRegion.h | |
parent | ba37e5b1c9bd24a86584a3e80347a82175a2403a (diff) |
alternative no anonymous enums
Anonymous enums play havoc with documentation;
there's no name to refer to. It may be that all
enums may either be named or replaced with constexpr
without breaking anything. Try replacing all
anonymous enums in include/core to see what happens.
This names SkCanvas::SaveLayerFlagsSet but leaves
SkCanvas::SaveLayerFlags as a uint32_t, to reduce
risk as compared to review.skia.org/123584.
There's also some chance that external linkage will
break if some client refers to anonymous enum in a way
that could require its address: see
https://stackoverflow.com/questions/22867654/enum-vs-constexpr-for-actual-static-constants-inside-classes
(This CL does not require definitions + declarations)
Brought bookmaker docs in line with this change.
This also tripped over missing code in bookmaker
handling constexpr so added that as well.
R=reed@google.com,bsalomon@google.com
Docs-Preview: https://skia.org/?cl=123920
Docs-Preview: https://skia.org/?cl=123584
Bug: skia:6898
Change-Id: I14a342edcfd59e139ef9e4501f562417c4c60391
Reviewed-on: https://skia-review.googlesource.com/123920
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Cary Clark <caryclark@skia.org>
Diffstat (limited to 'include/core/SkRegion.h')
-rw-r--r-- | include/core/SkRegion.h | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/include/core/SkRegion.h b/include/core/SkRegion.h index a3aaee1cbe..42651da43c 100644 --- a/include/core/SkRegion.h +++ b/include/core/SkRegion.h @@ -30,9 +30,7 @@ namespace android { class SK_API SkRegion { public: typedef int32_t RunType; - enum { - kRunTypeSentinel = 0x7FFFFFFF - }; + static constexpr int kRunTypeSentinel = 0x7FFFFFFF; SkRegion(); SkRegion(const SkRegion&); @@ -399,16 +397,12 @@ public: SkDEBUGCODE(bool debugSetRuns(const RunType runs[], int count);) private: - enum { - kOpCount = kReplace_Op + 1 - }; + static constexpr int kOpCount = kReplace_Op + 1; - enum { - // T - // [B N L R S] - // S - kRectRegionRuns = 7 - }; + // T + // [B N L R S] + // S + static constexpr int kRectRegionRuns = 7; friend class android::Region; // needed for marshalling efficiently |