aboutsummaryrefslogtreecommitdiff
path: root/tools/sk_tool_utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tools/sk_tool_utils.cpp')
-rw-r--r--tools/sk_tool_utils.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/sk_tool_utils.cpp b/tools/sk_tool_utils.cpp
index 374d00fd9c..a50dffc788 100644
--- a/tools/sk_tool_utils.cpp
+++ b/tools/sk_tool_utils.cpp
@@ -175,11 +175,12 @@ void get_text_path(const SkFont& font, const void* text, size_t length, SkTextEn
}
SkPath make_star(const SkRect& bounds, int numPts, int step) {
+ SkASSERT(numPts != step);
SkPath path;
path.setFillType(SkPath::kEvenOdd_FillType);
path.moveTo(0,-1);
for (int i = 1; i < numPts; ++i) {
- int idx = i*step;
+ int idx = i*step % numPts;
SkScalar theta = idx * 2*SK_ScalarPI/numPts + SK_ScalarPI/2;
SkScalar x = SkScalarCos(theta);
SkScalar y = -SkScalarSin(theta);