OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "gm.h" | 8 #include "gm.h" |
9 #include "sk_tool_utils.h" | 9 #include "sk_tool_utils.h" |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) { | 50 static SkScalar draw_row(SkCanvas* canvas, const SkBitmap& bm) { |
51 SkAutoCanvasRestore acr(canvas, true); | 51 SkAutoCanvasRestore acr(canvas, true); |
52 | 52 |
53 SkPaint paint; | 53 SkPaint paint; |
54 SkScalar x = 0; | 54 SkScalar x = 0; |
55 const int scale = 32; | 55 const int scale = 32; |
56 | 56 |
57 paint.setAntiAlias(true); | 57 paint.setAntiAlias(true); |
| 58 sk_tool_utils::set_portable_typeface(&paint); |
58 const char* name = sk_tool_utils::colortype_name(bm.colorType()); | 59 const char* name = sk_tool_utils::colortype_name(bm.colorType()); |
59 canvas->drawText(name, strlen(name), x, SkIntToScalar(bm.height())*scale*5/8
, | 60 canvas->drawText(name, strlen(name), x, SkIntToScalar(bm.height())*scale*5/8
, |
60 paint); | 61 paint); |
61 canvas->translate(SkIntToScalar(48), 0); | 62 canvas->translate(SkIntToScalar(48), 0); |
62 | 63 |
63 canvas->scale(SkIntToScalar(scale), SkIntToScalar(scale)); | 64 canvas->scale(SkIntToScalar(scale), SkIntToScalar(scale)); |
64 | 65 |
65 x += draw_set(canvas, bm, 0, &paint); | 66 x += draw_set(canvas, bm, 0, &paint); |
66 paint.reset(); | 67 paint.reset(); |
67 paint.setAlpha(0x80); | 68 paint.setAlpha(0x80); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 private: | 117 private: |
117 typedef GM INHERITED; | 118 typedef GM INHERITED; |
118 }; | 119 }; |
119 | 120 |
120 ////////////////////////////////////////////////////////////////////////////// | 121 ////////////////////////////////////////////////////////////////////////////// |
121 | 122 |
122 static GM* MyFactory(void*) { return new FilterGM; } | 123 static GM* MyFactory(void*) { return new FilterGM; } |
123 static GMRegistry reg(MyFactory); | 124 static GMRegistry reg(MyFactory); |
124 | 125 |
125 } | 126 } |
OLD | NEW |