consolidate SaveLayerFlag internal references
Add a third define in SkCanvasPriv to complement
SkCanvas::kDontClipToLayer_PrivateSaveLayerFlag and
SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag.
SkCanvas::kDontClipToLayer_PrivateSaveLayerFlag exists only to define
SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag and
SkCanvasPriv::kDontClipToLayer_SaveLayerFlag.
SkCanvas::kDontClipToLayer_Legacy_SaveLayerFlag is used only by
Android framework.
SkCanvasPriv::kDontClipToLayer_SaveLayerFlag is used internally.
Note that changes to CanvasStateTest.cpp inside
SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG aren't testable by existing
skiabots; it requires building an Android framework aware version
of dm. CanvasStateTest.cpp may have bit-rotted.
R=reed@google.com,scroggo@google.com
Bug: skia:6454,skia:7690
Change-Id: I74f2a54636fae89a5a88a7e13f1baba49d3e2115
Reviewed-on: https://skia-review.googlesource.com/112401
Commit-Queue: Cary Clark <caryclark@skia.org>
Reviewed-by: Leon Scroggins <scroggo@google.com>
Reviewed-by: Mike Reed <reed@google.com>
diff --git a/gm/savelayer.cpp b/gm/savelayer.cpp
index a5b2f9c..32f95bf 100644
--- a/gm/savelayer.cpp
+++ b/gm/savelayer.cpp
@@ -7,8 +7,8 @@
#include "gm.h"
#include "sk_tool_utils.h"
+#include "SkCanvasPriv.h"
-static const uint32_t SkCanvas_kDontClipToLayer_PrivateSaveLayerFlag = 1U << 31;
// This GM tests out the deprecated Android-specific unclipped saveLayer "feature".
// In particular, it attempts to compare the performance of unclipped saveLayers with alternatives.
@@ -17,7 +17,7 @@
SkScalar l, SkScalar t, SkScalar r, SkScalar b) {
SkRect rect = SkRect::MakeLTRB(l, t, r, b);
canvas->saveLayer({ &rect, nullptr, nullptr, nullptr, nullptr,
- SkCanvas_kDontClipToLayer_PrivateSaveLayerFlag });
+ (SkCanvas::SaveLayerFlags) SkCanvasPriv::kDontClipToLayer_SaveLayerFlag });
}
static void do_draw(SkCanvas* canvas) {
@@ -93,7 +93,8 @@
// In the future, we might also test the clipped case by allowing i = 0
for(int i = 1; i < 2; ++i) {
canvas->translate(100 * i, 0);
- auto flag = i ? SkCanvas_kDontClipToLayer_PrivateSaveLayerFlag : 0;
+ auto flag = i ?
+ (SkCanvas::SaveLayerFlags) SkCanvasPriv::kDontClipToLayer_SaveLayerFlag : 0;
canvas->saveLayer({ &rect1, &paint1, nullptr, nullptr, nullptr, flag});
canvas->saveLayer({ &rect2, &paint2, nullptr, nullptr, nullptr, flag});
canvas->drawRect(rect3, paint3);