Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: samplecode/SamplePatch.cpp

Issue 1782703002: sk_sp versions of newWithColorFilter and newWithLocalMatrix (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkShader.h ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 paint.setStrokeWidth(SkIntToScalar(5)); 282 paint.setStrokeWidth(SkIntToScalar(5));
283 canvas->drawPoints(SkCanvas::kPoints_PointMode, SK_ARRAY_COUNT(fPts), fP ts, paint); 283 canvas->drawPoints(SkCanvas::kPoints_PointMode, SK_ARRAY_COUNT(fPts), fP ts, paint);
284 284
285 canvas->translate(0, SkIntToScalar(300)); 285 canvas->translate(0, SkIntToScalar(300));
286 286
287 paint.setAntiAlias(false); 287 paint.setAntiAlias(false);
288 paint.setShader(fShader1); 288 paint.setShader(fShader1);
289 if (true) { 289 if (true) {
290 SkMatrix m; 290 SkMatrix m;
291 m.setSkew(1, 0); 291 m.setSkew(1, 0);
292 SkShader* s = paint.getShader()->newWithLocalMatrix(m); 292 paint.setShader(paint.getShader()->makeWithLocalMatrix(m));
293 paint.setShader(s)->unref();
294 } 293 }
295 if (true) { 294 if (true) {
296 SkMatrix m; 295 SkMatrix m;
297 m.setRotate(fAngle); 296 m.setRotate(fAngle);
298 SkShader* s = paint.getShader()->newWithLocalMatrix(m); 297 paint.setShader(paint.getShader()->makeWithLocalMatrix(m));
299 paint.setShader(s)->unref();
300 } 298 }
301 patch.setBounds(fSize1.fX, fSize1.fY); 299 patch.setBounds(fSize1.fX, fSize1.fY);
302 drawpatches(canvas, paint, nu, nv, &patch); 300 drawpatches(canvas, paint, nu, nv, &patch);
303 } 301 }
304 302
305 bool onAnimate(const SkAnimTimer& timer) override { 303 bool onAnimate(const SkAnimTimer& timer) override {
306 fAngle = timer.scaled(60, 360); 304 fAngle = timer.scaled(60, 360);
307 return true; 305 return true;
308 } 306 }
309 307
(...skipping 25 matching lines...) Expand all
335 } 333 }
336 334
337 private: 335 private:
338 typedef SampleView INHERITED; 336 typedef SampleView INHERITED;
339 }; 337 };
340 338
341 ////////////////////////////////////////////////////////////////////////////// 339 //////////////////////////////////////////////////////////////////////////////
342 340
343 static SkView* MyFactory() { return new PatchView; } 341 static SkView* MyFactory() { return new PatchView; }
344 static SkViewRegister reg(MyFactory); 342 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/core/SkShader.h ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698