make transformed rrect radii fit rectangle
authorcaryclark <caryclark@google.com>
Tue, 23 Feb 2016 18:32:40 +0000 (10:32 -0800)
committerCommit bot <commit-bot@chromium.org>
Tue, 23 Feb 2016 18:32:40 +0000 (10:32 -0800)
one more case caught by 1M skps
R=herb@google.com,reed@google.com
BUG=skia:4413
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1722483003

Review URL: https://codereview.chromium.org/1722483003

include/core/SkRRect.h
src/core/SkRRect.cpp

index 994edd2..5564ce0 100644 (file)
@@ -326,6 +326,7 @@ private:
 
     void computeType();
     bool checkCornerContainment(SkScalar x, SkScalar y) const;
+    void scaleRadii();
 
     // to access fRadii directly
     friend class SkPath;
index 2e03f81..2195dcf 100644 (file)
@@ -158,6 +158,11 @@ void SkRRect::setRectRadii(const SkRect& rect, const SkVector radii[4]) {
         return;
     }
 
+    this->scaleRadii();
+}
+
+void SkRRect::scaleRadii() {
+
     // Proportionally scale down all radii to fit. Find the minimum ratio
     // of a side and the radii on that side (for all four sides) and use
     // that to scale down _all_ the radii. This algorithm is from the
@@ -420,7 +425,7 @@ bool SkRRect::transform(const SkMatrix& matrix, SkRRect* dst) const {
         SkTSwap(dst->fRadii[kUpperRight_Corner], dst->fRadii[kLowerRight_Corner]);
     }
 
-    SkDEBUGCODE(dst->validate();)
+    dst->scaleRadii();
 
     return true;
 }