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

Side by Side Diff: samplecode/SampleLayers.cpp

Issue 72603005: Guard against most unintentionally ephemeral SkAutoFoo instantiations. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo autoasciitolc Created 7 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « include/core/SkUtils.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 /* 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 "SampleCode.h" 8 #include "SampleCode.h"
9 #include "SkView.h" 9 #include "SkView.h"
10 #include "SkCanvas.h" 10 #include "SkCanvas.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 54
55 // test drawing with strips of fading gradient above and below 55 // test drawing with strips of fading gradient above and below
56 static void test_fade(SkCanvas* canvas) { 56 static void test_fade(SkCanvas* canvas) {
57 SkAutoCanvasRestore ar(canvas, true); 57 SkAutoCanvasRestore ar(canvas, true);
58 58
59 SkRect r; 59 SkRect r;
60 60
61 SkPaint p; 61 SkPaint p;
62 p.setAlpha(0x88); 62 p.setAlpha(0x88);
63 63
64 SkAutoCanvasRestore(canvas, false); 64 SkAutoCanvasRestore ar2(canvas, false);
65 65
66 // create the layers 66 // create the layers
67 67
68 r.set(0, 0, SkIntToScalar(100), SkIntToScalar(100)); 68 r.set(0, 0, SkIntToScalar(100), SkIntToScalar(100));
69 canvas->clipRect(r); 69 canvas->clipRect(r);
70 70
71 r.fBottom = SkIntToScalar(20); 71 r.fBottom = SkIntToScalar(20);
72 canvas->saveLayer(&r, NULL, (SkCanvas::SaveFlags)(SkCanvas::kHasAlphaLayer_S aveFlag | SkCanvas::kFullColorLayer_SaveFlag)); 72 canvas->saveLayer(&r, NULL, (SkCanvas::SaveFlags)(SkCanvas::kHasAlphaLayer_S aveFlag | SkCanvas::kFullColorLayer_SaveFlag));
73 73
74 r.fTop = SkIntToScalar(80); 74 r.fTop = SkIntToScalar(80);
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 } 266 }
267 267
268 private: 268 private:
269 typedef SkView INHERITED; 269 typedef SkView INHERITED;
270 }; 270 };
271 271
272 ////////////////////////////////////////////////////////////////////////////// 272 //////////////////////////////////////////////////////////////////////////////
273 273
274 static SkView* MyFactory() { return new LayersView; } 274 static SkView* MyFactory() { return new LayersView; }
275 static SkViewRegister reg(MyFactory); 275 static SkViewRegister reg(MyFactory);
OLDNEW
« no previous file with comments | « include/core/SkUtils.h ('k') | src/core/SkBlitter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698