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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkAnimTimer.h" | 9 #include "SkAnimTimer.h" |
10 #include "SkView.h" | 10 #include "SkView.h" |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 paint.setStrokeWidth(SkIntToScalar(5)); | 299 paint.setStrokeWidth(SkIntToScalar(5)); |
300 canvas->drawPoints(SkCanvas::kPoints_PointMode, SK_ARRAY_COUNT(fPts), fP
ts, paint); | 300 canvas->drawPoints(SkCanvas::kPoints_PointMode, SK_ARRAY_COUNT(fPts), fP
ts, paint); |
301 | 301 |
302 canvas->translate(0, SkIntToScalar(300)); | 302 canvas->translate(0, SkIntToScalar(300)); |
303 | 303 |
304 paint.setAntiAlias(false); | 304 paint.setAntiAlias(false); |
305 paint.setShader(fShader1); | 305 paint.setShader(fShader1); |
306 if (true) { | 306 if (true) { |
307 SkMatrix m; | 307 SkMatrix m; |
308 m.setSkew(1, 0); | 308 m.setSkew(1, 0); |
309 SkShader* s = SkShader::CreateLocalMatrixShader(paint.getShader(), m
); | 309 SkShader* s = paint.getShader()->newWithLocalMatrix(m); |
310 paint.setShader(s)->unref(); | 310 paint.setShader(s)->unref(); |
311 } | 311 } |
312 if (true) { | 312 if (true) { |
313 SkMatrix m; | 313 SkMatrix m; |
314 m.setRotate(fAngle); | 314 m.setRotate(fAngle); |
315 SkShader* s = SkShader::CreateLocalMatrixShader(paint.getShader(), m
); | 315 SkShader* s = paint.getShader()->newWithLocalMatrix(m); |
316 paint.setShader(s)->unref(); | 316 paint.setShader(s)->unref(); |
317 } | 317 } |
318 patch.setBounds(fSize1.fX, fSize1.fY); | 318 patch.setBounds(fSize1.fX, fSize1.fY); |
319 drawpatches(canvas, paint, nu, nv, &patch); | 319 drawpatches(canvas, paint, nu, nv, &patch); |
320 } | 320 } |
321 | 321 |
322 bool onAnimate(const SkAnimTimer& timer) override { | 322 bool onAnimate(const SkAnimTimer& timer) override { |
323 fAngle = timer.scaled(60, 360); | 323 fAngle = timer.scaled(60, 360); |
324 return true; | 324 return true; |
325 } | 325 } |
(...skipping 26 matching lines...) Expand all Loading... |
352 } | 352 } |
353 | 353 |
354 private: | 354 private: |
355 typedef SampleView INHERITED; | 355 typedef SampleView INHERITED; |
356 }; | 356 }; |
357 | 357 |
358 ////////////////////////////////////////////////////////////////////////////// | 358 ////////////////////////////////////////////////////////////////////////////// |
359 | 359 |
360 static SkView* MyFactory() { return new PatchView; } | 360 static SkView* MyFactory() { return new PatchView; } |
361 static SkViewRegister reg(MyFactory); | 361 static SkViewRegister reg(MyFactory); |
OLD | NEW |