remove guard for complexity change
Bug: skia:
Change-Id: I11ff57dca2c48519bc3a23e36da01bf40d1b329c
Reviewed-on: https://skia-review.googlesource.com/c/174221
Commit-Queue: Mike Reed <reed@google.com>
Commit-Queue: Mike Klein <mtklein@google.com>
Auto-Submit: Mike Reed <reed@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 86c2618..09badf5 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -1795,14 +1795,12 @@
}
void SkPath::transform(const SkMatrix& matrix, SkPath* dst) const {
-#ifndef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
if (matrix.isIdentity()) {
if (dst != nullptr && dst != this) {
*dst = *this;
}
return;
}
-#endif
SkDEBUGCODE(this->validate();)
if (dst == nullptr) {
@@ -1851,22 +1849,16 @@
matrix.mapPoints(ed.points(), ed.pathRef()->countPoints());
dst->setFirstDirection(SkPathPriv::kUnknown_FirstDirection);
} else {
-#ifndef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
Convexity convexity = this->getConvexityOrUnknown();
-#endif
SkPathRef::CreateTransformedCopy(&dst->fPathRef, *fPathRef.get(), matrix);
if (this != dst) {
dst->fLastMoveToIndex = fLastMoveToIndex;
dst->fFillType = fFillType;
-#ifdef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
- dst->setConvexity(this->getConvexityOrUnknown());
-#endif
dst->fIsVolatile = fIsVolatile;
}
-#ifndef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
// Due to finite/fragile float numerics, we can't assume that a convex path remains
// convex after a transformation, so mark it as unknown here.
// However, some transformations are thought to be safe:
@@ -1876,7 +1868,6 @@
} else {
dst->setConvexity(kUnknown_Convexity);
}
-#endif
if (this->getFirstDirection() == SkPathPriv::kUnknown_FirstDirection) {
dst->setFirstDirection(SkPathPriv::kUnknown_FirstDirection);
@@ -1891,9 +1882,6 @@
} else if (det2x2 > 0) {
dst->setFirstDirection(this->getFirstDirection());
} else {
-#ifdef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
- dst->setConvexity(kUnknown_Convexity);
-#endif
dst->setFirstDirection(SkPathPriv::kUnknown_FirstDirection);
}
}
diff --git a/tests/PathTest.cpp b/tests/PathTest.cpp
index 6809f15..ec60206 100644
--- a/tests/PathTest.cpp
+++ b/tests/PathTest.cpp
@@ -5224,12 +5224,10 @@
}
};
-#ifndef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
static bool conditional_convex(const SkPath& path, bool is_convex) {
SkPath::Convexity c = path.getConvexityOrUnknown();
return is_convex ? (c == SkPath::kConvex_Convexity) : (c != SkPath::kConvex_Convexity);
}
-#endif
// expect axis-aligned shape to survive assignment, identity and scale/translate matrices
template <typename ISA>
@@ -5259,20 +5257,16 @@
path->transform(x.fTM);
REPORTER_ASSERT(reporter, isa_proc(path2));
REPORTER_ASSERT(reporter, isa_proc(*path));
-#ifndef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
REPORTER_ASSERT(reporter, conditional_convex(path2, isAxisAligned));
REPORTER_ASSERT(reporter, conditional_convex(*path, isAxisAligned));
-#endif
// a path's isa should survive scaling, convexity depends on axis alignment
path->transform(x.fSM, &path2);
path->transform(x.fSM);
REPORTER_ASSERT(reporter, isa_proc(path2));
REPORTER_ASSERT(reporter, isa_proc(*path));
-#ifndef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
REPORTER_ASSERT(reporter, conditional_convex(path2, isAxisAligned));
REPORTER_ASSERT(reporter, conditional_convex(*path, isAxisAligned));
-#endif
// For security, post-rotation, we can't assume we're still convex. It might prove to be,
// in fact, still be convex, be we can't have cached that setting, hence the call to
@@ -5283,10 +5277,8 @@
REPORTER_ASSERT(reporter, !isa_proc(path2));
REPORTER_ASSERT(reporter, !isa_proc(*path));
}
-#ifndef SK_SUPPORT_LEGACY_CACHE_CONVEXITY
REPORTER_ASSERT(reporter, path2.getConvexityOrUnknown() != SkPath::kConvex_Convexity);
REPORTER_ASSERT(reporter, path->getConvexityOrUnknown() != SkPath::kConvex_Convexity);
-#endif
}
DEF_TEST(Path_survive_transform, r) {