| OLD | NEW |
| 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 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 return fSrc.draw(canvas); | 223 return fSrc.draw(canvas); |
| 224 } | 224 } |
| 225 SkISize size() const SK_OVERRIDE { return fSrc.size(); } | 225 SkISize size() const SK_OVERRIDE { return fSrc.size(); } |
| 226 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. | 226 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. |
| 227 } proxy(src, fMatrix); | 227 } proxy(src, fMatrix); |
| 228 return fSink->draw(proxy, bitmap, stream); | 228 return fSink->draw(proxy, bitmap, stream); |
| 229 } | 229 } |
| 230 | 230 |
| 231 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 231 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 232 | 232 |
| 233 ViaPipe::ViaPipe(int flags, Sink* sink) : fFlags((SkGPipeWriter::Flags)flags), f
Sink(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 our arguments into a Src, then draw that Src into our Sink to fil
l bitmap or stream. | 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 SkGPipeWriter::Flags fFlags; | 239 ProxySrc(const Src& src) : fSrc(src) {} |
| 240 ProxySrc(const Src& src, SkGPipeWriter::Flags flags) : fSrc(src), fFlags
(flags) {} | |
| 241 | 240 |
| 242 Error draw(SkCanvas* canvas) const SK_OVERRIDE { | 241 Error draw(SkCanvas* canvas) const SK_OVERRIDE { |
| 243 SkISize size = this->size(); | 242 SkISize size = this->size(); |
| 244 // TODO: is DecodeMemory really required? Might help RAM usage to be
lazy if we can. | 243 // TODO: is DecodeMemory really required? Might help RAM usage to be
lazy if we can. |
| 245 PipeController controller(canvas, &SkImageDecoder::DecodeMemory); | 244 PipeController controller(canvas, &SkImageDecoder::DecodeMemory); |
| 246 SkGPipeWriter pipe; | 245 SkGPipeWriter pipe; |
| 247 return fSrc.draw(pipe.startRecording(&controller, fFlags, size.width
(), size.height())); | 246 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())); |
| 248 } | 248 } |
| 249 SkISize size() const SK_OVERRIDE { return fSrc.size(); } | 249 SkISize size() const SK_OVERRIDE { return fSrc.size(); } |
| 250 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. | 250 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. |
| 251 } proxy(src, fFlags); | 251 } proxy(src); |
| 252 return fSink->draw(proxy, bitmap, stream); | 252 return fSink->draw(proxy, bitmap, stream); |
| 253 } | 253 } |
| 254 | 254 |
| 255 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 255 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
| 256 | 256 |
| 257 ViaSerialization::ViaSerialization(Sink* sink) : fSink(sink) {} | 257 ViaSerialization::ViaSerialization(Sink* sink) : fSink(sink) {} |
| 258 | 258 |
| 259 Error ViaSerialization::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream
) const { | 259 Error ViaSerialization::draw(const Src& src, SkBitmap* bitmap, SkWStream* stream
) const { |
| 260 // Record our Src into a picture. | 260 // Record our Src into a picture. |
| 261 SkSize size; | 261 SkSize size; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 surfaces.unrefAll(); | 349 surfaces.unrefAll(); |
| 350 return ""; | 350 return ""; |
| 351 } | 351 } |
| 352 SkISize size() const SK_OVERRIDE { return fSize; } | 352 SkISize size() const SK_OVERRIDE { return fSize; } |
| 353 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. | 353 Name name() const SK_OVERRIDE { sk_throw(); return ""; } // No one shou
ld be calling this. |
| 354 } proxy(fW, fH, pic, src.size()); | 354 } proxy(fW, fH, pic, src.size()); |
| 355 return fSink->draw(proxy, bitmap, stream); | 355 return fSink->draw(proxy, bitmap, stream); |
| 356 } | 356 } |
| 357 | 357 |
| 358 } // namespace DM | 358 } // namespace DM |
| OLD | NEW |