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

Side by Side Diff: gm/dcshader.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 Created 4 years, 8 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 | « bench/ShaderMaskBench.cpp ('k') | gm/discard.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 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 8
9 #include "gm.h" 9 #include "gm.h"
10 #if SK_SUPPORT_GPU 10 #if SK_SUPPORT_GPU
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 canvas->translate(10, 20); 251 canvas->translate(10, 20);
252 canvas->save(); 252 canvas->save();
253 SkScalar tx = 0, maxTy = 0; 253 SkScalar tx = 0, maxTy = 0;
254 static const SkScalar kW = 900; 254 static const SkScalar kW = 900;
255 255
256 for (int aa = 0; aa < 2; ++aa) { 256 for (int aa = 0; aa < 2; ++aa) {
257 for (int i = 0; i < fPrims.count(); ++i) { 257 for (int i = 0; i < fPrims.count(); ++i) {
258 for (int j = 0; j < devMats.count(); ++j) { 258 for (int j = 0; j < devMats.count(); ++j) {
259 for (int k = 0; k < viewMats.count(); ++k) { 259 for (int k = 0; k < viewMats.count(); ++k) {
260 paint.setShader(new DCShader(devMats[j]))->unref(); 260 paint.setShader(sk_make_sp<DCShader>(devMats[j]));
261 paint.setAntiAlias(SkToBool(aa)); 261 paint.setAntiAlias(SkToBool(aa));
262 canvas->save(); 262 canvas->save();
263 canvas->concat(viewMats[k]); 263 canvas->concat(viewMats[k]);
264 SkRect bounds = fPrims[i]->draw(canvas, paint); 264 SkRect bounds = fPrims[i]->draw(canvas, paint);
265 canvas->restore(); 265 canvas->restore();
266 viewMats[k].mapRect(&bounds); 266 viewMats[k].mapRect(&bounds);
267 // add margins 267 // add margins
268 bounds.fRight += 20; 268 bounds.fRight += 20;
269 bounds.fBottom += 20; 269 bounds.fBottom += 20;
270 canvas->translate(bounds.fRight, 0); 270 canvas->translate(bounds.fRight, 0);
(...skipping 20 matching lines...) Expand all
291 }; 291 };
292 292
293 SkTArray<Prim*> fPrims; 293 SkTArray<Prim*> fPrims;
294 294
295 typedef GM INHERITED; 295 typedef GM INHERITED;
296 }; 296 };
297 297
298 DEF_GM(return new DCShaderGM;) 298 DEF_GM(return new DCShaderGM;)
299 } 299 }
300 #endif 300 #endif
OLDNEW
« no previous file with comments | « bench/ShaderMaskBench.cpp ('k') | gm/discard.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698