OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
11 #include "SkLumaColorFilter.h" | 11 #include "SkLumaColorFilter.h" |
12 | 12 |
13 static SkScalar kSize = 80; | 13 static SkScalar kSize = 80; |
14 static SkScalar kInset = 10; | 14 static SkScalar kInset = 10; |
15 static SkColor kColor1 = SkColorSetARGB(0xff, 0xff, 0xff, 0); | 15 static SkColor kColor1 = SkColorSetARGB(0xff, 0xff, 0xff, 0); |
16 static SkColor kColor2 = SkColorSetARGB(0xff, 0x80, 0xff, 0); | 16 static SkColor kColor2 = SkColorSetARGB(0xff, 0x82, 0xff, 0); |
17 | 17 |
18 static void draw_label(SkCanvas* canvas, const char* label, | 18 static void draw_label(SkCanvas* canvas, const char* label, |
19 const SkPoint& offset) { | 19 const SkPoint& offset) { |
20 SkPaint paint; | 20 SkPaint paint; |
21 sk_tool_utils::set_portable_typeface(&paint); | 21 sk_tool_utils::set_portable_typeface_always(&paint); |
22 size_t len = strlen(label); | 22 size_t len = strlen(label); |
23 | 23 |
24 SkScalar width = paint.measureText(label, len); | 24 SkScalar width = paint.measureText(label, len); |
25 canvas->drawText(label, len, offset.x() - width / 2, offset.y(), | 25 canvas->drawText(label, len, offset.x() - width / 2, offset.y(), |
26 paint); | 26 paint); |
27 } | 27 } |
28 | 28 |
29 static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, | 29 static void draw_scene(SkCanvas* canvas, SkColorFilter* filter, |
30 SkXfermode::Mode mode, SkShader* s1, | 30 SkXfermode::Mode mode, SkShader* s1, |
31 SkShader* s2) { | 31 SkShader* s2) { |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 private: | 146 private: |
147 SkAutoTUnref<SkColorFilter> fFilter; | 147 SkAutoTUnref<SkColorFilter> fFilter; |
148 SkAutoTUnref<SkShader> fGr1, fGr2; | 148 SkAutoTUnref<SkShader> fGr1, fGr2; |
149 | 149 |
150 typedef skiagm::GM INHERITED; | 150 typedef skiagm::GM INHERITED; |
151 }; | 151 }; |
152 | 152 |
153 ////////////////////////////////////////////////////////////////////////////// | 153 ////////////////////////////////////////////////////////////////////////////// |
154 | 154 |
155 DEF_GM( return SkNEW(LumaFilterGM); ) | 155 DEF_GM( return SkNEW(LumaFilterGM); ) |
OLD | NEW |