| 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" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 | 30 |
| 31 SkString onShortName() SK_OVERRIDE { | 31 SkString onShortName() override { |
| 32 SkString str("glyph_pos"); | 32 SkString str("glyph_pos"); |
| 33 if (fStrokeWidth == 0.0f) { | 33 if (fStrokeWidth == 0.0f) { |
| 34 str.append("_h"); // h == Hairline. | 34 str.append("_h"); // h == Hairline. |
| 35 } else { | 35 } else { |
| 36 str.append("_n"); // n == Normal. | 36 str.append("_n"); // n == Normal. |
| 37 } | 37 } |
| 38 if (fStrokeStyle == SkPaint::kStroke_Style) { | 38 if (fStrokeStyle == SkPaint::kStroke_Style) { |
| 39 str.append("_s"); | 39 str.append("_s"); |
| 40 } else if (fStrokeStyle == SkPaint::kFill_Style) { | 40 } else if (fStrokeStyle == SkPaint::kFill_Style) { |
| 41 str.append("_f"); | 41 str.append("_f"); |
| 42 } else { | 42 } else { |
| 43 str.append("_b"); // b == Both. | 43 str.append("_b"); // b == Both. |
| 44 } | 44 } |
| 45 return str; | 45 return str; |
| 46 } | 46 } |
| 47 | 47 |
| 48 SkISize onISize() SK_OVERRIDE { return SkISize::Make(800, 600); } | 48 SkISize onISize() override { return SkISize::Make(800, 600); } |
| 49 | 49 |
| 50 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 50 void onDraw(SkCanvas* canvas) override { |
| 51 if (!fProp) { | 51 if (!fProp) { |
| 52 fProp.reset(sk_tool_utils::create_portable_typeface("Helvetica", SkT
ypeface::kNormal)); | 52 fProp.reset(sk_tool_utils::create_portable_typeface("Helvetica", SkT
ypeface::kNormal)); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // There's a black pixel at 40, 40 for reference. | 55 // There's a black pixel at 40, 40 for reference. |
| 56 canvas->drawPoint(40.0f, 40.0f, SK_ColorBLACK); | 56 canvas->drawPoint(40.0f, 40.0f, SK_ColorBLACK); |
| 57 | 57 |
| 58 // Two reference images. | 58 // Two reference images. |
| 59 canvas->translate(50.0f, 50.0f); | 59 canvas->translate(50.0f, 50.0f); |
| 60 drawTestCase(canvas, 1.0f); | 60 drawTestCase(canvas, 1.0f); |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); | 193 static GMRegistry reg1(GlyphPosHairlineStrokeAndFillFactory); |
| 194 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); | 194 static GMRegistry reg2(GlyphPosStrokeAndFillFactory); |
| 195 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); | 195 static GMRegistry reg3(GlyphPosHairlineStrokeFactory); |
| 196 static GMRegistry reg4(GlyphPosStrokeFactory); | 196 static GMRegistry reg4(GlyphPosStrokeFactory); |
| 197 static GMRegistry reg5(GlyphPosHairlineFillFactory); | 197 static GMRegistry reg5(GlyphPosHairlineFillFactory); |
| 198 static GMRegistry reg6(GlyphPosFillFactory); | 198 static GMRegistry reg6(GlyphPosFillFactory); |
| 199 | 199 |
| 200 | 200 |
| 201 } | 201 } |
| OLD | NEW |