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" |
(...skipping 18 matching lines...) Expand all Loading... |
29 SkISize onISize() override { return SkISize::Make(kWidth, kHeight); } | 29 SkISize onISize() override { return SkISize::Make(kWidth, kHeight); } |
30 | 30 |
31 void onDraw(SkCanvas* canvas) 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,
nullptr, |
40 SK_ARRAY_COUN
T(colors), | 40 SK_ARRAY_COUN
T(colors), |
41 SkShader::kMi
rror_TileMode)); | 41 SkShader::kMi
rror_TileMode)); |
42 paint.setShader(grad); | 42 paint.setShader(grad); |
43 | 43 |
44 | 44 |
45 paint.setTextAlign(SkPaint::kRight_Align); | 45 paint.setTextAlign(SkPaint::kRight_Align); |
46 drawTestCase(canvas, "Right Align", kTextHeight, paint); | 46 drawTestCase(canvas, "Right Align", kTextHeight, paint); |
47 | 47 |
48 paint.setTextAlign(SkPaint::kCenter_Align); | 48 paint.setTextAlign(SkPaint::kCenter_Align); |
49 drawTestCase(canvas, "Center Align", 4 * kTextHeight, paint); | 49 drawTestCase(canvas, "Center Align", 4 * kTextHeight, paint); |
(...skipping 37 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 |