Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(106)

Unified Diff: gm/strokes.cpp

Issue 2142033002: Factor code to rotate a canvas about a point. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gm/imagefilterstransformed.cpp ('k') | gm/typeface.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/strokes.cpp
diff --git a/gm/strokes.cpp b/gm/strokes.cpp
index 61f5a8af6aa770895e4c135c5ac7b04f4f3b3e64..39661a5a07c8533157ff9e3da7489f67c505db1d 100644
--- a/gm/strokes.cpp
+++ b/gm/strokes.cpp
@@ -10,6 +10,7 @@
#include "SkRandom.h"
#include "SkDashPathEffect.h"
#include "SkParsePath.h"
+#include "sk_tool_utils.h"
#define W 400
#define H 400
@@ -290,12 +291,6 @@ protected:
return SkISize::Make(W, H*2);
}
- static void rotate(SkScalar angle, SkScalar px, SkScalar py, SkCanvas* canvas) {
- SkMatrix matrix;
- matrix.setRotate(angle, px, py);
- canvas->concat(matrix);
bungeman-skia 2016/07/12 15:47:11 With floats the order of operations matters. This
- }
-
void onDraw(SkCanvas* canvas) override {
canvas->drawColor(SK_ColorWHITE);
@@ -316,7 +311,7 @@ protected:
for (int i = 0; i < N/2; i++) {
SkRect r;
rnd_rect(&r, &paint, rand);
- rotate(SkIntToScalar(15), SW/2, SH/2, canvas);
+ sk_tool_utils::rotate_about(canvas, SkIntToScalar(15), SW/2, SH/2);
canvas->drawPath(fPath, paint);
}
}
« no previous file with comments | « gm/imagefilterstransformed.cpp ('k') | gm/typeface.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698