aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/private/SkTDArray.h1
-rwxr-xr-xsrc/utils/SkOffsetPolygon.cpp4
2 files changed, 4 insertions, 1 deletions
diff --git a/include/private/SkTDArray.h b/include/private/SkTDArray.h
index 658d371917..35ad40906a 100644
--- a/include/private/SkTDArray.h
+++ b/include/private/SkTDArray.h
@@ -143,6 +143,7 @@ public:
}
void setReserve(int reserve) {
+ SkASSERT(reserve >= 0);
if (reserve > fReserve) {
this->resizeStorageToAtLeast(reserve);
}
diff --git a/src/utils/SkOffsetPolygon.cpp b/src/utils/SkOffsetPolygon.cpp
index 94fe96562d..47b41250e2 100755
--- a/src/utils/SkOffsetPolygon.cpp
+++ b/src/utils/SkOffsetPolygon.cpp
@@ -347,7 +347,9 @@ bool SkInsetConvexPolygon(const SkPoint* inputPolygonVerts, int inputPolygonSize
static constexpr SkScalar kCleanupTolerance = 0.01f;
insetPolygon->reset();
- insetPolygon->setReserve(insetVertexCount);
+ if (insetVertexCount >= 0) {
+ insetPolygon->setReserve(insetVertexCount);
+ }
currIndex = -1;
for (int i = 0; i < inputPolygonSize; ++i) {
if (edgeData[i].fValid && (currIndex == -1 ||