OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 #include "gm.h" | 8 #include "gm.h" |
9 #include "SkPath.h" | 9 #include "SkPath.h" |
10 #include "SkRegion.h" | 10 #include "SkRegion.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 | 168 |
169 static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) { | 169 static SkShader* make_grad(SkShader::TileMode tx, SkShader::TileMode ty) { |
170 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(gWidth), SkIntToScalar(gHeight)}
}; | 170 SkPoint pts[] = { { 0, 0 }, { SkIntToScalar(gWidth), SkIntToScalar(gHeight)}
}; |
171 SkPoint center = { SkIntToScalar(gWidth)/2, SkIntToScalar(gHeight)/2 }; | 171 SkPoint center = { SkIntToScalar(gWidth)/2, SkIntToScalar(gHeight)/2 }; |
172 SkScalar rad = SkIntToScalar(gWidth)/2; | 172 SkScalar rad = SkIntToScalar(gWidth)/2; |
173 SkColor colors[] = { 0xFFFF0000, sk_tool_utils::color_to_565(0xFF0044FF) }; | 173 SkColor colors[] = { 0xFFFF0000, sk_tool_utils::color_to_565(0xFF0044FF) }; |
174 | 174 |
175 int index = (int)ty; | 175 int index = (int)ty; |
176 switch (index % 3) { | 176 switch (index % 3) { |
177 case 0: | 177 case 0: |
178 return SkGradientShader::CreateLinear(pts, colors, NULL, SK_ARRAY_CO
UNT(colors), tx); | 178 return SkGradientShader::CreateLinear(pts, colors, nullptr, SK_ARRAY
_COUNT(colors), tx); |
179 case 1: | 179 case 1: |
180 return SkGradientShader::CreateRadial(center, rad, colors, NULL, SK_
ARRAY_COUNT(colors), tx); | 180 return SkGradientShader::CreateRadial(center, rad, colors, nullptr,
SK_ARRAY_COUNT(colors), tx); |
181 case 2: | 181 case 2: |
182 return SkGradientShader::CreateSweep(center.fX, center.fY, colors, N
ULL, SK_ARRAY_COUNT(colors)); | 182 return SkGradientShader::CreateSweep(center.fX, center.fY, colors, n
ullptr, SK_ARRAY_COUNT(colors)); |
183 } | 183 } |
184 | 184 |
185 return NULL; | 185 return nullptr; |
186 } | 186 } |
187 | 187 |
188 typedef SkShader* (*ShaderProc)(SkShader::TileMode, SkShader::TileMode); | 188 typedef SkShader* (*ShaderProc)(SkShader::TileMode, SkShader::TileMode); |
189 | 189 |
190 class ScaledTiling2GM : public skiagm::GM { | 190 class ScaledTiling2GM : public skiagm::GM { |
191 ShaderProc fProc; | 191 ShaderProc fProc; |
192 SkString fName; | 192 SkString fName; |
193 public: | 193 public: |
194 ScaledTiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { | 194 ScaledTiling2GM(ShaderProc proc, const char name[]) : fProc(proc) { |
195 fName.printf("scaled_tilemode_%s", name); | 195 fName.printf("scaled_tilemode_%s", name); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 private: | 259 private: |
260 typedef skiagm::GM INHERITED; | 260 typedef skiagm::GM INHERITED; |
261 }; | 261 }; |
262 | 262 |
263 ////////////////////////////////////////////////////////////////////////////// | 263 ////////////////////////////////////////////////////////////////////////////// |
264 | 264 |
265 DEF_GM( return new ScaledTilingGM(true); ) | 265 DEF_GM( return new ScaledTilingGM(true); ) |
266 DEF_GM( return new ScaledTilingGM(false); ) | 266 DEF_GM( return new ScaledTilingGM(false); ) |
267 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) | 267 DEF_GM( return new ScaledTiling2GM(make_bm, "bitmap"); ) |
268 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) | 268 DEF_GM( return new ScaledTiling2GM(make_grad, "gradient"); ) |
OLD | NEW |