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, SkCodec*); | |
scroggo
2015/04/08 17:21:27
Comment about ownership?
(Note that I'm commentin
msarett
2015/04/08 19:35:40
Done.
| |
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; | |
112 SkAutoTDelete<SkCodec> fCodec; | |
105 }; | 113 }; |
106 | 114 |
107 | 115 |
108 class ImageSrc : public Src { | 116 class ImageSrc : public Src { |
109 public: | 117 public: |
110 // divisor == 0 means decode the whole image | 118 // divisor == 0 means decode the whole image |
111 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr id. | 119 // divisor > 0 means decode in subsets, dividing into a divisor x divisor gr id. |
112 explicit ImageSrc(Path path, int divisor = 0); | 120 explicit ImageSrc(Path path, int divisor = 0); |
113 | 121 |
114 Error draw(SkCanvas*) const override; | 122 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; | 281 Error draw(const Src&, SkBitmap*, SkWStream*, SkString*) const override; |
274 int enclave() const override { return fSink->enclave(); } | 282 int enclave() const override { return fSink->enclave(); } |
275 const char* fileExtension() const override { return fSink->fileExtension(); } | 283 const char* fileExtension() const override { return fSink->fileExtension(); } |
276 private: | 284 private: |
277 SkAutoTDelete<Sink> fSink; | 285 SkAutoTDelete<Sink> fSink; |
278 }; | 286 }; |
279 | 287 |
280 } // namespace DM | 288 } // namespace DM |
281 | 289 |
282 #endif//DMSrcSink_DEFINED | 290 #endif//DMSrcSink_DEFINED |
OLD | NEW |