Add SkRRect::transform.

Much like SkPath::transform, it transforms an SkRRect based on an
SkMatrix. Unlike SkPath::transform, it will fail for matrices that
contain perspective or skewing.

Required by a future change (
to speed up drawing large blurry rounded rectangles by using ninepatches.

TODO: This could easily support 90 degree rotations, if desired.


Review URL:

git-svn-id: 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/core/SkRRect.h b/core/SkRRect.h
index 3c6386f..66c433f 100644
--- a/core/SkRRect.h
+++ b/core/SkRRect.h
@@ -12,6 +12,7 @@
 #include "SkPoint.h"
 class SkPath;
+class SkMatrix;
 // Path forward:
 //   core work
@@ -259,6 +260,17 @@
     size_t readFromMemory(const void* buffer, size_t length);
+    /**
+     *  Transform by the specified matrix, and put the result in dst.
+     *
+     *  @param matrix SkMatrix specifying the transform. Must only contain
+     *      scale and/or translate, or this call will fail.
+     *  @param dst SkRRect to store the result. It is an error to use this,
+     *      which would make this function no longer const.
+     *  @return true on success, false on failure. If false, dst is unmodified.
+     */
+    bool transform(const SkMatrix& matrix, SkRRect* dst) const;
     SkRect fRect;
     // Radii order is UL, UR, LR, LL. Use Corner enum to index into fRadii[]