| 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" |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 default: | 189 default: |
| 190 SkASSERT(false); | 190 SkASSERT(false); |
| 191 return false; | 191 return false; |
| 192 } | 192 } |
| 193 | 193 |
| 194 // Get a pointer to the color table if it exists | 194 // Get a pointer to the color table if it exists |
| 195 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); | 195 const SkPMColor* colorPtr = get_color_ptr(fColorTable.get()); |
| 196 | 196 |
| 197 // Create swizzler | 197 // Create swizzler |
| 198 fSwizzler.reset(SkSwizzler::CreateSwizzler(config, | 198 fSwizzler.reset(SkSwizzler::CreateSwizzler(config, |
| 199 colorPtr, dstInfo, opts.fZeroInitialized, this->getInfo())); | 199 colorPtr, dstInfo, opts.fZeroInitialized)); |
| 200 | 200 |
| 201 if (nullptr == fSwizzler.get()) { | 201 if (nullptr == fSwizzler.get()) { |
| 202 return false; | 202 return false; |
| 203 } | 203 } |
| 204 return true; | 204 return true; |
| 205 } | 205 } |
| 206 | 206 |
| 207 SkCodec::Result SkBmpStandardCodec::prepareToDecode(const SkImageInfo& dstInfo, | 207 SkCodec::Result SkBmpStandardCodec::prepareToDecode(const SkImageInfo& dstInfo, |
| 208 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo
lorCount) { | 208 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo
lorCount) { |
| 209 // Create the color table if necessary and prepare the stream for decode | 209 // Create the color table if necessary and prepare the stream for decode |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 int modulus; | 287 int modulus; |
| 288 SkTDivMod(x, 8, "ient, &modulus); | 288 SkTDivMod(x, 8, "ient, &modulus); |
| 289 uint32_t shift = 7 - modulus; | 289 uint32_t shift = 7 - modulus; |
| 290 uint32_t alphaBit = | 290 uint32_t alphaBit = |
| 291 (fSrcBuffer.get()[quotient] >> shift) & 0x1; | 291 (fSrcBuffer.get()[quotient] >> shift) & 0x1; |
| 292 dstRow[x] &= alphaBit - 1; | 292 dstRow[x] &= alphaBit - 1; |
| 293 } | 293 } |
| 294 } | 294 } |
| 295 return kSuccess; | 295 return kSuccess; |
| 296 } | 296 } |
| OLD | NEW |