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 "SkCodec.h" |
16 #include "SkData.h" | 17 #include "SkData.h" |
17 #include "SkGPipe.h" | 18 #include "SkGPipe.h" |
18 #include "SkPicture.h" | 19 #include "SkPicture.h" |
19 #include "gm.h" | 20 #include "gm.h" |
20 | 21 |
21 namespace DM { | 22 namespace DM { |
22 | 23 |
23 // This is just convenience. It lets you use either return "foo" or return SkSt
ringPrintf(...). | 24 // This is just convenience. It lets you use either return "foo" or return SkSt
ringPrintf(...). |
24 struct ImplicitString : public SkString { | 25 struct ImplicitString : public SkString { |
25 template <typename T> | 26 template <typename T> |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 private: | 88 private: |
88 skiagm::GMRegistry::Factory fFactory; | 89 skiagm::GMRegistry::Factory fFactory; |
89 }; | 90 }; |
90 | 91 |
91 class CodecSrc : public Src { | 92 class CodecSrc : public Src { |
92 public: | 93 public: |
93 enum Mode { | 94 enum Mode { |
94 kNormal_Mode, | 95 kNormal_Mode, |
95 kScanline_Mode, | 96 kScanline_Mode, |
96 }; | 97 }; |
97 CodecSrc(Path, Mode); | 98 enum DstColorType { |
| 99 kGetFromCanvas_DstColorType, |
| 100 kIndex8_Always_DstColorType, |
| 101 kGrayscale_Always_DstColorType, |
| 102 }; |
| 103 CodecSrc(Path, Mode, DstColorType); |
98 | 104 |
99 Error draw(SkCanvas*) const override; | 105 Error draw(SkCanvas*) const override; |
100 SkISize size() const override; | 106 SkISize size() const override; |
101 Name name() const override; | 107 Name name() const override; |
102 private: | 108 private: |
103 Path fPath; | 109 Path fPath; |
104 Mode fMode; | 110 Mode fMode; |
| 111 DstColorType fDstColorType; |
105 }; | 112 }; |
106 | 113 |
107 | 114 |
108 class ImageSrc : public Src { | 115 class ImageSrc : public Src { |
109 public: | 116 public: |
110 // divisor == 0 means decode the whole image | 117 // divisor == 0 means decode the whole image |
111 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr
id. | 118 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr
id. |
112 explicit ImageSrc(Path path, int divisor = 0); | 119 explicit ImageSrc(Path path, int divisor = 0); |
113 | 120 |
114 Error draw(SkCanvas*) const override; | 121 Error draw(SkCanvas*) const override; |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; | 280 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
274 int enclave() const override { return fSink->enclave(); } | 281 int enclave() const override { return fSink->enclave(); } |
275 const char* fileExtension() const override { return fSink->fileExtension();
} | 282 const char* fileExtension() const override { return fSink->fileExtension();
} |
276 private: | 283 private: |
277 SkAutoTDelete<Sink> fSink; | 284 SkAutoTDelete<Sink> fSink; |
278 }; | 285 }; |
279 | 286 |
280 } // namespace DM | 287 } // namespace DM |
281 | 288 |
282 #endif//DMSrcSink_DEFINED | 289 #endif//DMSrcSink_DEFINED |
OLD | NEW |