aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/core
diff options
context:
space:
mode:
authorGravatar bungeman <bungeman@google.com>2016-07-12 15:01:19 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-12 15:01:19 -0700
commit7438bfc0804d021aa92cdd5ea644994a4248f3db (patch)
tree0b801d131d01d45e83160a6d0d877949590908de /include/core
parent2edf0c6a719b8dff4365628cf3b4481c5035f07a (diff)
Factor code to rotate a canvas about a point.
SkMatrix::scale and ::rotate take a point around which to scale or rotate. Canvas lacks these helpers, so the code to rotate a canvas around a point has been duplicated many times. Factor all of these implementations into SkCanvas::rotate. GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2142033002 Review-Url: https://codereview.chromium.org/2142033002
Diffstat (limited to 'include/core')
-rw-r--r--include/core/SkCanvas.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/include/core/SkCanvas.h b/include/core/SkCanvas.h
index 337ce72767..bba045c490 100644
--- a/include/core/SkCanvas.h
+++ b/include/core/SkCanvas.h
@@ -419,11 +419,18 @@ public:
*/
void scale(SkScalar sx, SkScalar sy);
- /** Preconcat the current matrix with the specified rotation.
+ /** Preconcat the current matrix with the specified rotation about the origin.
@param degrees The amount to rotate, in degrees
*/
void rotate(SkScalar degrees);
+ /** Preconcat the current matrix with the specified rotation about a given point.
+ @param degrees The amount to rotate, in degrees
+ @param px The x coordinate of the point to rotate about.
+ @param py The y coordinate of the point to rotate about.
+ */
+ void rotate(SkScalar degrees, SkScalar px, SkScalar py);
+
/** Preconcat the current matrix with the specified skew.
@param sx The amount to skew in X
@param sy The amount to skew in Y