OLD | NEW |
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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkTypeface.h" | 10 #include "SkTypeface.h" |
11 | 11 |
12 /* This test tries to define the effect of using hairline strokes on text. | 12 /* This test tries to define the effect of using hairline strokes on text. |
13 * Provides non-hairline images for reference and consistency checks. | 13 * Provides non-hairline images for reference and consistency checks. |
14 * glyph_pos_(h/n)_(s/f/b) | 14 * glyph_pos_(h/n)_(s/f/b) |
15 * -> test hairline/non-hairline stroke/fill/stroke+fill. | 15 * -> test hairline/non-hairline stroke/fill/stroke+fill. |
16 */ | 16 */ |
17 static const SkScalar kTextHeight = 14.0f; | 17 constexpr SkScalar kTextHeight = 14.0f; |
18 static const char kText[] = "Proportional Hamburgefons #% fi"; | 18 constexpr char kText[] = "Proportional Hamburgefons #% fi"; |
19 | 19 |
20 static void drawTestCase(SkCanvas* canvas, | 20 static void drawTestCase(SkCanvas* canvas, |
21 SkScalar textScale, | 21 SkScalar textScale, |
22 SkScalar strokeWidth, | 22 SkScalar strokeWidth, |
23 SkPaint::Style strokeStyle); | 23 SkPaint::Style strokeStyle); |
24 | 24 |
25 static void draw_gm(SkCanvas* canvas, | 25 static void draw_gm(SkCanvas* canvas, |
26 SkScalar strokeWidth, | 26 SkScalar strokeWidth, |
27 SkPaint::Style strokeStyle) { | 27 SkPaint::Style strokeStyle) { |
28 // There's a black pixel at 40, 40 for reference. | 28 // There's a black pixel at 40, 40 for reference. |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 } | 143 } |
144 DEF_SIMPLE_GM(glyph_pos_n_s, c, 800, 600) { | 144 DEF_SIMPLE_GM(glyph_pos_n_s, c, 800, 600) { |
145 draw_gm(c, 1.2f, SkPaint::kStroke_Style); | 145 draw_gm(c, 1.2f, SkPaint::kStroke_Style); |
146 } | 146 } |
147 DEF_SIMPLE_GM(glyph_pos_h_f, c, 800, 600) { | 147 DEF_SIMPLE_GM(glyph_pos_h_f, c, 800, 600) { |
148 draw_gm(c, 0.0f, SkPaint::kFill_Style); | 148 draw_gm(c, 0.0f, SkPaint::kFill_Style); |
149 } | 149 } |
150 DEF_SIMPLE_GM(glyph_pos_n_f, c, 800, 600) { | 150 DEF_SIMPLE_GM(glyph_pos_n_f, c, 800, 600) { |
151 draw_gm(c, 1.2f, SkPaint::kFill_Style); | 151 draw_gm(c, 1.2f, SkPaint::kFill_Style); |
152 } | 152 } |
OLD | NEW |