// 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;
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;
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
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());