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

Side by Side Diff: tools/sk_tool_utils.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 unified diff | Download patch
« gm/strokes.cpp ('K') | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2014 Google Inc. 2 * Copyright 2014 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "sk_tool_utils_flags.h" 9 #include "sk_tool_utils_flags.h"
10 10
11 #include "Resources.h" 11 #include "Resources.h"
12 #include "SkBitmap.h" 12 #include "SkBitmap.h"
13 #include "SkCanvas.h" 13 #include "SkCanvas.h"
14 #include "SkCommonFlags.h" 14 #include "SkCommonFlags.h"
15 #include "SkFontMgr.h" 15 #include "SkFontMgr.h"
16 #include "SkFontStyle.h" 16 #include "SkFontStyle.h"
17 #include "SkPoint3.h" 17 #include "SkPoint3.h"
18 #include "SkShader.h" 18 #include "SkShader.h"
19 #include "SkTestScalerContext.h" 19 #include "SkTestScalerContext.h"
20 #include "SkTextBlob.h" 20 #include "SkTextBlob.h"
21 21
22 DEFINE_bool(portableFonts, false, "Use portable fonts"); 22 DEFINE_bool(portableFonts, false, "Use portable fonts");
23 23
24 namespace sk_tool_utils { 24 namespace sk_tool_utils {
25 25
26 void rotate_about(SkCanvas* canvas, SkScalar degrees, SkScalar px, SkScalar py) {
27 canvas->translate(px, py);
28 canvas->rotate(degrees);
29 canvas->translate(-px, -py);
30 }
31
26 /* these are the default fonts chosen by Chrome for serif, sans-serif, and monos pace */ 32 /* these are the default fonts chosen by Chrome for serif, sans-serif, and monos pace */
27 static const char* gStandardFontNames[][3] = { 33 static const char* gStandardFontNames[][3] = {
28 { "Times", "Helvetica", "Courier" }, // Mac 34 { "Times", "Helvetica", "Courier" }, // Mac
29 { "Times New Roman", "Helvetica", "Courier" }, // iOS 35 { "Times New Roman", "Helvetica", "Courier" }, // iOS
30 { "Times New Roman", "Arial", "Courier New" }, // Win 36 { "Times New Roman", "Arial", "Courier New" }, // Win
31 { "Times New Roman", "Arial", "Monospace" }, // Ubuntu 37 { "Times New Roman", "Arial", "Monospace" }, // Ubuntu
32 { "serif", "sans-serif", "monospace" }, // Android 38 { "serif", "sans-serif", "monospace" }, // Android
33 { "Tinos", "Arimo", "Cousine" } // ChromeOS 39 { "Tinos", "Arimo", "Cousine" } // ChromeOS
34 }; 40 };
35 41
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 for (int y = 0; y < src.height(); ++y) { 463 for (int y = 0; y < src.height(); ++y) {
458 for (int x = 0; x < src.width(); ++x) { 464 for (int x = 0; x < src.width(); ++x) {
459 *dst.getAddr32(x, y) = blur_pixel(src, x, y, kernel.get(), wh); 465 *dst.getAddr32(x, y) = blur_pixel(src, x, y, kernel.get(), wh);
460 } 466 }
461 } 467 }
462 468
463 return dst; 469 return dst;
464 } 470 }
465 471
466 } // namespace sk_tool_utils 472 } // namespace sk_tool_utils
OLDNEW
« gm/strokes.cpp ('K') | « tools/sk_tool_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698