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 SkCodec_DEFINED | 8 #ifndef SkCodec_DEFINED |
9 #define SkCodec_DEFINED | 9 #define SkCodec_DEFINED |
10 | 10 |
11 #include "../private/SkTemplates.h" | 11 #include "../private/SkTemplates.h" |
12 #include "SkColor.h" | 12 #include "SkColor.h" |
13 #include "SkEncodedFormat.h" | 13 #include "SkEncodedFormat.h" |
14 #include "SkEncodedInfo.h" | 14 #include "SkEncodedInfo.h" |
15 #include "SkImageInfo.h" | 15 #include "SkImageInfo.h" |
16 #include "SkSize.h" | 16 #include "SkSize.h" |
17 #include "SkStream.h" | 17 #include "SkStream.h" |
18 #include "SkTypes.h" | 18 #include "SkTypes.h" |
19 #include "SkYUVSizeInfo.h" | 19 #include "SkYUVSizeInfo.h" |
20 | 20 |
21 class SkColorSpace; | 21 class SkColorSpace; |
22 class SkData; | 22 class SkData; |
23 class SkPngChunkReader; | 23 class SkPngChunkReader; |
24 class SkSampler; | 24 class SkSampler; |
25 | 25 |
| 26 namespace DM { |
| 27 class ColorCodecSrc; |
| 28 } |
| 29 |
| 30 |
26 /** | 31 /** |
27 * Abstraction layer directly on top of an image codec. | 32 * Abstraction layer directly on top of an image codec. |
28 */ | 33 */ |
29 class SkCodec : SkNoncopyable { | 34 class SkCodec : SkNoncopyable { |
30 public: | 35 public: |
31 /** | 36 /** |
32 * Minimum number of bytes that must be buffered in SkStream input. | 37 * Minimum number of bytes that must be buffered in SkStream input. |
33 * | 38 * |
34 * An SkStream passed to NewFromStream must be able to use this many | 39 * An SkStream passed to NewFromStream must be able to use this many |
35 * bytes to determine the image type. Then the same SkStream must be | 40 * bytes to determine the image type. Then the same SkStream must be |
(...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 /** | 644 /** |
640 * Returns the number of scanlines that have been decoded so far. | 645 * Returns the number of scanlines that have been decoded so far. |
641 * This is unaffected by the SkScanlineOrder. | 646 * This is unaffected by the SkScanlineOrder. |
642 * | 647 * |
643 * Returns -1 if we have not started a scanline decode. | 648 * Returns -1 if we have not started a scanline decode. |
644 */ | 649 */ |
645 int currScanline() const { return fCurrScanline; } | 650 int currScanline() const { return fCurrScanline; } |
646 | 651 |
647 virtual int onOutputScanline(int inputScanline) const; | 652 virtual int onOutputScanline(int inputScanline) const; |
648 | 653 |
| 654 /** |
| 655 * Used for testing with qcms. |
| 656 * FIXME: Remove this when we are done comparing with qcms. |
| 657 */ |
| 658 virtual sk_sp<SkData> getICCData() const { return nullptr; } |
649 private: | 659 private: |
650 const SkEncodedInfo fEncodedInfo; | 660 const SkEncodedInfo fEncodedInfo; |
651 const SkImageInfo fSrcInfo; | 661 const SkImageInfo fSrcInfo; |
652 SkAutoTDelete<SkStream> fStream; | 662 SkAutoTDelete<SkStream> fStream; |
653 bool fNeedsRewind; | 663 bool fNeedsRewind; |
654 sk_sp<SkColorSpace> fColorSpace; | 664 sk_sp<SkColorSpace> fColorSpace; |
655 const Origin fOrigin; | 665 const Origin fOrigin; |
656 | 666 |
657 // These fields are only meaningful during scanline decodes. | 667 // These fields are only meaningful during scanline decodes. |
658 SkImageInfo fDstInfo; | 668 SkImageInfo fDstInfo; |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
702 /** | 712 /** |
703 * Return an object which will allow forcing scanline decodes to sample in
X. | 713 * Return an object which will allow forcing scanline decodes to sample in
X. |
704 * | 714 * |
705 * May create a sampler, if one is not currently being used. Otherwise, doe
s | 715 * May create a sampler, if one is not currently being used. Otherwise, doe
s |
706 * not affect ownership. | 716 * not affect ownership. |
707 * | 717 * |
708 * Only valid during scanline decoding. | 718 * Only valid during scanline decoding. |
709 */ | 719 */ |
710 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} | 720 virtual SkSampler* getSampler(bool /*createIfNecessary*/) { return nullptr;
} |
711 | 721 |
| 722 // For testing with qcms |
| 723 // FIXME: Remove this when we are done comparing with qcms. |
| 724 friend class DM::ColorCodecSrc; |
| 725 |
712 friend class SkSampledCodec; | 726 friend class SkSampledCodec; |
713 friend class SkIcoCodec; | 727 friend class SkIcoCodec; |
714 }; | 728 }; |
715 #endif // SkCodec_DEFINED | 729 #endif // SkCodec_DEFINED |
OLD | NEW |