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 29 matching lines...) Expand all Loading... |
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, kGPUSink_Enclave, kPDFSink_Enclave }; | 45 enum { kAnyThread_Enclave, kGPUSink_Enclave, kPDFSink_Enclave }; |
46 static const int kNumEnclaves = kPDFSink_Enclave + 1; | 46 static const int kNumEnclaves = kPDFSink_Enclave + 1; |
47 | 47 |
48 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 48 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
49 | 49 |
50 void SafeUnref(SkPicture*); // These need external linkage (and specific types)
. | |
51 void SafeUnref(SkData*); | |
52 | |
53 class GMSrc : public Src { | 50 class GMSrc : public Src { |
54 public: | 51 public: |
55 explicit GMSrc(skiagm::GMRegistry::Factory); | 52 explicit GMSrc(skiagm::GMRegistry::Factory); |
56 | 53 |
57 Error draw(SkCanvas*) const SK_OVERRIDE; | 54 Error draw(SkCanvas*) const SK_OVERRIDE; |
58 SkISize size() const SK_OVERRIDE; | 55 SkISize size() const SK_OVERRIDE; |
59 Name name() const SK_OVERRIDE; | 56 Name name() const SK_OVERRIDE; |
60 private: | 57 private: |
61 skiagm::GMRegistry::Factory fFactory; | 58 skiagm::GMRegistry::Factory fFactory; |
62 }; | 59 }; |
63 | 60 |
64 class ImageSrc : public Src { | 61 class ImageSrc : public Src { |
65 public: | 62 public: |
66 explicit ImageSrc(SkString path, int subsets = 0); | 63 explicit ImageSrc(SkString path, int subsets = 0); |
67 | 64 |
68 Error draw(SkCanvas*) const SK_OVERRIDE; | 65 Error draw(SkCanvas*) const SK_OVERRIDE; |
69 SkISize size() const SK_OVERRIDE; | 66 SkISize size() const SK_OVERRIDE; |
70 Name name() const SK_OVERRIDE; | 67 Name name() const SK_OVERRIDE; |
71 private: | 68 private: |
72 SkString fPath; | 69 SkString fPath; |
73 int fSubsets; | 70 int fSubsets; |
74 SkLazyPtr<SkData, SafeUnref> fEncoded; | |
75 }; | 71 }; |
76 | 72 |
77 class SKPSrc : public Src { | 73 class SKPSrc : public Src { |
78 public: | 74 public: |
79 explicit SKPSrc(SkString path); | 75 explicit SKPSrc(SkString path); |
80 | 76 |
81 Error draw(SkCanvas*) const SK_OVERRIDE; | 77 Error draw(SkCanvas*) const SK_OVERRIDE; |
82 SkISize size() const SK_OVERRIDE; | 78 SkISize size() const SK_OVERRIDE; |
83 Name name() const SK_OVERRIDE; | 79 Name name() const SK_OVERRIDE; |
84 private: | 80 private: |
85 SkString fPath; | 81 SkString fPath; |
86 SkLazyPtr<SkPicture, SafeUnref> fPic; | |
87 }; | 82 }; |
88 | 83 |
89 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 84 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
90 | 85 |
91 class GPUSink : public Sink { | 86 class GPUSink : public Sink { |
92 public: | 87 public: |
93 GPUSink(GrContextFactory::GLContextType, GrGLStandard, int samples, bool dfT
ext, bool threaded); | 88 GPUSink(GrContextFactory::GLContextType, GrGLStandard, int samples, bool dfT
ext, bool threaded); |
94 | 89 |
95 Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE; | 90 Error draw(const Src&, SkBitmap*, SkWStream*) const SK_OVERRIDE; |
96 int enclave() const SK_OVERRIDE; | 91 int enclave() const SK_OVERRIDE; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(
); } | 164 const char* fileExtension() const SK_OVERRIDE { return fSink->fileExtension(
); } |
170 private: | 165 private: |
171 const int fW, fH; | 166 const int fW, fH; |
172 SkAutoTDelete<SkBBHFactory> fFactory; | 167 SkAutoTDelete<SkBBHFactory> fFactory; |
173 SkAutoTDelete<Sink> fSink; | 168 SkAutoTDelete<Sink> fSink; |
174 }; | 169 }; |
175 | 170 |
176 } // namespace DM | 171 } // namespace DM |
177 | 172 |
178 #endif//DMSrcSink_DEFINED | 173 #endif//DMSrcSink_DEFINED |
OLD | NEW |