| 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 static const SkScalar kTextHeight = 14.0f; |
| 18 static const char kText[] = "Proportional Hamburgefons #% fi"; | 18 static const char kText[] = "Proportional Hamburgefons #% fi"; |
| 19 | 19 |
| 20 namespace skiagm { | 20 namespace skiagm { |
| 21 | 21 |
| 22 class GlyphPosGM : public GM { | 22 class GlyphPosGM : public GM { |
| 23 public: | 23 public: |
| 24 GlyphPosGM(SkScalar strokeWidth, SkPaint::Style strokeStyle) | 24 GlyphPosGM(SkScalar strokeWidth, SkPaint::Style strokeStyle) |
| 25 : fStrokeWidth(strokeWidth) | 25 : fStrokeWidth(strokeWidth) |
| 26 , fStrokeStyle(strokeStyle) { | 26 , fStrokeStyle(strokeStyle) { |
| 27 } | 27 } |
| 28 | 28 |
| 29 protected: | 29 protected: |
| 30 uint32_t onGetFlags() const SK_OVERRIDE { | |
| 31 return kSkipTiled_Flag; | |
| 32 } | |
| 33 | 30 |
| 34 SkString onShortName() SK_OVERRIDE { | 31 SkString onShortName() SK_OVERRIDE { |
| 35 SkString str("glyph_pos"); | 32 SkString str("glyph_pos"); |
| 36 if (fStrokeWidth == 0.0f) { | 33 if (fStrokeWidth == 0.0f) { |
| 37 str.append("_h"); // h == Hairline. | 34 str.append("_h"); // h == Hairline. |
| 38 } else { | 35 } else { |
| 39 str.append("_n"); // n == Normal. | 36 str.append("_n"); // n == Normal. |
| 40 } | 37 } |
| 41 if (fStrokeStyle == SkPaint::kStroke_Style) { | 38 if (fStrokeStyle == SkPaint::kStroke_Style) { |
| 42 str.append("_s"); | 39 str.append("_s"); |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 192 |
| 196 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); | 193 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); |
| 197 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); | 194 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); |
| 198 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); | 195 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); |
| 199 static GMRegistry reg4(GlyphPosStrokeFactory); | 196 static GMRegistry reg4(GlyphPosStrokeFactory); |
| 200 static GMRegistry reg5(GlyphPosHairlineFillFactory); | 197 static GMRegistry reg5(GlyphPosHairlineFillFactory); |
| 201 static GMRegistry reg6(GlyphPosFillFactory); | 198 static GMRegistry reg6(GlyphPosFillFactory); |
| 202 | 199 |
| 203 | 200 |
| 204 } | 201 } |
| OLD | NEW |