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

Side by Side Diff: dm/DMSrcSink.h

Issue 944643002: PDF: Now threadsafe! (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: TODO=DONE Created 5 years, 10 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 | src/doc/SkDocument_PDF.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
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
OLDNEW
« no previous file with comments | « no previous file | src/doc/SkDocument_PDF.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698