Upstream version 9.38.198.0
[platform/framework/web/crosswalk.git] / src / third_party / skia / src / core / SkRRect.cpp
index 082646c..10d3d76 100644 (file)
@@ -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;
@@ -436,6 +445,18 @@ size_t SkRRect::readFromMemory(const void* buffer, size_t length) {
     return kSizeInMemory;
 }
 
+#ifdef SK_DEVELOPER
+void SkRRect::dump() const {
+    SkDebugf("Rect: ");
+    fRect.dump();
+    SkDebugf(" Corners: { TL: (%f, %f), TR: (%f, %f), BR: (%f, %f), BL: (%f, %f) }",
+             fRadii[kUpperLeft_Corner].fX,  fRadii[kUpperLeft_Corner].fY,
+             fRadii[kUpperRight_Corner].fX, fRadii[kUpperRight_Corner].fY,
+             fRadii[kLowerRight_Corner].fX, fRadii[kLowerRight_Corner].fY,
+             fRadii[kLowerLeft_Corner].fX,  fRadii[kLowerLeft_Corner].fY);
+}
+#endif
+
 ///////////////////////////////////////////////////////////////////////////////
 
 #ifdef SK_DEBUG
@@ -463,9 +484,6 @@ void SkRRect::validate() const {
         case kEmpty_Type:
             SkASSERT(fRect.isEmpty());
             SkASSERT(allRadiiZero && allRadiiSame && allCornersSquare);
-
-            SkASSERT(0 == fRect.fLeft && 0 == fRect.fTop &&
-                     0 == fRect.fRight && 0 == fRect.fBottom);
             break;
         case kRect_Type:
             SkASSERT(!fRect.isEmpty());