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 |
11 #include "DMGpuSupport.h" | 11 #include "DMGpuSupport.h" |
12 #include "SkBBHFactory.h" | 12 #include "SkBBHFactory.h" |
13 #include "SkBBoxHierarchy.h" | 13 #include "SkBBoxHierarchy.h" |
14 #include "SkBitmap.h" | 14 #include "SkBitmap.h" |
15 #include "SkCanvas.h" | 15 #include "SkCanvas.h" |
16 #include "SkData.h" | 16 #include "SkData.h" |
17 #include "SkGPipe.h" | 17 #include "SkGPipe.h" |
18 #include "SkPicture.h" | 18 #include "SkPicture.h" |
19 #include "gm.h" | 19 #include "gm.h" |
20 | 20 |
21 namespace DM { | 21 namespace DM { |
22 | 22 |
23 // This is just convenience. It lets you use either return "foo" or return SkSt
ringPrintf(...). | 23 // This is just convenience. It lets you use either return "foo" or return SkSt
ringPrintf(...). |
24 struct ImplicitString : public SkString { | 24 struct ImplicitString : public SkString { |
25 template <typename T> | 25 template <typename T> |
26 ImplicitString(const T& s) : SkString(s) {} | 26 ImplicitString(const T& s) : SkString(s) {} |
| 27 ImplicitString() : SkString("") {} |
27 }; | 28 }; |
28 typedef ImplicitString Name; | 29 typedef ImplicitString Name; |
29 typedef ImplicitString Path; | 30 typedef ImplicitString Path; |
30 | 31 |
31 class Error { | 32 class Error { |
32 public: | 33 public: |
33 Error(const SkString& s) : fMsg(s), fFatal(!this->isEmpty()) {} | 34 Error(const SkString& s) : fMsg(s), fFatal(!this->isEmpty()) {} |
34 Error(const char* s) : fMsg(s), fFatal(!this->isEmpty()) {} | 35 Error(const char* s) : fMsg(s), fFatal(!this->isEmpty()) {} |
35 | 36 |
36 Error(const Error&) = default; | 37 Error(const Error&) = default; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 Name name() const override; | 96 Name name() const override; |
96 void modifyGrContextOptions(GrContextOptions* options) const override; | 97 void modifyGrContextOptions(GrContextOptions* options) const override; |
97 | 98 |
98 private: | 99 private: |
99 skiagm::GMRegistry::Factory fFactory; | 100 skiagm::GMRegistry::Factory fFactory; |
100 }; | 101 }; |
101 | 102 |
102 class CodecSrc : public Src { | 103 class CodecSrc : public Src { |
103 public: | 104 public: |
104 enum Mode { | 105 enum Mode { |
105 kNormal_Mode, | 106 kScaledCodec_Mode, |
| 107 kCodec_Mode, |
106 kScanline_Mode, | 108 kScanline_Mode, |
107 kScanline_Subset_Mode, | 109 kScanline_Subset_Mode, |
108 kStripe_Mode, // Tests the skipping of scanlines | 110 kStripe_Mode, // Tests the skipping of scanlines |
109 kSubset_Mode, // For codecs that support subsets directly. | 111 kSubset_Mode, // For codecs that support subsets directly. |
110 }; | 112 }; |
111 enum DstColorType { | 113 enum DstColorType { |
112 kGetFromCanvas_DstColorType, | 114 kGetFromCanvas_DstColorType, |
113 kIndex8_Always_DstColorType, | 115 kIndex8_Always_DstColorType, |
114 kGrayscale_Always_DstColorType, | 116 kGrayscale_Always_DstColorType, |
115 }; | 117 }; |
116 CodecSrc(Path, Mode, DstColorType, float); | 118 CodecSrc(Path, Mode, DstColorType, float); |
117 | 119 |
118 Error draw(SkCanvas*) const override; | 120 Error draw(SkCanvas*) const override; |
119 SkISize size() const override; | 121 SkISize size() const override; |
120 Name name() const override; | 122 Name name() const override; |
121 bool veto(SinkFlags) const override; | 123 bool veto(SinkFlags) const override; |
122 private: | 124 private: |
123 Path fPath; | 125 Path fPath; |
124 Mode fMode; | 126 Mode fMode; |
125 DstColorType fDstColorType; | 127 DstColorType fDstColorType; |
126 float fScale; | 128 float fScale; |
127 }; | 129 }; |
128 | 130 |
129 | 131 |
130 class ImageSrc : public Src { | 132 class ImageSrc : public Src { |
131 public: | 133 public: |
132 // divisor == 0 means decode the whole image | 134 // divisor == 0 means decode the whole image |
133 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr
id. | 135 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr
id. |
134 explicit ImageSrc(Path path, int divisor = 0); | 136 explicit ImageSrc(Path path, int divisor = 0); |
135 | 137 |
136 Error draw(SkCanvas*) const override; | 138 Error draw(SkCanvas*) const override; |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 | 310 |
309 class ViaTwice : public Via { | 311 class ViaTwice : public Via { |
310 public: | 312 public: |
311 explicit ViaTwice(Sink* sink) : Via(sink) {} | 313 explicit ViaTwice(Sink* sink) : Via(sink) {} |
312 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; | 314 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
313 }; | 315 }; |
314 | 316 |
315 } // namespace DM | 317 } // namespace DM |
316 | 318 |
317 #endif//DMSrcSink_DEFINED | 319 #endif//DMSrcSink_DEFINED |
OLD | NEW |