| 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 "SkCodec.h" | 8 #include "SkCodec.h" |
| 9 #include "SkColorTable.h" | 9 #include "SkColorTable.h" |
| 10 #include "SkImageInfo.h" | 10 #include "SkImageInfo.h" |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 enum BitmapInputFormat { | 79 enum BitmapInputFormat { |
| 80 kStandard_BitmapInputFormat, | 80 kStandard_BitmapInputFormat, |
| 81 kRLE_BitmapInputFormat, | 81 kRLE_BitmapInputFormat, |
| 82 kBitMask_BitmapInputFormat, | 82 kBitMask_BitmapInputFormat, |
| 83 kUnknown_BitmapInputFormat | 83 kUnknown_BitmapInputFormat |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 /* | 86 /* |
| 87 * | 87 * |
| 88 * Creates the color table | 88 * Creates the color table |
| 89 * | 89 * Sets colorCount to the new color count if it is non-NULL |
| 90 */ | 90 */ |
| 91 bool createColorTable(SkAlphaType alphaType); | 91 bool createColorTable(SkAlphaType alphaType, int* colorCount); |
| 92 | 92 |
| 93 /* | 93 /* |
| 94 * | 94 * |
| 95 * Creates a bmp decoder | 95 * Creates a bmp decoder |
| 96 * Reads enough of the stream to determine the image format | 96 * Reads enough of the stream to determine the image format |
| 97 * | 97 * |
| 98 */ | 98 */ |
| 99 static SkCodec* NewFromStream(SkStream*, bool isIco); | 99 static SkCodec* NewFromStream(SkStream*, bool isIco); |
| 100 | 100 |
| 101 /* | 101 /* |
| (...skipping 12 matching lines...) Expand all Loading... |
| 114 * | 114 * |
| 115 */ | 115 */ |
| 116 Result decodeMask(const SkImageInfo& dstInfo, void* dst, | 116 Result decodeMask(const SkImageInfo& dstInfo, void* dst, |
| 117 size_t dstRowBytes); | 117 size_t dstRowBytes); |
| 118 | 118 |
| 119 /* | 119 /* |
| 120 * | 120 * |
| 121 * Set an RLE pixel using the color table | 121 * Set an RLE pixel using the color table |
| 122 * | 122 * |
| 123 */ | 123 */ |
| 124 void setRLEPixel(SkPMColor* dst, size_t dstRowBytes, | 124 void setRLEPixel(void* dst, size_t dstRowBytes, |
| 125 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, | 125 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, |
| 126 uint8_t index); | 126 uint8_t index); |
| 127 /* | 127 /* |
| 128 * | 128 * |
| 129 * Set an RLE24 pixel from R, G, B values | 129 * Set an RLE24 pixel from R, G, B values |
| 130 * | 130 * |
| 131 */ | 131 */ |
| 132 void setRLE24Pixel(SkPMColor* dst, size_t dstRowBytes, | 132 void setRLE24Pixel(void* dst, size_t dstRowBytes, |
| 133 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, | 133 const SkImageInfo& dstInfo, uint32_t x, uint32_t y, |
| 134 uint8_t red, uint8_t green, uint8_t blue); | 134 uint8_t red, uint8_t green, uint8_t blue); |
| 135 | 135 |
| 136 /* | 136 /* |
| 137 * | 137 * |
| 138 * Performs the bitmap decoding for RLE input format | 138 * Performs the bitmap decoding for RLE input format |
| 139 * | 139 * |
| 140 */ | 140 */ |
| 141 Result decodeRLE(const SkImageInfo& dstInfo, void* dst, | 141 Result decodeRLE(const SkImageInfo& dstInfo, void* dst, |
| 142 size_t dstRowBytes); | 142 size_t dstRowBytes, const Options& opts); |
| 143 | 143 |
| 144 /* | 144 /* |
| 145 * | 145 * |
| 146 * Performs the bitmap decoding for standard input format | 146 * Performs the bitmap decoding for standard input format |
| 147 * | 147 * |
| 148 */ | 148 */ |
| 149 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes); | 149 Result decode(const SkImageInfo& dstInfo, void* dst, size_t dstRowBytes); |
| 150 | 150 |
| 151 /* | 151 /* |
| 152 * | 152 * |
| (...skipping 21 matching lines...) Expand all Loading... |
| 174 SkBmpCodec(const SkImageInfo& srcInfo, SkStream* stream, | 174 SkBmpCodec(const SkImageInfo& srcInfo, SkStream* stream, |
| 175 uint16_t bitsPerPixel, BitmapInputFormat format, | 175 uint16_t bitsPerPixel, BitmapInputFormat format, |
| 176 SkMasks* masks, uint32_t numColors, uint32_t bytesPerColor, | 176 SkMasks* masks, uint32_t numColors, uint32_t bytesPerColor, |
| 177 uint32_t offset, RowOrder rowOrder, size_t RLEBytes, | 177 uint32_t offset, RowOrder rowOrder, size_t RLEBytes, |
| 178 bool isIco); | 178 bool isIco); |
| 179 | 179 |
| 180 // Fields | 180 // Fields |
| 181 const uint16_t fBitsPerPixel; | 181 const uint16_t fBitsPerPixel; |
| 182 const BitmapInputFormat fInputFormat; | 182 const BitmapInputFormat fInputFormat; |
| 183 SkAutoTDelete<SkMasks> fMasks; // owned | 183 SkAutoTDelete<SkMasks> fMasks; // owned |
| 184 SkAutoTDelete<SkColorTable> fColorTable; // owned | 184 SkAutoTUnref<SkColorTable> fColorTable; // owned |
| 185 uint32_t fNumColors; | 185 uint32_t fNumColors; |
| 186 const uint32_t fBytesPerColor; | 186 const uint32_t fBytesPerColor; |
| 187 const uint32_t fOffset; | 187 const uint32_t fOffset; |
| 188 const RowOrder fRowOrder; | 188 const RowOrder fRowOrder; |
| 189 const size_t fRLEBytes; | 189 const size_t fRLEBytes; |
| 190 const bool fIsIco; | 190 const bool fIsIco; |
| 191 | 191 |
| 192 typedef SkCodec INHERITED; | 192 typedef SkCodec INHERITED; |
| 193 }; | 193 }; |
| OLD | NEW |