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 "SkSampler.h" |
12 #include "SkTypes.h" | 12 #include "SkTypes.h" |
13 | 13 |
14 /* | 14 /* |
15 * 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 |
16 */ | 16 */ |
17 class SkBmpRLECodec : public SkBmpCodec { | 17 class SkBmpRLECodec : public SkBmpCodec { |
18 public: | 18 public: |
19 | 19 |
20 /* | 20 /* |
21 * Creates an instance of the decoder | 21 * Creates an instance of the decoder |
22 * | 22 * |
23 * Called only by SkBmpCodec::NewFromStream | 23 * Called only by SkBmpCodec::NewFromStream |
24 * There should be no other callers despite this being public | 24 * There should be no other callers despite this being public |
25 * | 25 * |
26 * @param srcInfo contains the source width and height | 26 * @param info contains the source width and height |
27 * @param stream the stream of encoded image data | 27 * @param stream the stream of encoded image data |
28 * @param bitsPerPixel the number of bits used to store each pixel | 28 * @param bitsPerPixel the number of bits used to store each pixel |
29 * @param numColors the number of colors in the color table | 29 * @param numColors the number of colors in the color table |
30 * @param bytesPerColor the number of bytes in the stream used to represent | 30 * @param bytesPerColor the number of bytes in the stream used to represent |
31 each color in the color table | 31 each color in the color table |
32 * @param offset the offset of the image pixel data from the end of the | 32 * @param offset the offset of the image pixel data from the end of the |
33 * headers | 33 * headers |
34 * @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 |
35 * @param RLEBytes indicates the amount of data left in the stream | 35 * @param RLEBytes indicates the amount of data left in the stream |
36 * after decoding the headers | 36 * after decoding the headers |
37 */ | 37 */ |
38 SkBmpRLECodec(const SkImageInfo& srcInfo, SkStream* stream, | 38 SkBmpRLECodec(const SkEncodedInfo& info, 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 size_t RLEBytes); | 41 size_t RLEBytes); |
42 | 42 |
43 int setSampleX(int); | 43 int setSampleX(int); |
44 | 44 |
45 protected: | 45 protected: |
46 | 46 |
47 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, | 47 Result onGetPixels(const SkImageInfo& dstInfo, void* dst, |
48 size_t dstRowBytes, const Options&, SkPMColor*, | 48 size_t dstRowBytes, const Options&, SkPMColor*, |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 SkAutoTDelete<SkSampler> fSampler; | 107 SkAutoTDelete<SkSampler> fSampler; |
108 | 108 |
109 // Scanline decodes allow the client to ask for a single scanline at a time. | 109 // Scanline decodes allow the client to ask for a single scanline at a time. |
110 // This can be tricky when the RLE encoding instructs the decoder to jump do
wn | 110 // This can be tricky when the RLE encoding instructs the decoder to jump do
wn |
111 // multiple lines. This field keeps track of lines that need to be skipped | 111 // multiple lines. This field keeps track of lines that need to be skipped |
112 // on subsequent calls to decodeRows(). | 112 // on subsequent calls to decodeRows(). |
113 int fLinesToSkip; | 113 int fLinesToSkip; |
114 | 114 |
115 typedef SkBmpCodec INHERITED; | 115 typedef SkBmpCodec INHERITED; |
116 }; | 116 }; |
OLD | NEW |