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" |
| 11 #include "SkSampler.h" |
11 #include "SkTypes.h" | 12 #include "SkTypes.h" |
12 | 13 |
13 /* | 14 /* |
14 * This class implements the decoding for bmp images that use an RLE encoding | 15 * This class implements the decoding for bmp images that use an RLE encoding |
15 */ | 16 */ |
16 class SkBmpRLECodec : public SkBmpCodec { | 17 class SkBmpRLECodec : public SkBmpCodec { |
17 public: | 18 public: |
18 | 19 |
19 /* | 20 /* |
20 * Creates an instance of the decoder | 21 * Creates an instance of the decoder |
(...skipping 11 matching lines...) Expand all Loading... |
32 * headers | 33 * headers |
33 * @param rowOrder indicates whether rows are ordered top-down or bottom-up | 34 * @param rowOrder indicates whether rows are ordered top-down or bottom-up |
34 * @param RLEBytes indicates the amount of data left in the stream | 35 * @param RLEBytes indicates the amount of data left in the stream |
35 * after decoding the headers | 36 * after decoding the headers |
36 */ | 37 */ |
37 SkBmpRLECodec(const SkImageInfo& srcInfo, SkStream* stream, | 38 SkBmpRLECodec(const SkImageInfo& srcInfo, SkStream* stream, |
38 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, | 39 uint16_t bitsPerPixel, uint32_t numColors, uint32_t bytesPerColor, |
39 uint32_t offset, SkCodec::SkScanlineOrder rowOrder, | 40 uint32_t offset, SkCodec::SkScanlineOrder rowOrder, |
40 size_t RLEBytes); | 41 size_t RLEBytes); |
41 | 42 |
| 43 int setSampleX(int); |
| 44 |
42 protected: | 45 protected: |
43 | 46 |
44 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | 47 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
45 size_t dstRowBytes, const Options&, SkPMColor*, | 48 size_t dstRowBytes, const Options&, SkPMColor*, |
46 int*) override; | 49 int*) override; |
47 | 50 |
48 SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, | 51 SkCodec::Result prepareToDecode(const SkImageInfo& dstInfo, |
49 const SkCodec::Options& options, SkPMColor inputColorPtr[], | 52 const SkCodec::Options& options, SkPMColor inputColorPtr[], |
50 int* inputColorCount) override; | 53 int* inputColorCount) override; |
51 | 54 |
(...skipping 25 matching lines...) Expand all Loading... |
77 /* | 80 /* |
78 * Set an RLE24 pixel from R, G, B values | 81 * Set an RLE24 pixel from R, G, B values |
79 */ | 82 */ |
80 void setRGBPixel(void* dst, size_t dstRowBytes, | 83 void setRGBPixel(void* dst, size_t dstRowBytes, |
81 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, | 84 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, |
82 uint8_t red, uint8_t green, uint8_t blue); | 85 uint8_t red, uint8_t green, uint8_t blue); |
83 | 86 |
84 Result decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, | 87 Result decodeRows(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes, |
85 const Options& opts) override; | 88 const Options& opts) override; |
86 | 89 |
| 90 SkSampler* getSampler() override; |
| 91 |
87 SkAutoTUnref<SkColorTable> fColorTable; // owned | 92 SkAutoTUnref<SkColorTable> fColorTable; // owned |
88 const uint32_t fNumColors; | 93 const uint32_t fNumColors; |
89 const uint32_t fBytesPerColor; | 94 const uint32_t fBytesPerColor; |
90 const uint32_t fOffset; | 95 const uint32_t fOffset; |
91 SkAutoTDeleteArray<uint8_t> fStreamBuffer; | 96 SkAutoTDeleteArray<uint8_t> fStreamBuffer; |
92 size_t fRLEBytes; | 97 size_t fRLEBytes; |
93 uint32_t fCurrRLEByte; | 98 uint32_t fCurrRLEByte; |
94 int fSampleX; | 99 int fSampleX; |
| 100 SkAutoTDelete<SkSampler> fSampler; |
95 | 101 |
96 typedef SkBmpCodec INHERITED; | 102 typedef SkBmpCodec INHERITED; |
97 }; | 103 }; |
OLD | NEW |