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 "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkShader.h" | 10 #include "SkShader.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 return SkISize::Make(1990, 660); | 254 return SkISize::Make(1990, 660); |
255 } | 255 } |
256 | 256 |
257 void onDraw(SkCanvas* canvas) override { | 257 void onDraw(SkCanvas* canvas) override { |
258 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); | 258 canvas->translate(SkIntToScalar(10), SkIntToScalar(20)); |
259 | 259 |
260 const SkScalar w = SkIntToScalar(W); | 260 const SkScalar w = SkIntToScalar(W); |
261 const SkScalar h = SkIntToScalar(H); | 261 const SkScalar h = SkIntToScalar(H); |
262 SkMatrix m; | 262 SkMatrix m; |
263 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); | 263 m.setScale(SkIntToScalar(6), SkIntToScalar(6)); |
264 SkShader* s = SkShader::CreateBitmapShader(fBG, | 264 auto s = SkShader::MakeBitmapShader(fBG, SkShader::kRepeat_TileMode, |
265 SkShader::kRepeat_TileMode, | 265 SkShader::kRepeat_TileMode, &m); |
266 SkShader::kRepeat_TileMode, | |
267 &m); | |
268 | 266 |
269 SkPaint labelP; | 267 SkPaint labelP; |
270 labelP.setAntiAlias(true); | 268 labelP.setAntiAlias(true); |
271 sk_tool_utils::set_portable_typeface(&labelP); | 269 sk_tool_utils::set_portable_typeface(&labelP); |
272 labelP.setTextAlign(SkPaint::kCenter_Align); | 270 labelP.setTextAlign(SkPaint::kCenter_Align); |
273 | 271 |
274 const int W = 5; | 272 const int W = 5; |
275 | 273 |
276 SkScalar x0 = 0; | 274 SkScalar x0 = 0; |
277 SkScalar y0 = 0; | 275 SkScalar y0 = 0; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 if (y < 320) { | 316 if (y < 320) { |
319 if (x > x0) { | 317 if (x > x0) { |
320 y += h + SkIntToScalar(30); | 318 y += h + SkIntToScalar(30); |
321 } | 319 } |
322 y0 = y; | 320 y0 = y; |
323 } else { | 321 } else { |
324 x0 += SkIntToScalar(400); | 322 x0 += SkIntToScalar(400); |
325 y0 = 0; | 323 y0 = 0; |
326 } | 324 } |
327 } | 325 } |
328 s->unref(); | |
329 } | 326 } |
330 | 327 |
331 private: | 328 private: |
332 typedef GM INHERITED; | 329 typedef GM INHERITED; |
333 }; | 330 }; |
334 DEF_GM( return new XfermodesGM; ) | 331 DEF_GM( return new XfermodesGM; ) |
OLD | NEW |