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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 922293003: DM: don't leak the null canvas in NullSink. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 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 | « dm/DMSrcSink.h ('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 #include "DMSrcSink.h" 1 #include "DMSrcSink.h"
2 #include "SamplePipeControllers.h" 2 #include "SamplePipeControllers.h"
3 #include "SkCommonFlags.h" 3 #include "SkCommonFlags.h"
4 #include "SkDocument.h" 4 #include "SkDocument.h"
5 #include "SkMultiPictureDraw.h" 5 #include "SkMultiPictureDraw.h"
6 #include "SkNullCanvas.h"
6 #include "SkOSFile.h" 7 #include "SkOSFile.h"
7 #include "SkPictureRecorder.h" 8 #include "SkPictureRecorder.h"
8 #include "SkRandom.h" 9 #include "SkRandom.h"
9 #include "SkSVGCanvas.h" 10 #include "SkSVGCanvas.h"
10 #include "SkStream.h" 11 #include "SkStream.h"
11 #include "SkXMLWriter.h" 12 #include "SkXMLWriter.h"
12 13
13 namespace DM { 14 namespace DM {
14 15
15 GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {} 16 GMSrc::GMSrc(skiagm::GMRegistry::Factory factory) : fFactory(factory) {}
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 126
126 SkISize SKPSrc::size() const { 127 SkISize SKPSrc::size() const {
127 // This may be unnecessarily large. 128 // This may be unnecessarily large.
128 return kSKPViewport.roundOut().size(); 129 return kSKPViewport.roundOut().size();
129 } 130 }
130 131
131 Name SKPSrc::name() const { return SkOSPath::Basename(fPath.c_str()); } 132 Name SKPSrc::name() const { return SkOSPath::Basename(fPath.c_str()); }
132 133
133 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/ 134 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
134 135
136 Error NullSink::draw(const Src& src, SkBitmap*, SkWStream*, SkString*) const {
137 SkAutoTDelete<SkCanvas> canvas(SkCreateNullCanvas());
138 return src.draw(canvas);
139 }
140
141 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~*/
142
135 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?"); 143 DEFINE_bool(gpuStats, false, "Append GPU stats to the log for each GPU task?");
136 144
137 GPUSink::GPUSink(GrContextFactory::GLContextType ct, 145 GPUSink::GPUSink(GrContextFactory::GLContextType ct,
138 GrGLStandard api, 146 GrGLStandard api,
139 int samples, 147 int samples,
140 bool dfText, 148 bool dfText,
141 bool threaded) 149 bool threaded)
142 : fContextType(ct) 150 : fContextType(ct)
143 , fGpuAPI(api) 151 , fGpuAPI(api)
144 , fSampleCount(samples) 152 , fSampleCount(samples)
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 surfaces.unrefAll(); 411 surfaces.unrefAll();
404 return ""; 412 return "";
405 } 413 }
406 SkISize size() const SK_OVERRIDE { return fSize; } 414 SkISize size() const SK_OVERRIDE { return fSize; }
407 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 415 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this.
408 } proxy(fW, fH, pic, src.size()); 416 } proxy(fW, fH, pic, src.size());
409 return fSink->draw(proxy, bitmap, stream, log); 417 return fSink->draw(proxy, bitmap, stream, log);
410 } 418 }
411 419
412 } // namespace DM 420 } // namespace DM
OLDNEW
« no previous file with comments | « dm/DMSrcSink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698