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

Side by Side Diff: dm/DMSrcSink.cpp

Issue 859303003: Easy DM TODO: LazyDecodeBitmap does not help (or hinder). (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | gyp/dm.gypi » ('j') | 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 "SkOSFile.h" 6 #include "SkOSFile.h"
7 #include "SkPictureRecorder.h" 7 #include "SkPictureRecorder.h"
8 #include "SkRandom.h" 8 #include "SkRandom.h"
9 #include "SkStream.h" 9 #include "SkStream.h"
10 10
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 ViaPipe::ViaPipe(Sink* sink) : fSink(sink) {} 233 ViaPipe::ViaPipe(Sink* sink) : fSink(sink) {}
234 234
235 Error ViaPipe::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream) const { 235 Error ViaPipe::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream) const {
236 // We turn ourselves into another Src that draws our argument into bitmap/st ream via pipe. 236 // We turn ourselves into another Src that draws our argument into bitmap/st ream via pipe.
237 struct ProxySrc : public Src { 237 struct ProxySrc : public Src {
238 const Src& fSrc; 238 const Src& fSrc;
239 ProxySrc(const Src& src) : fSrc(src) {} 239 ProxySrc(const Src& src) : fSrc(src) {}
240 240
241 Error draw(SkCanvas* canvas) const SK_OVERRIDE { 241 Error draw(SkCanvas* canvas) const SK_OVERRIDE {
242 SkISize size = this->size(); 242 SkISize size = this->size();
243 // TODO: is DecodeMemory really required? Might help RAM usage to be lazy if we can.
244 PipeController controller(canvas, &SkImageDecoder::DecodeMemory); 243 PipeController controller(canvas, &SkImageDecoder::DecodeMemory);
245 SkGPipeWriter pipe; 244 SkGPipeWriter pipe;
246 const uint32_t kFlags = 0; // We mirror SkDeferredCanvas, which does n't use any flags. 245 const uint32_t kFlags = 0; // We mirror SkDeferredCanvas, which does n't use any flags.
247 return fSrc.draw(pipe.startRecording(&controller, kFlags, size.width (), size.height())); 246 return fSrc.draw(pipe.startRecording(&controller, kFlags, size.width (), size.height()));
248 } 247 }
249 SkISize size() const SK_OVERRIDE { return fSrc.size(); } 248 SkISize size() const SK_OVERRIDE { return fSrc.size(); }
250 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 249 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this.
251 } proxy(src); 250 } proxy(src);
252 return fSink->draw(proxy, bitmap, stream); 251 return fSink->draw(proxy, bitmap, stream);
253 } 252 }
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 surfaces.unrefAll(); 348 surfaces.unrefAll();
350 return ""; 349 return "";
351 } 350 }
352 SkISize size() const SK_OVERRIDE { return fSize; } 351 SkISize size() const SK_OVERRIDE { return fSize; }
353 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this. 352 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou ld be calling this.
354 } proxy(fW, fH, pic, src.size()); 353 } proxy(fW, fH, pic, src.size());
355 return fSink->draw(proxy, bitmap, stream); 354 return fSink->draw(proxy, bitmap, stream);
356 } 355 }
357 356
358 } // namespace DM 357 } // namespace DM
OLDNEW
« no previous file with comments | « no previous file | gyp/dm.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698