| 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 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // and caching the glyph. This GM wants to ensure that we draw stroking corr
ectly on both | 43 // and caching the glyph. This GM wants to ensure that we draw stroking corr
ectly on both |
| 44 // sides of this threshold. | 44 // sides of this threshold. |
| 45 enum { | 45 enum { |
| 46 kBelowThreshold_TextSize = 255, | 46 kBelowThreshold_TextSize = 255, |
| 47 kAboveThreshold_TextSize = 257 | 47 kAboveThreshold_TextSize = 257 |
| 48 }; | 48 }; |
| 49 public: | 49 public: |
| 50 StrokeTextGM() {} | 50 StrokeTextGM() {} |
| 51 | 51 |
| 52 protected: | 52 protected: |
| 53 virtual uint32_t onGetFlags() const SK_OVERRIDE { |
| 54 return kSkipTiled_Flag; |
| 55 } |
| 56 |
| 53 virtual SkString onShortName() SK_OVERRIDE { | 57 virtual SkString onShortName() SK_OVERRIDE { |
| 54 return SkString("stroketext"); | 58 return SkString("stroketext"); |
| 55 } | 59 } |
| 56 | 60 |
| 57 virtual SkISize onISize() SK_OVERRIDE { | 61 virtual SkISize onISize() SK_OVERRIDE { |
| 58 return SkISize::Make(640, 480); | 62 return SkISize::Make(640, 480); |
| 59 } | 63 } |
| 60 | 64 |
| 61 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 65 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { |
| 62 if (true) { test_nulldev(canvas); } | 66 if (true) { test_nulldev(canvas); } |
| 63 SkPaint paint; | 67 SkPaint paint; |
| 64 paint.setAntiAlias(true); | 68 paint.setAntiAlias(true); |
| 65 | 69 |
| 66 paint.setTextSize(kBelowThreshold_TextSize); | 70 paint.setTextSize(kBelowThreshold_TextSize); |
| 67 draw_text_stroked(canvas, paint); | 71 draw_text_stroked(canvas, paint); |
| 68 | 72 |
| 69 canvas->translate(200, 0); | 73 canvas->translate(200, 0); |
| 70 paint.setTextSize(kAboveThreshold_TextSize); | 74 paint.setTextSize(kAboveThreshold_TextSize); |
| 71 draw_text_stroked(canvas, paint); | 75 draw_text_stroked(canvas, paint); |
| 72 } | 76 } |
| 73 | 77 |
| 74 private: | 78 private: |
| 75 typedef skiagm::GM INHERITED; | 79 typedef skiagm::GM INHERITED; |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 DEF_GM( return SkNEW(StrokeTextGM); ) | 82 DEF_GM( return SkNEW(StrokeTextGM); ) |
| OLD | NEW |