diff options
| author | bungeman <bungeman@google.com> | 2016-07-12 15:01:19 -0700 |
|---|---|---|
| committer | Commit bot <commit-bot@chromium.org> | 2016-07-12 15:01:19 -0700 |
| commit | 7438bfc0804d021aa92cdd5ea644994a4248f3db (patch) | |
| tree | 0b801d131d01d45e83160a6d0d877949590908de /samplecode/SampleDither.cpp | |
| parent | 2edf0c6a719b8dff4365628cf3b4481c5035f07a (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 'samplecode/SampleDither.cpp')
| -rw-r--r-- | samplecode/SampleDither.cpp | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/samplecode/SampleDither.cpp b/samplecode/SampleDither.cpp index 99b33f0f0e..a1b751b96f 100644 --- a/samplecode/SampleDither.cpp +++ b/samplecode/SampleDither.cpp @@ -37,10 +37,7 @@ static void draw_sweep(SkCanvas* c, int width, int height, SkScalar angle) { colors, nullptr, SK_ARRAY_COUNT(colors))); SkAutoCanvasRestore acr(c, true); - - c->translate(r.centerX(), r.centerY()); - c->rotate(angle); - c->translate(-r.centerX(), -r.centerY()); + c->rotate(angle, r.centerX(), r.centerY()); SkRect bounds = r; r.inset(p.getStrokeWidth(), p.getStrokeWidth()); |
