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 #include "SkBmpCodec.h" | 8 #include "SkBmpCodec.h" |
9 #include "SkColorTable.h" | 9 #include "SkColorTable.h" |
10 #include "SkImageInfo.h" | 10 #include "SkImageInfo.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 */ | 37 */ |
38 SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, | 38 SkBmpStandardCodec(const SkImageInfo& srcInfo, SkStream* stream, |
39 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, | 39 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, |
40 uint32_t offset, SkCodec::SkScanlineOrder rowOrder, | 40 uint32_t offset, SkCodec::SkScanlineOrder rowOrder, |
41 bool isIco); | 41 bool isIco); |
42 | 42 |
43 protected: | 43 protected: |
44 | 44 |
45 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | 45 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
46 size_t dstRowBytes, const Options&, SkPMColor*, | 46 size_t dstRowBytes, const Options&, SkPMColor*, |
47 int*) override; | 47 int*, int*) override; |
48 | 48 |
49 bool onInIco() const override { | 49 bool onInIco() const override { |
50 return fInIco; | 50 return fInIco; |
51 } | 51 } |
52 | 52 |
53 SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, | 53 SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, |
54 const SkCodec::Options& options, SkPMColor inputColorPtr[], | 54 const SkCodec::Options& options, SkPMColor inputColorPtr[], |
55 int* inputColorCount) override; | 55 int* inputColorCount) override; |
56 | 56 |
57 SkSampler* getSampler() override { return fSwizzler; } | 57 |
| 58 uint32_t onGetFillValue(SkColorType colorType, SkAlphaType alphaType) const
override; |
| 59 |
| 60 SkSampler* getSampler(bool createIfNecessary) override { |
| 61 SkASSERT(fSwizzler); |
| 62 return fSwizzler; |
| 63 } |
58 | 64 |
59 private: | 65 private: |
60 | 66 |
61 /* | 67 /* |
62 * Creates the color table | 68 * Creates the color table |
63 * Sets colorCount to the new color count if it is non-nullptr | 69 * Sets colorCount to the new color count if it is non-nullptr |
64 */ | 70 */ |
65 bool createColorTable(SkAlphaType alphaType, int* colorCount); | 71 bool createColorTable(SkAlphaType alphaType, int* colorCount); |
66 | 72 |
67 bool initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts); | 73 bool initializeSwizzler(const SkImageInfo& dstInfo, const Options& opts); |
68 | 74 |
69 Result decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, | 75 int decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, |
70 const Options& opts) override; | 76 const Options& opts) override; |
71 | 77 |
72 Result decodeIcoMask(const SkImageInfo& dstInfo, void* dst, size_t dstRowByt
es); | 78 Result decodeIcoMask(const SkImageInfo& dstInfo, void* dst, size_t dstRowByt
es); |
73 | 79 |
74 SkAutoTUnref<SkColorTable> fColorTable; // owned | 80 SkAutoTUnref<SkColorTable> fColorTable; // owned |
75 const uint32_t fNumColors; | 81 const uint32_t fNumColors; |
76 const uint32_t fBytesPerColor; | 82 const uint32_t fBytesPerColor; |
77 const uint32_t fOffset; | 83 const uint32_t fOffset; |
78 SkAutoTDelete<SkSwizzler> fSwizzler; | 84 SkAutoTDelete<SkSwizzler> fSwizzler; |
79 const size_t fSrcRowBytes; | 85 const size_t fSrcRowBytes; |
80 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | 86 SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
81 const bool fInIco; | 87 const bool fInIco; |
82 | 88 |
83 typedef SkBmpCodec INHERITED; | 89 typedef SkBmpCodec INHERITED; |
84 }; | 90 }; |
OLD | NEW |