| 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 "SkBmpStandardCodec.h" | 8 #include "SkBmpStandardCodec.h" |
| 9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| 11 #include "SkScanlineDecoder.h" | |
| 12 #include "SkStream.h" | 11 #include "SkStream.h" |
| 13 | 12 |
| 14 /* | 13 /* |
| 15 * Creates an instance of the decoder | 14 * Creates an instance of the decoder |
| 16 * Called only by NewFromStream | 15 * Called only by NewFromStream |
| 17 */ | 16 */ |
| 18 SkBmpStandardCodec::SkBmpStandardCodec(const SkImageInfo& info, SkStream* stream
, | 17 SkBmpStandardCodec::SkBmpStandardCodec(const SkImageInfo& info, SkStream* stream
, |
| 19 uint16_t bitsPerPixel, uint32_t numColors
, | 18 uint16_t bitsPerPixel, uint32_t numColors
, |
| 20 uint32_t bytesPerColor, uint32_t offset, | 19 uint32_t bytesPerColor, uint32_t offset, |
| 21 SkScanlineDecoder::SkScanlineOrder rowOrd
er, bool inIco) | 20 SkCodec::SkScanlineOrder rowOrder, bool i
nIco) |
| 22 : INHERITED(info, stream, bitsPerPixel, rowOrder) | 21 : INHERITED(info, stream, bitsPerPixel, rowOrder) |
| 23 , fColorTable(nullptr) | 22 , fColorTable(nullptr) |
| 24 , fNumColors(this->computeNumColors(numColors)) | 23 , fNumColors(this->computeNumColors(numColors)) |
| 25 , fBytesPerColor(bytesPerColor) | 24 , fBytesPerColor(bytesPerColor) |
| 26 , fOffset(offset) | 25 , fOffset(offset) |
| 27 , fSwizzler(nullptr) | 26 , fSwizzler(nullptr) |
| 28 , fSrcRowBytes(SkAlign4(compute_row_bytes(this->getInfo().width(), this->bit
sPerPixel()))) | 27 , fSrcRowBytes(SkAlign4(compute_row_bytes(this->getInfo().width(), this->bit
sPerPixel()))) |
| 29 , fSrcBuffer(new uint8_t [fSrcRowBytes]) | 28 , fSrcBuffer(new uint8_t [fSrcRowBytes]) |
| 30 , fInIco(inIco) | 29 , fInIco(inIco) |
| 31 {} | 30 {} |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 int modulus; | 290 int modulus; |
| 292 SkTDivMod(x, 8, "ient, &modulus); | 291 SkTDivMod(x, 8, "ient, &modulus); |
| 293 uint32_t shift = 7 - modulus; | 292 uint32_t shift = 7 - modulus; |
| 294 uint32_t alphaBit = | 293 uint32_t alphaBit = |
| 295 (fSrcBuffer.get()[quotient] >> shift) & 0x1; | 294 (fSrcBuffer.get()[quotient] >> shift) & 0x1; |
| 296 dstRow[x] &= alphaBit - 1; | 295 dstRow[x] &= alphaBit - 1; |
| 297 } | 296 } |
| 298 } | 297 } |
| 299 return kSuccess; | 298 return kSuccess; |
| 300 } | 299 } |
| OLD | NEW |