add guard for obsolete (non-functioning) replayClips
replayClips has been disabled (broken) for a while.
This CL just attempts to hide the api (will remove
once android's callsite is removed)
Bug: skia:
Change-Id: I35b412addfc0a08ea888a62609888b9b54dce2a6
Reviewed-on: https://skia-review.googlesource.com/11401
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
diff --git a/gn/android_framework_defines.gni b/gn/android_framework_defines.gni
index 3447efe..9f37ed6 100644
--- a/gn/android_framework_defines.gni
+++ b/gn/android_framework_defines.gni
@@ -14,4 +14,5 @@
"SK_IGNORE_GPU_DITHER",
"SK_SUPPORT_LEGACY_SHADER_ISABITMAP",
"SK_SUPPORT_LEGACY_EMBOSSMASKFILTER",
+ "SK_SUPPORT_OBSOLETE_REPLAYCLIP",
]
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 71e45fa..4c875e8 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -21,7 +21,9 @@
class GrRenderTargetContext;
class SkBaseDevice;
class SkBitmap;
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
class SkCanvasClipVisitor;
+#endif
class SkClipStack;
class SkData;
class SkDraw;
@@ -1281,6 +1283,7 @@
*/
const SkMatrix& getTotalMatrix() const;
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
typedef SkCanvasClipVisitor ClipVisitor;
/**
* Replays the clip operations, back to front, that have been applied to
@@ -1288,6 +1291,7 @@
* clip. All clips have already been transformed into device space.
*/
void replayClips(ClipVisitor*) const;
+#endif
///////////////////////////////////////////////////////////////////////////
@@ -1687,6 +1691,7 @@
};
#define SkAutoCanvasRestore(...) SK_REQUIRE_LOCAL_VAR(SkAutoCanvasRestore)
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
class SkCanvasClipVisitor {
public:
virtual ~SkCanvasClipVisitor();
@@ -1694,5 +1699,6 @@
virtual void clipRRect(const SkRRect&, SkClipOp, bool antialias) = 0;
virtual void clipPath(const SkPath&, SkClipOp, bool antialias) = 0;
};
+#endif
#endif
diff --git a/src/core/SkCanvas.cpp b/src/core/SkCanvas.cpp
index e38e73b..9a02c19 100644
--- a/src/core/SkCanvas.cpp
+++ b/src/core/SkCanvas.cpp
@@ -1573,6 +1573,7 @@
}
#endif
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
void SkCanvas::replayClips(ClipVisitor* visitor) const {
#if 0
SkClipStack::B2TIter iter(*fClipStack);
@@ -1583,6 +1584,7 @@
}
#endif
}
+#endif
bool SkCanvas::androidFramework_isClipAA() const {
bool containsAA = false;
@@ -3127,7 +3129,9 @@
///////////////////////////////////////////////////////////////////////////////
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
SkCanvasClipVisitor::~SkCanvasClipVisitor() { }
+#endif
///////////////////////////////////////////////////////////////////////////////
diff --git a/src/core/SkClipStack.cpp b/src/core/SkClipStack.cpp
index a2621a9..516cc8d 100644
--- a/src/core/SkClipStack.cpp
+++ b/src/core/SkClipStack.cpp
@@ -70,6 +70,7 @@
}
}
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
void SkClipStack::Element::replay(SkCanvasClipVisitor* visitor) const {
static const SkRect kEmptyRect = { 0, 0, 0, 0 };
@@ -88,6 +89,7 @@
break;
}
}
+#endif
void SkClipStack::Element::invertShapeFillType() {
switch (fType) {
diff --git a/src/core/SkClipStack.h b/src/core/SkClipStack.h
index 9360f4d..bd197e3 100644
--- a/src/core/SkClipStack.h
+++ b/src/core/SkClipStack.h
@@ -21,7 +21,9 @@
#include "GrResourceKey.h"
#endif
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
class SkCanvasClipVisitor;
+#endif
// Because a single save/restore state can have multiple clips, this class
// stores the stack depth (fSaveCount) and clips (fDeque) separately.
@@ -196,10 +198,12 @@
return kPath_Type == fType && fPath.get()->isInverseFillType();
}
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
/**
* Replay this clip into the visitor.
*/
void replay(SkCanvasClipVisitor*) const;
+#endif
#ifdef SK_DEBUG
/**
diff --git a/tests/CanvasTest.cpp b/tests/CanvasTest.cpp
index 9e7de67..26228ba 100644
--- a/tests/CanvasTest.cpp
+++ b/tests/CanvasTest.cpp
@@ -275,24 +275,6 @@
}
};
-class Canvas2CanvasClipVisitor : public SkCanvas::ClipVisitor {
-public:
- Canvas2CanvasClipVisitor(SkCanvas* target) : fTarget(target) {}
-
- void clipRect(const SkRect& r, SkClipOp op, bool aa) override {
- fTarget->clipRect(r, op, aa);
- }
- void clipRRect(const SkRRect& r, SkClipOp op, bool aa) override {
- fTarget->clipRRect(r, op, aa);
- }
- void clipPath(const SkPath& p, SkClipOp op, bool aa) override {
- fTarget->clipPath(p, op, aa);
- }
-
-private:
- SkCanvas* fTarget;
-};
-
// Format strings that describe the test context. The %s token is where
// the name of the test step is inserted. The context is required for
// disambiguating the error in the case of failures that are reported in
diff --git a/tools/debugger/SkDebugCanvas.cpp b/tools/debugger/SkDebugCanvas.cpp
index 2d7d040..9062726 100644
--- a/tools/debugger/SkDebugCanvas.cpp
+++ b/tools/debugger/SkDebugCanvas.cpp
@@ -149,6 +149,7 @@
return layer;
}
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
class SkDebugClipVisitor : public SkCanvas::ClipVisitor {
public:
SkDebugClipVisitor(SkCanvas* canvas) : fCanvas(canvas) {}
@@ -181,6 +182,7 @@
private:
typedef SkCanvas::ClipVisitor INHERITED;
};
+#endif
// set up the saveLayer commands so that the active ones
// return true in their 'active' method
@@ -288,6 +290,7 @@
filterCanvas.restore();
}
+#ifdef SK_SUPPORT_OBSOLETE_REPLAYCLIP
if (fMegaVizMode) {
filterCanvas.save();
// nuke the CTM
@@ -305,6 +308,7 @@
filterCanvas.restore();
}
+#endif
if (pathOpsMode) {
this->resetClipStackData();
const SkClipStack* clipStack = nullptr;//HACK filterCanvas.getClipStack();