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 11 matching lines...) Expand all Loading... |
22 * Called only by SkBmpCodec::NewFromStream | 22 * Called only by SkBmpCodec::NewFromStream |
23 * There should be no other callers despite this being public | 23 * There should be no other callers despite this being public |
24 * | 24 * |
25 * @param srcInfo contains the source width and height | 25 * @param srcInfo contains the source width and height |
26 * @param stream the stream of encoded image data | 26 * @param stream the stream of encoded image data |
27 * @param bitsPerPixel the number of bits used to store each pixel | 27 * @param bitsPerPixel the number of bits used to store each pixel |
28 * @param masks color masks for certain bmp formats | 28 * @param masks color masks for certain bmp formats |
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, RowOrder rowOrder); | 32 SkBmpCodec::BmpInputFormat inputFormat, uint16_t bitsPerPixel, |
| 33 SkMasks* masks, RowOrder rowOrder); |
33 | 34 |
34 protected: | 35 protected: |
35 | 36 |
36 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | 37 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
37 size_t dstRowBytes, const Options&, SkPMColor*, | 38 size_t dstRowBytes, const Options&, SkPMColor*, |
38 int*) override; | 39 int*) override; |
39 | 40 |
40 private: | 41 private: |
41 | 42 |
42 bool initializeSwizzler(const SkImageInfo& dstInfo); | 43 bool initializeSwizzler(const SkImageInfo& dstInfo); |
43 | 44 |
44 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, | 45 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, |
45 const Options& opts); | 46 const Options& opts); |
46 | 47 |
47 SkAutoTDelete<SkMasks> fMasks; // owned | 48 SkAutoTDelete<SkMasks> fMasks; // owned |
48 SkAutoTDelete<SkMaskSwizzler> fMaskSwizzler; | 49 SkAutoTDelete<SkMaskSwizzler> fMaskSwizzler; |
49 SkAutoTDeleteArray<uint8_t> fSrcBuffer; | 50 SkAutoTDeleteArray<uint8_t> fSrcBuffer; |
50 | 51 |
| 52 friend class SkBmpMaskScanlineDecoder; |
| 53 |
51 typedef SkBmpCodec INHERITED; | 54 typedef SkBmpCodec INHERITED; |
52 }; | 55 }; |
| 56 |
| 57 /* |
| 58 * Scanline decoder for mask bmps |
| 59 */ |
| 60 class SkBmpMaskScanlineDecoder : public SkScanlineDecoder { |
| 61 public: |
| 62 SkBmpMaskScanlineDecoder(SkBmpMaskCodec* codec); |
| 63 |
| 64 SkCodec::Result onStart(const SkImageInfo& dstInfo, const SkCodec::Options&
options, |
| 65 SkPMColor inputColorPtr[], int* inputColorCount) ove
rride; |
| 66 |
| 67 SkCodec::Result onGetScanlines(void* dst, int count, size_t rowBytes) overri
de; |
| 68 |
| 69 // TODO(msarett): Override default skipping with something more clever. |
| 70 // TODO(msarett): Consider other optimizations for this codec. |
| 71 |
| 72 private: |
| 73 SkAutoTDelete<SkBmpMaskCodec> fCodec; |
| 74 SkImageInfo fDstInfo; |
| 75 SkCodec::Options fOpts; |
| 76 |
| 77 typedef SkScanlineDecoder INHERITED; |
| 78 }; |
OLD | NEW |