aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/pathops/SkPathOpsTightBounds.cpp4
-rw-r--r--tests/PathOpsTightBoundsTest.cpp11
2 files changed, 15 insertions, 0 deletions
diff --git a/src/pathops/SkPathOpsTightBounds.cpp b/src/pathops/SkPathOpsTightBounds.cpp
index d748ff538a..f379c9e9a7 100644
--- a/src/pathops/SkPathOpsTightBounds.cpp
+++ b/src/pathops/SkPathOpsTightBounds.cpp
@@ -75,6 +75,10 @@ bool TightBounds(const SkPath& path, SkRect* result) {
while ((current = current->next())) {
bounds.add(current->bounds());
}
+ if (scaleFactor > SK_Scalar1) {
+ bounds.set(bounds.left() * scaleFactor, bounds.top() * scaleFactor,
+ bounds.right() * scaleFactor, bounds.bottom() * scaleFactor);
+ }
*result = bounds;
if (!moveBounds.isEmpty()) {
result->join(moveBounds);
diff --git a/tests/PathOpsTightBoundsTest.cpp b/tests/PathOpsTightBoundsTest.cpp
index 8fd0fdb453..a2e7bcae9b 100644
--- a/tests/PathOpsTightBoundsTest.cpp
+++ b/tests/PathOpsTightBoundsTest.cpp
@@ -188,3 +188,14 @@ DEF_TEST(PathOpsTightBoundsIllBehaved, reporter) {
REPORTER_ASSERT(reporter, bounds != tight);
}
+DEF_TEST(PathOpsTightBoundsIllBehavedScaled, reporter) {
+ SkPath path;
+ path.moveTo(0, 0);
+ path.quadTo(1048578, 1048577, 1048576, 1048576);
+ const SkRect& bounds = path.getBounds();
+ SkRect tight;
+ REPORTER_ASSERT(reporter, TightBounds(path, &tight));
+ REPORTER_ASSERT(reporter, bounds != tight);
+ REPORTER_ASSERT(reporter, tight.right() == 1048576);
+ REPORTER_ASSERT(reporter, tight.bottom() == 1048576);
+}