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 "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
11 | 11 |
12 /** | 12 /** |
13 * This test exercises drawPosTextH and drawPosText with every text align. | 13 * This test exercises drawPosTextH and drawPosText with every text align. |
14 */ | 14 */ |
15 static const int kWidth = 480; | 15 static const int kWidth = 480; |
16 static const int kHeight = 600; | 16 static const int kHeight = 600; |
17 static const SkScalar kTextHeight = 64.0f; | 17 static const SkScalar kTextHeight = 64.0f; |
18 static const int kMaxStringLength = 12; | 18 static const int kMaxStringLength = 12; |
19 | 19 |
20 namespace skiagm { | 20 namespace skiagm { |
21 | 21 |
22 class GlyphPosAlignGM : public GM { | 22 class GlyphPosAlignGM : public GM { |
23 protected: | 23 protected: |
24 | 24 |
25 SkString onShortName() SK_OVERRIDE { | 25 SkString onShortName() override { |
26 return SkString("glyph_pos_align"); | 26 return SkString("glyph_pos_align"); |
27 } | 27 } |
28 | 28 |
29 SkISize onISize() SK_OVERRIDE { return SkISize::Make(kWidth, kHeight); } | 29 SkISize onISize() override { return SkISize::Make(kWidth, kHeight); } |
30 | 30 |
31 void onDraw(SkCanvas* canvas) SK_OVERRIDE { | 31 void onDraw(SkCanvas* canvas) override { |
32 canvas->clear(SK_ColorBLACK); | 32 canvas->clear(SK_ColorBLACK); |
33 | 33 |
34 SkPaint paint; | 34 SkPaint paint; |
35 paint.setTextSize(kTextHeight); | 35 paint.setTextSize(kTextHeight); |
36 paint.setFakeBoldText(true); | 36 paint.setFakeBoldText(true); |
37 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; | 37 const SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; |
38 const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}}; | 38 const SkPoint pts[] = {{0, 0}, {kWidth, kHeight}}; |
39 SkAutoTUnref<SkShader> grad(SkGradientShader::CreateLinear(pts, colors,
NULL, | 39 SkAutoTUnref<SkShader> grad(SkGradientShader::CreateLinear(pts, colors,
NULL, |
40 SK_ARRAY_COUN
T(colors), | 40 SK_ARRAY_COUN
T(colors), |
41 SkShader::kMi
rror_TileMode)); | 41 SkShader::kMi
rror_TileMode)); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 ////////////////////////////////////////////////////////////////////////////// | 88 ////////////////////////////////////////////////////////////////////////////// |
89 | 89 |
90 static GM* GlyphPosAlignFactory(void*) { | 90 static GM* GlyphPosAlignFactory(void*) { |
91 return new GlyphPosAlignGM(); | 91 return new GlyphPosAlignGM(); |
92 } | 92 } |
93 | 93 |
94 static GMRegistry reg(GlyphPosAlignFactory); | 94 static GMRegistry reg(GlyphPosAlignFactory); |
95 | 95 |
96 } | 96 } |
OLD | NEW |