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

Unified Diff: gm/dftext.cpp

Issue 2142033002: Factor code to rotate a canvas about a point. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Move to canvas. 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
Index: gm/dftext.cpp
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index 42d650ed2f4508189089336ee1a1e2b8878ef3ea..8ab2df71bab38cc7a1f1200c603cf9c96ad10d8e 100644
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -33,14 +33,6 @@ protected:
return SkISize::Make(1024, 768);
}
- static void rotate_about(SkCanvas* canvas,
- SkScalar degrees,
- SkScalar px, SkScalar py) {
- canvas->translate(px, py);
- canvas->rotate(degrees);
- canvas->translate(-px, -py);
- }
-
virtual void onDraw(SkCanvas* inputCanvas) override {
SkScalar textSizes[] = { 9.0f, 9.0f*2.0f, 9.0f*5.0f, 9.0f*2.0f*5.0f };
SkScalar scales[] = { 2.0f*5.0f, 5.0f, 2.0f, 1.0f };
@@ -95,7 +87,7 @@ protected:
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(SkIntToScalar(10 + i * 200), -80);
- rotate_about(canvas, SkIntToScalar(i * 5), rotX, rotY);
+ canvas->rotate(SkIntToScalar(i * 5), rotX, rotY);
for (int ps = 6; ps <= 32; ps += 3) {
paint.setTextSize(SkIntToScalar(ps));
canvas->drawText(text, textLen, rotX, rotY, paint);
« no previous file with comments | « bench/BitmapBench.cpp ('k') | gm/fontscaler.cpp » ('j') | src/core/SkCanvas.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698