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 "SkImageInfo.h" | 9 #include "SkImageInfo.h" |
10 #include "SkMaskSwizzler.h" | 10 #include "SkMaskSwizzler.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 * @param rowOrder indicates whether rows are ordered top-down or bottom-up | 29 * @param rowOrder indicates whether rows are ordered top-down or bottom-up |
30 */ | 30 */ |
31 SkBmpMaskCodec(const SkImageInfo& srcInfo, SkStream* stream, | 31 SkBmpMaskCodec(const SkImageInfo& srcInfo, SkStream* stream, |
32 uint16_t bitsPerPixel, SkMasks* masks, | 32 uint16_t bitsPerPixel, SkMasks* masks, |
33 SkCodec::SkScanlineOrder rowOrder); | 33 SkCodec::SkScanlineOrder rowOrder); |
34 | 34 |
35 protected: | 35 protected: |
36 | 36 |
37 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | 37 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
38 size_t dstRowBytes, const Options&, SkPMColor*, | 38 size_t dstRowBytes, const Options&, SkPMColor*, |
39 int*) override; | 39 int*, int*) override; |
40 | 40 |
41 SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, | 41 SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, |
42 const SkCodec::Options& options, SkPMColor inputColorPtr[], | 42 const SkCodec::Options& options, SkPMColor inputColorPtr[], |
43 int* inputColorCount) override; | 43 int* inputColorCount) override; |
44 | 44 |
45 private: | 45 private: |
46 | 46 |
47 bool initializeSwizzler(const SkImageInfo& dstInfo); | 47 bool initializeSwizzler(const SkImageInfo& dstInfo); |
48 SkSampler* getSampler() override { return fMaskSwizzler; } | 48 SkSampler* getSampler(bool createIfNecessary) override { |
| 49 SkASSERT(fMaskSwizzler); |
| 50 return fMaskSwizzler; |
| 51 } |
49 | 52 |
50 Result decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, | 53 int decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, |
51 const Options& opts) override; | 54 const Options& opts) override; |
52 | 55 |
53 SkAutoTDelete<SkMasks> fMasks; // owned | 56 SkAutoTDelete<SkMasks> fMasks; // owned |
54 SkAutoTDelete<SkMaskSwizzler> fMaskSwizzler; | 57 SkAutoTDelete<SkMaskSwizzler> fMaskSwizzler; |
55 const size_t fSrcRowBytes; | 58 const size_t fSrcRowBytes; |
56 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | 59 SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
57 | 60 |
58 typedef SkBmpCodec INHERITED; | 61 typedef SkBmpCodec INHERITED; |
59 }; | 62 }; |
OLD | NEW |