Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(149)

Unified Diff: src/core/SkRRect.cpp

Issue 354913004: Fix RRect transform bug (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add unit test Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tests/RoundRectTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRRect.cpp
diff --git a/src/core/SkRRect.cpp b/src/core/SkRRect.cpp
index 9bb6725deac3c4ed79c3b6068e563f62ce3ea2f8..10d3d7676b66c6b9ee32335aec7cae932415a3df 100644
--- a/src/core/SkRRect.cpp
+++ b/src/core/SkRRect.cpp
@@ -342,6 +342,19 @@ bool SkRRect::transform(const SkMatrix& matrix, SkRRect* dst) const {
// At this point, this is guaranteed to succeed, so we can modify dst.
dst->fRect = newRect;
+ // Since the only transforms that were allowed are scale and translate, the type
+ // remains unchanged.
+ dst->fType = fType;
+
+ if (kOval_Type == fType) {
+ for (int i = 0; i < 4; ++i) {
+ dst->fRadii[i].fX = SkScalarHalf(newRect.width());
+ dst->fRadii[i].fY = SkScalarHalf(newRect.height());
+ }
+ SkDEBUGCODE(dst->validate();)
+ return true;
+ }
+
// Now scale each corner
SkScalar xScale = matrix.getScaleX();
const bool flipX = xScale < 0;
@@ -377,10 +390,6 @@ bool SkRRect::transform(const SkMatrix& matrix, SkRRect* dst) const {
SkTSwap(dst->fRadii[kUpperRight_Corner], dst->fRadii[kLowerRight_Corner]);
}
- // Since the only transforms that were allowed are scale and translate, the type
- // remains unchanged.
- dst->fType = fType;
-
SkDEBUGCODE(dst->validate();)
return true;
« no previous file with comments | « no previous file | tests/RoundRectTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698