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

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: 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 | « bench/BitmapBench.cpp ('k') | gm/fontscaler.cpp » ('j') | gm/strokes.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/dftext.cpp
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index 42d650ed2f4508189089336ee1a1e2b8878ef3ea..e64c1df4ca805282889a476f22acf534bb774cfd 100644
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -10,6 +10,7 @@
#include "SkStream.h"
#include "SkSurface.h"
#include "SkTypeface.h"
+#include "sk_tool_utils.h"
class DFTextGM : public skiagm::GM {
public:
@@ -33,14 +34,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 +88,7 @@ protected:
SkAutoCanvasRestore acr(canvas, true);
canvas->translate(SkIntToScalar(10 + i * 200), -80);
- rotate_about(canvas, SkIntToScalar(i * 5), rotX, rotY);
+ sk_tool_utils::rotate_about(canvas, 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') | gm/strokes.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698