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 "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 80 |
81 static const GradMaker gGradMakers[] = { | 81 static const GradMaker gGradMakers[] = { |
82 MakeLinear, MakeRadial, MakeSweep, Make2Conical | 82 MakeLinear, MakeRadial, MakeSweep, Make2Conical |
83 }; | 83 }; |
84 | 84 |
85 /////////////////////////////////////////////////////////////////////////////// | 85 /////////////////////////////////////////////////////////////////////////////// |
86 | 86 |
87 class ShaderTextGM : public GM { | 87 class ShaderTextGM : public GM { |
88 public: | 88 public: |
89 ShaderTextGM() { | 89 ShaderTextGM() { |
90 this->setBGColor(sk_tool_utils::color_to_565(0xFFDDDDDD)); | 90 this->setBGColor(0xFFDDDDDD); |
91 } | 91 } |
92 | 92 |
93 protected: | 93 protected: |
94 | 94 |
95 SkString onShortName() override { | 95 SkString onShortName() override { |
96 return SkString("shadertext"); | 96 return SkString("shadertext"); |
97 } | 97 } |
98 | 98 |
99 SkISize onISize() override { return SkISize::Make(1450, 500); } | 99 SkISize onISize() override { return SkISize::Make(1450, 500); } |
100 | 100 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 makebm(&bm, w/16, h/4); | 137 makebm(&bm, w/16, h/4); |
138 for (size_t tx = 0; tx < SK_ARRAY_COUNT(tileModes); ++tx) { | 138 for (size_t tx = 0; tx < SK_ARRAY_COUNT(tileModes); ++tx) { |
139 for (size_t ty = 0; ty < SK_ARRAY_COUNT(tileModes); ++ty) { | 139 for (size_t ty = 0; ty < SK_ARRAY_COUNT(tileModes); ++ty) { |
140 shaders[shdIdx++] = SkShader::CreateBitmapShader(bm, tileModes[t
x], tileModes[ty]); | 140 shaders[shdIdx++] = SkShader::CreateBitmapShader(bm, tileModes[t
x], tileModes[ty]); |
141 } | 141 } |
142 } | 142 } |
143 | 143 |
144 SkPaint paint; | 144 SkPaint paint; |
145 paint.setDither(true); | 145 paint.setDither(true); |
146 paint.setAntiAlias(true); | 146 paint.setAntiAlias(true); |
147 sk_tool_utils::set_portable_typeface_always(&paint); | 147 sk_tool_utils::set_portable_typeface(&paint); |
148 paint.setTextSize(SkIntToScalar(pointSize)); | 148 paint.setTextSize(SkIntToScalar(pointSize)); |
149 | 149 |
150 canvas->save(); | 150 canvas->save(); |
151 canvas->translate(SkIntToScalar(20), SkIntToScalar(10)); | 151 canvas->translate(SkIntToScalar(20), SkIntToScalar(10)); |
152 | 152 |
153 SkPath path; | 153 SkPath path; |
154 path.arcTo(SkRect::MakeXYWH(SkIntToScalar(-40), SkIntToScalar(15), | 154 path.arcTo(SkRect::MakeXYWH(SkIntToScalar(-40), SkIntToScalar(15), |
155 SkIntToScalar(300), SkIntToScalar(90)), | 155 SkIntToScalar(300), SkIntToScalar(90)), |
156 SkIntToScalar(225), SkIntToScalar(90), | 156 SkIntToScalar(225), SkIntToScalar(90), |
157 false); | 157 false); |
(...skipping 24 matching lines...) Expand all Loading... |
182 | 182 |
183 private: | 183 private: |
184 typedef GM INHERITED; | 184 typedef GM INHERITED; |
185 }; | 185 }; |
186 | 186 |
187 /////////////////////////////////////////////////////////////////////////////// | 187 /////////////////////////////////////////////////////////////////////////////// |
188 | 188 |
189 static GM* MyFactory(void*) { return new ShaderTextGM; } | 189 static GM* MyFactory(void*) { return new ShaderTextGM; } |
190 static GMRegistry reg(MyFactory); | 190 static GMRegistry reg(MyFactory); |
191 } | 191 } |
OLD | NEW |