OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #ifndef DMSrcSink_DEFINED | 8 #ifndef DMSrcSink_DEFINED |
9 #define DMSrcSink_DEFINED | 9 #define DMSrcSink_DEFINED |
10 | 10 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 SkString fMsg; | 52 SkString fMsg; |
53 bool fFatal; | 53 bool fFatal; |
54 }; | 54 }; |
55 | 55 |
56 struct Src { | 56 struct Src { |
57 // All Srcs must be thread safe. | 57 // All Srcs must be thread safe. |
58 virtual ~Src() {} | 58 virtual ~Src() {} |
59 virtual Error SK_WARN_UNUSED_RESULT draw(SkCanvas*) const = 0; | 59 virtual Error SK_WARN_UNUSED_RESULT draw(SkCanvas*) const = 0; |
60 virtual SkISize size() const = 0; | 60 virtual SkISize size() const = 0; |
61 virtual Name name() const = 0; | 61 virtual Name name() const = 0; |
| 62 virtual void modifyGrContextOptions(GrContextOptions* options) const {} |
62 }; | 63 }; |
63 | 64 |
64 struct Sink { | 65 struct Sink { |
65 virtual ~Sink() {} | 66 virtual ~Sink() {} |
66 // You may write to either the bitmap or stream. If you write to log, we'll
print that out. | 67 // You may write to either the bitmap or stream. If you write to log, we'll
print that out. |
67 virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*,
SkString* log) | 68 virtual Error SK_WARN_UNUSED_RESULT draw(const Src&, SkBitmap*, SkWStream*,
SkString* log) |
68 const = 0; | 69 const = 0; |
69 // Sinks in the same enclave (except kAnyThread_Enclave) will run serially o
n the same thread. | 70 // Sinks in the same enclave (except kAnyThread_Enclave) will run serially o
n the same thread. |
70 virtual int enclave() const = 0; | 71 virtual int enclave() const = 0; |
71 | 72 |
72 // File extension for the content draw() outputs, e.g. "png", "pdf". | 73 // File extension for the content draw() outputs, e.g. "png", "pdf". |
73 virtual const char* fileExtension() const = 0; | 74 virtual const char* fileExtension() const = 0; |
74 }; | 75 }; |
75 | 76 |
76 enum { kAnyThread_Enclave, kGPU_Enclave }; | 77 enum { kAnyThread_Enclave, kGPU_Enclave }; |
77 static const int kNumEnclaves = kGPU_Enclave + 1; | 78 static const int kNumEnclaves = kGPU_Enclave + 1; |
78 | 79 |
79 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ | 80 /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~*/ |
80 | 81 |
81 class GMSrc : public Src { | 82 class GMSrc : public Src { |
82 public: | 83 public: |
83 explicit GMSrc(skiagm::GMRegistry::Factory); | 84 explicit GMSrc(skiagm::GMRegistry::Factory); |
84 | 85 |
85 Error draw(SkCanvas*) const override; | 86 Error draw(SkCanvas*) const override; |
86 SkISize size() const override; | 87 SkISize size() const override; |
87 Name name() const override; | 88 Name name() const override; |
| 89 void modifyGrContextOptions(GrContextOptions* options) const override; |
| 90 |
88 private: | 91 private: |
89 skiagm::GMRegistry::Factory fFactory; | 92 skiagm::GMRegistry::Factory fFactory; |
90 }; | 93 }; |
91 | 94 |
92 class CodecSrc : public Src { | 95 class CodecSrc : public Src { |
93 public: | 96 public: |
94 enum Mode { | 97 enum Mode { |
95 kNormal_Mode, | 98 kNormal_Mode, |
96 kScanline_Mode, | 99 kScanline_Mode, |
97 }; | 100 }; |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 | 283 |
281 class ViaTwice : public Via { | 284 class ViaTwice : public Via { |
282 public: | 285 public: |
283 explicit ViaTwice(Sink* sink) : Via(sink) {} | 286 explicit ViaTwice(Sink* sink) : Via(sink) {} |
284 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; | 287 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
285 }; | 288 }; |
286 | 289 |
287 } // namespace DM | 290 } // namespace DM |
288 | 291 |
289 #endif//DMSrcSink_DEFINED | 292 #endif//DMSrcSink_DEFINED |
OLD | NEW |