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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 // You may write to either the bitmap or stream. If you write to log, we'll
print that out. | 35 // You may write to either the bitmap or stream. If you write to log, we'll
print that out. |
36 virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*,
SkString* log) | 36 virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*,
SkString* log) |
37 const = 0; | 37 const = 0; |
38 // Sinks in the same enclave (except kAnyThread_Enclave) will run serially o
n the same thread. | 38 // Sinks in the same enclave (except kAnyThread_Enclave) will run serially o
n the same thread. |
39 virtual int enclave() const = 0; | 39 virtual int enclave() const = 0; |
40 | 40 |
41 // File extension for the content draw() outputs, e.g. "png", "pdf". | 41 // File extension for the content draw() outputs, e.g. "png", "pdf". |
42 virtual const char* fileExtension() const = 0; | 42 virtual const char* fileExtension() const = 0; |
43 }; | 43 }; |
44 | 44 |
45 enum { kAnyThread_Enclave, kGPU_Enclave, kPDFSink_Enclave }; | 45 enum { kAnyThread_Enclave, kGPU_Enclave }; |
46 static const int kNumEnclaves = kPDFSink_Enclave + 1; | 46 static const int kNumEnclaves = kGPU_Enclave + 1; |
47 | 47 |
48 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 48 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
49 | 49 |
50 class GMSrc : public Src { | 50 class GMSrc : public Src { |
51 public: | 51 public: |
52 explicit GMSrc(skiagm::GMRegistry::Factory); | 52 explicit GMSrc(skiagm::GMRegistry::Factory); |
53 | 53 |
54 Error draw(SkCanvas*) const SK_OVERRIDE; | 54 Error draw(SkCanvas*) const SK_OVERRIDE; |
55 SkISize size() const SK_OVERRIDE; | 55 SkISize size() const SK_OVERRIDE; |
56 Name name() const SK_OVERRIDE; | 56 Name name() const SK_OVERRIDE; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 int fSampleCount; | 108 int fSampleCount; |
109 bool fUseDFText; | 109 bool fUseDFText; |
110 bool fThreaded; | 110 bool fThreaded; |
111 }; | 111 }; |
112 | 112 |
113 class PDFSink : public Sink { | 113 class PDFSink : public Sink { |
114 public: | 114 public: |
115 PDFSink(); | 115 PDFSink(); |
116 | 116 |
117 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE; | 117 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE; |
118 int enclave() const SK_OVERRIDE { return kPDFSink_Enclave; } | 118 int enclave() const SK_OVERRIDE { return kAnyThread_Enclave; } |
119 const char* fileExtension() const SK_OVERRIDE { return "pdf"; } | 119 const char* fileExtension() const SK_OVERRIDE { return "pdf"; } |
120 }; | 120 }; |
121 | 121 |
122 class RasterSink : public Sink { | 122 class RasterSink : public Sink { |
123 public: | 123 public: |
124 explicit RasterSink(SkColorType); | 124 explicit RasterSink(SkColorType); |
125 | 125 |
126 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE; | 126 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const SK_OVERRIDE; |
127 int enclave() const SK_OVERRIDE { return kAnyThread_Enclave; } | 127 int enclave() const SK_OVERRIDE { return kAnyThread_Enclave; } |
128 const char* fileExtension() const SK_OVERRIDE { return "png"; } | 128 const char* fileExtension() const SK_OVERRIDE { return "png"; } |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(
); } | 206 const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(
); } |
207 private: | 207 private: |
208 const int fW, fH; | 208 const int fW, fH; |
209 SkAutoTDelete<SkBBHFactory> fFactory; | 209 SkAutoTDelete<SkBBHFactory> fFactory; |
210 SkAutoTDelete<Sink> fSink; | 210 SkAutoTDelete<Sink> fSink; |
211 }; | 211 }; |
212 | 212 |
213 } // namespace DM | 213 } // namespace DM |
214 | 214 |
215 #endif//DMSrcSink_DEFINED | 215 #endif//DMSrcSink_DEFINED |
OLD | NEW |