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

Side by Side Diff: bench/SKPBench.cpp

Issue 730343003: Fix memory leak in nanobench (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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
« 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 2014 Google Inc. 2 * Copyright 2014 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 "SKPBench.h" 8 #include "SKPBench.h"
9 #include "SkCommandLineFlags.h" 9 #include "SkCommandLineFlags.h"
10 #include "SkMultiPictureDraw.h" 10 #include "SkMultiPictureDraw.h"
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } 66 }
67 67
68 void SKPBench::onPerCanvasPostDraw(SkCanvas* canvas) { 68 void SKPBench::onPerCanvasPostDraw(SkCanvas* canvas) {
69 if (!fUseMultiPictureDraw) { 69 if (!fUseMultiPictureDraw) {
70 return; 70 return;
71 } 71 }
72 72
73 // Draw the last set of tiles into the master canvas in case we're 73 // Draw the last set of tiles into the master canvas in case we're
74 // saving the images 74 // saving the images
75 for (int i = 0; i < fTileRects.count(); ++i) { 75 for (int i = 0; i < fTileRects.count(); ++i) {
76 canvas->drawImage(fSurfaces[i]->newImageSnapshot(), 76 SkAutoTUnref<SkImage> image(fSurfaces[i]->newImageSnapshot());
77 canvas->drawImage(image,
77 SkIntToScalar(fTileRects[i].fLeft), SkIntToScalar(fTil eRects[i].fTop)); 78 SkIntToScalar(fTileRects[i].fLeft), SkIntToScalar(fTil eRects[i].fTop));
78 SkSafeSetNull(fSurfaces[i]); 79 SkSafeSetNull(fSurfaces[i]);
79 } 80 }
80 81
81 fSurfaces.rewind(); 82 fSurfaces.rewind();
82 fTileRects.rewind(); 83 fTileRects.rewind();
83 } 84 }
84 85
85 bool SKPBench::isSuitableFor(Backend backend) { 86 bool SKPBench::isSuitableFor(Backend backend) {
86 return backend != kNonRendering_Backend; 87 return backend != kNonRendering_Backend;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 canvas->clipRect(SkRect::Make( 123 canvas->clipRect(SkRect::Make(
123 SkIRect::MakeXYWH(x, y, FLAGS_benchTile, FLAGS_b enchTile))); 124 SkIRect::MakeXYWH(x, y, FLAGS_benchTile, FLAGS_b enchTile)));
124 fPic->playback(canvas); 125 fPic->playback(canvas);
125 } 126 }
126 } 127 }
127 128
128 canvas->flush(); 129 canvas->flush();
129 } 130 }
130 } 131 }
131 } 132 }
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