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

Side by Side Diff: gm/shallowgradient.cpp

Issue 12703044: Fix minor memory leaks (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « gm/dashing.cpp ('k') | no next file » | 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 2013 Google Inc. 2 * Copyright 2013 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 "SkGradientShader.h" 9 #include "SkGradientShader.h"
10 10
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 } 51 }
52 52
53 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE { 53 virtual void onDraw(SkCanvas* canvas) SK_OVERRIDE {
54 const SkColor colors[] = { 0xFF555555, 0xFF444444 }; 54 const SkColor colors[] = { 0xFF555555, 0xFF444444 };
55 const int colorCount = SK_ARRAY_COUNT(colors); 55 const int colorCount = SK_ARRAY_COUNT(colors);
56 56
57 SkRect r = { 0, 0, this->width(), this->height() }; 57 SkRect r = { 0, 0, this->width(), this->height() };
58 SkSize size = SkSize::Make(r.width(), r.height()); 58 SkSize size = SkSize::Make(r.width(), r.height());
59 59
60 SkPaint paint; 60 SkPaint paint;
61 paint.setShader(fProc(colors, colorCount, size)); 61 paint.setShader(fProc(colors, colorCount, size))->unref();
62 canvas->drawRect(r, paint); 62 canvas->drawRect(r, paint);
63 } 63 }
64 64
65 private: 65 private:
66 MakeShaderProc fProc; 66 MakeShaderProc fProc;
67 SkString fName; 67 SkString fName;
68 68
69 typedef skiagm::GM INHERITED; 69 typedef skiagm::GM INHERITED;
70 }; 70 };
71 71
72 /////////////////////////////////////////////////////////////////////////////// 72 ///////////////////////////////////////////////////////////////////////////////
73 73
74 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); ) 74 DEF_GM( return new ShallowGradientGM(shader_linear, "linear"); )
75 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); ) 75 DEF_GM( return new ShallowGradientGM(shader_radial, "radial"); )
76 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); ) 76 DEF_GM( return new ShallowGradientGM(shader_conical, "conical"); )
77 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); ) 77 DEF_GM( return new ShallowGradientGM(shader_sweep, "sweep"); )
OLDNEW
« no previous file with comments | « gm/dashing.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698