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

Side by Side Diff: gm/offsetimagefilter.cpp

Issue 1203613004: Fix memory leak in simple-offsetimagefilter (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "SkBitmapSource.h" 9 #include "SkBitmapSource.h"
10 #include "SkOffsetImageFilter.h" 10 #include "SkOffsetImageFilter.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 p.setStyle(SkPaint::kFill_Style); 136 p.setStyle(SkPaint::kFill_Style);
137 } 137 }
138 138
139 p.setColor(0x660000FF); 139 p.setColor(0x660000FF);
140 canvas->drawRect(r, p); 140 canvas->drawRect(r, p);
141 141
142 if (clipR) { 142 if (clipR) {
143 canvas->save(); 143 canvas->save();
144 canvas->clipRect(*clipR); 144 canvas->clipRect(*clipR);
145 } 145 }
146 p.setImageFilter(imgf); 146 if (imgf) {
147 p.setImageFilter(imgf)->unref();
148 }
147 p.setColor(0x66FF0000); 149 p.setColor(0x66FF0000);
148 canvas->drawRect(r, p); 150 canvas->drawRect(r, p);
149 151
150 if (clipR) { 152 if (clipR) {
151 canvas->restore(); 153 canvas->restore();
152 } 154 }
153 } 155 }
154 156
155 void onDraw(SkCanvas* canvas) override { 157 void onDraw(SkCanvas* canvas) override {
156 const SkRect r = SkRect::MakeWH(10, 10); 158 const SkRect r = SkRect::MakeWH(10, 10);
(...skipping 22 matching lines...) Expand all
179 this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5, NULL, NULL), & clipR); 181 this->doDraw(canvas, r, SkOffsetImageFilter::Create(5, 5, NULL, NULL), & clipR);
180 182
181 canvas->translate(20, 0); 183 canvas->translate(20, 0);
182 this->doDraw(canvas, r, SkOffsetImageFilter::Create(10, 0, NULL, &cr2), NULL); 184 this->doDraw(canvas, r, SkOffsetImageFilter::Create(10, 0, NULL, &cr2), NULL);
183 } 185 }
184 186
185 private: 187 private:
186 typedef skiagm::GM INHERITED; 188 typedef skiagm::GM INHERITED;
187 }; 189 };
188 DEF_GM( return new SimpleOffsetImageFilterGM; ) 190 DEF_GM( return new SimpleOffsetImageFilterGM; )
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698