| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkPath.h" | 10 #include "SkPath.h" |
| 11 #include "SkTypeface.h" | 11 #include "SkTypeface.h" |
| 12 | 12 |
| 13 namespace skiagm { | 13 namespace skiagm { |
| 14 | 14 |
| 15 class StrokeFillGM : public GM { | 15 class StrokeFillGM : public GM { |
| 16 public: | 16 public: |
| 17 StrokeFillGM() { | 17 StrokeFillGM() { |
| 18 | 18 |
| 19 } | 19 } |
| 20 | 20 |
| 21 protected: | 21 protected: |
| 22 | 22 |
| 23 SkString onShortName() SK_OVERRIDE { | 23 SkString onShortName() override { |
| 24 return SkString("stroke-fill"); | 24 return SkString("stroke-fill"); |
| 25 } | 25 } |
| 26 | 26 |
| 27 SkISize onISize() SK_OVERRIDE { | 27 SkISize onISize() override { |
| 28 return SkISize::Make(640, 480); | 28 return SkISize::Make(640, 480); |
| 29 } | 29 } |
| 30 | 30 |
| 31 static void show_bold(SkCanvas* canvas, const void* text, int len, | 31 static void show_bold(SkCanvas* canvas, const void* text, int len, |
| 32 SkScalar x, SkScalar y, const SkPaint& paint) { | 32 SkScalar x, SkScalar y, const SkPaint& paint) { |
| 33 SkPaint p(paint); | 33 SkPaint p(paint); |
| 34 canvas->drawText(text, len, x, y, p); | 34 canvas->drawText(text, len, x, y, p); |
| 35 p.setFakeBoldText(true); | 35 p.setFakeBoldText(true); |
| 36 canvas->drawText(text, len, x, y + SkIntToScalar(120), p); | 36 canvas->drawText(text, len, x, y + SkIntToScalar(120), p); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 39 void onDraw(SkCanvas* canvas) override { |
| 40 SkScalar x = SkIntToScalar(100); | 40 SkScalar x = SkIntToScalar(100); |
| 41 SkScalar y = SkIntToScalar(88); | 41 SkScalar y = SkIntToScalar(88); |
| 42 | 42 |
| 43 SkPaint paint; | 43 SkPaint paint; |
| 44 paint.setAntiAlias(true); | 44 paint.setAntiAlias(true); |
| 45 paint.setTextSize(SkIntToScalar(100)); | 45 paint.setTextSize(SkIntToScalar(100)); |
| 46 paint.setStrokeWidth(SkIntToScalar(5)); | 46 paint.setStrokeWidth(SkIntToScalar(5)); |
| 47 | 47 |
| 48 sk_tool_utils::set_portable_typeface(&paint, "Papyrus"); | 48 sk_tool_utils::set_portable_typeface(&paint, "Papyrus"); |
| 49 show_bold(canvas, "Hello", 5, x, y, paint); | 49 show_bold(canvas, "Hello", 5, x, y, paint); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 | 116 |
| 117 private: | 117 private: |
| 118 typedef GM INHERITED; | 118 typedef GM INHERITED; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 ////////////////////////////////////////////////////////////////////////////// | 121 ////////////////////////////////////////////////////////////////////////////// |
| 122 | 122 |
| 123 DEF_GM(return SkNEW(StrokeFillGM);) | 123 DEF_GM(return SkNEW(StrokeFillGM);) |
| 124 | 124 |
| 125 } | 125 } |
| OLD | NEW |