OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 | 8 |
9 /* | 9 /* |
10 * Tests text rendering with LCD and the various blend modes. | 10 * Tests text rendering with LCD and the various blend modes. |
11 */ | 11 */ |
12 | 12 |
13 #include "gm.h" | 13 #include "gm.h" |
14 #include "SkCanvas.h" | 14 #include "SkCanvas.h" |
15 #include "SkGradientShader.h" | 15 #include "SkGradientShader.h" |
16 #include "SkSurface.h" | 16 #include "SkSurface.h" |
17 | 17 |
18 namespace skiagm { | 18 namespace skiagm { |
19 | 19 |
20 static const int kColWidth = 180; | 20 constexpr int kColWidth = 180; |
21 static const int kNumCols = 4; | 21 constexpr int kNumCols = 4; |
22 static const int kWidth = kColWidth * kNumCols; | 22 constexpr int kWidth = kColWidth * kNumCols; |
23 static const int kHeight = 750; | 23 constexpr int kHeight = 750; |
24 | 24 |
25 static sk_sp<SkShader> make_shader(const SkRect& bounds) { | 25 static sk_sp<SkShader> make_shader(const SkRect& bounds) { |
26 const SkPoint pts[] = { | 26 const SkPoint pts[] = { |
27 { bounds.left(), bounds.top() }, | 27 { bounds.left(), bounds.top() }, |
28 { bounds.right(), bounds.bottom() }, | 28 { bounds.right(), bounds.bottom() }, |
29 }; | 29 }; |
30 const SkColor colors[] = { | 30 const SkColor colors[] = { |
31 SK_ColorRED, SK_ColorGREEN, | 31 SK_ColorRED, SK_ColorGREEN, |
32 }; | 32 }; |
33 return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(col
ors), | 33 return SkGradientShader::MakeLinear(pts, colors, nullptr, SK_ARRAY_COUNT(col
ors), |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 private: | 144 private: |
145 SkScalar fTextHeight; | 145 SkScalar fTextHeight; |
146 sk_sp<SkShader> fCheckerboard; | 146 sk_sp<SkShader> fCheckerboard; |
147 typedef skiagm::GM INHERITED; | 147 typedef skiagm::GM INHERITED; |
148 }; | 148 }; |
149 | 149 |
150 ////////////////////////////////////////////////////////////////////////////// | 150 ////////////////////////////////////////////////////////////////////////////// |
151 | 151 |
152 DEF_GM( return new LcdBlendGM; ) | 152 DEF_GM( return new LcdBlendGM; ) |
153 } | 153 } |
OLD | NEW |