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

Side by Side Diff: gm/megalooper.cpp

Issue 18461007: Fix two leaks & improve leak tracking (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 5 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/gm_expectations.cpp ('k') | include/core/SkDocument.h » ('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 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 "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkBlurMaskFilter.h" 10 #include "SkBlurMaskFilter.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 // while a difference clip stays at the location of the original rect. 124 // while a difference clip stays at the location of the original rect.
125 // Each blurred rect is drawn with a draw looper where the original (non- 125 // Each blurred rect is drawn with a draw looper where the original (non-
126 // blurred rect) is offset to reside outside of the large outer clip (so 126 // blurred rect) is offset to reside outside of the large outer clip (so
127 // it never appears) but the offset in the draw looper is used to translate 127 // it never appears) but the offset in the draw looper is used to translate
128 // the blurred version back into the clip. 128 // the blurred version back into the clip.
129 void draw4x1(SkCanvas* canvas, SkScalar x, SkScalar y) { 129 void draw4x1(SkCanvas* canvas, SkScalar x, SkScalar y) {
130 130
131 for (int i = 0; i < 4; ++i) { 131 for (int i = 0; i < 4; ++i) {
132 SkPaint loopPaint; 132 SkPaint loopPaint;
133 133
134 loopPaint.setLooper(create1Looper(-kOffsetToOutsideClip, 0, gColors[ i])); 134 loopPaint.setLooper(create1Looper(-kOffsetToOutsideClip, 0, gColors[ i]))->unref();
135 loopPaint.setAntiAlias(true); 135 loopPaint.setAntiAlias(true);
136 136
137 SkRect outerClip = { 137 SkRect outerClip = {
138 -kHalfOuterClipSize, -kHalfOuterClipSize, 138 -kHalfOuterClipSize, -kHalfOuterClipSize,
139 kHalfOuterClipSize, kHalfOuterClipSize 139 kHalfOuterClipSize, kHalfOuterClipSize
140 }; 140 };
141 outerClip.offset(x, y); 141 outerClip.offset(x, y);
142 // center it on the blurred rect 142 // center it on the blurred rect
143 outerClip.offset(gBlurOffsets[i]); 143 outerClip.offset(gBlurOffsets[i]);
144 144
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 rect.offset(x, y); 187 rect.offset(x, y);
188 188
189 SkRect outerClip = { 189 SkRect outerClip = {
190 -kHalfOuterClipSize-kHalfSquareSize, -kHalfOuterClipSize-kHalfSquare Size, 190 -kHalfOuterClipSize-kHalfSquareSize, -kHalfOuterClipSize-kHalfSquare Size,
191 kHalfOuterClipSize+kHalfSquareSize, kHalfOuterClipSize+kHalfSquare Size 191 kHalfOuterClipSize+kHalfSquareSize, kHalfOuterClipSize+kHalfSquare Size
192 }; 192 };
193 outerClip.offset(x, y); 193 outerClip.offset(x, y);
194 194
195 SkPaint paint; 195 SkPaint paint;
196 paint.setAntiAlias(true); 196 paint.setAntiAlias(true);
197 paint.setLooper(create4Looper(-kOffsetToOutsideClip-kHalfSquareSize, 0)) ; 197 paint.setLooper(create4Looper(-kOffsetToOutsideClip-kHalfSquareSize, 0)) ->unref();
198 198
199 canvas->save(); 199 canvas->save();
200 canvas->clipRect(outerClip, SkRegion::kIntersect_Op); 200 canvas->clipRect(outerClip, SkRegion::kIntersect_Op);
201 canvas->clipRect(rect, SkRegion::kDifference_Op); 201 canvas->clipRect(rect, SkRegion::kDifference_Op);
202 202
203 rect.offset(SkIntToScalar(kOffsetToOutsideClip+kHalfSquareSize), 0); 203 rect.offset(SkIntToScalar(kOffsetToOutsideClip+kHalfSquareSize), 0);
204 canvas->drawRect(rect, paint); 204 canvas->drawRect(rect, paint);
205 canvas->restore(); 205 canvas->restore();
206 } 206 }
207 207
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 { -kHalfSquareSize, -kHalfSquareSize } 241 { -kHalfSquareSize, -kHalfSquareSize }
242 }; 242 };
243 243
244 const SkColor MegaLooperGM::gColors[4] = { 244 const SkColor MegaLooperGM::gColors[4] = {
245 SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED 245 SK_ColorGREEN, SK_ColorYELLOW, SK_ColorBLUE, SK_ColorRED
246 }; 246 };
247 247
248 DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); ) 248 DEF_GM( return new MegaLooperGM(MegaLooperGM::k0x0_Type); )
249 DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); ) 249 DEF_GM( return new MegaLooperGM(MegaLooperGM::k4x1_Type); )
250 DEF_GM( return new MegaLooperGM(MegaLooperGM::k1x4_Type); ) 250 DEF_GM( return new MegaLooperGM(MegaLooperGM::k1x4_Type); )
OLDNEW
« no previous file with comments | « gm/gm_expectations.cpp ('k') | include/core/SkDocument.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698