Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #ifndef DMSrcSink_DEFINED | 1 #ifndef DMSrcSink_DEFINED |
| 2 #define DMSrcSink_DEFINED | 2 #define DMSrcSink_DEFINED |
| 3 | 3 |
| 4 #include "DMGpuSupport.h" | 4 #include "DMGpuSupport.h" |
| 5 #include "SkBBHFactory.h" | 5 #include "SkBBHFactory.h" |
| 6 #include "SkBBoxHierarchy.h" | 6 #include "SkBBoxHierarchy.h" |
| 7 #include "SkBitmap.h" | 7 #include "SkBitmap.h" |
| 8 #include "SkCanvas.h" | 8 #include "SkCanvas.h" |
| 9 #include "SkData.h" | 9 #include "SkData.h" |
| 10 #include "SkGPipe.h" | 10 #include "SkGPipe.h" |
| 11 #include "SkNullCanvas.h" | |
| 11 #include "SkPicture.h" | 12 #include "SkPicture.h" |
| 12 #include "gm.h" | 13 #include "gm.h" |
| 13 | 14 |
| 14 namespace DM { | 15 namespace DM { |
| 15 | 16 |
| 16 // This is just convenience. It lets you use either return "foo" or return SkSt ringPrintf(...). | 17 // This is just convenience. It lets you use either return "foo" or return SkSt ringPrintf(...). |
| 17 struct ImplicitString : public SkString { | 18 struct ImplicitString : public SkString { |
| 18 template <typename T> | 19 template <typename T> |
| 19 ImplicitString(const T& s) : SkString(s) {} | 20 ImplicitString(const T& s) : SkString(s) {} |
| 20 }; | 21 }; |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 168 | 169 |
| 169 Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE; | 170 Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE; |
| 170 int enclave() const SK_OVERRIDE { return fSink->enclave(); } | 171 int enclave() const SK_OVERRIDE { return fSink->enclave(); } |
| 171 const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension( ); } | 172 const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension( ); } |
| 172 private: | 173 private: |
| 173 const int fW, fH; | 174 const int fW, fH; |
| 174 SkAutoTDelete<SkBBHFactory> fFactory; | 175 SkAutoTDelete<SkBBHFactory> fFactory; |
| 175 SkAutoTDelete<Sink> fSink; | 176 SkAutoTDelete<Sink> fSink; |
| 176 }; | 177 }; |
| 177 | 178 |
| 179 class NullSink : public Sink { | |
| 180 public: | |
| 181 Error draw(const Src& src, SkBitmap*, SkWStream* out) const SK_OVERRIDE { | |
| 182 (void)out->writeText("0\n"); | |
|
mtklein
2015/01/29 20:00:12
Is this so we don't try to encode an empty bitmap?
hal.canary
2015/01/30 18:43:24
Done.
| |
| 183 return src.draw(SkCreateNullCanvas()); | |
| 184 } | |
| 185 int enclave() const SK_OVERRIDE { return kAnyThread_Enclave; } | |
| 186 const char* fileExtension() const SK_OVERRIDE { return "null"; } | |
|
mtklein
2015/01/29 20:00:12
or even, ""?
hal.canary
2015/01/30 18:43:24
Done.
| |
| 187 }; | |
| 188 | |
| 178 } // namespace DM | 189 } // namespace DM |
| 179 | 190 |
| 180 #endif//DMSrcSink_DEFINED | 191 #endif//DMSrcSink_DEFINED |
| OLD | NEW |