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 19 matching lines...) Expand all Loading... |
30 {} | 30 {} |
31 | 31 |
32 /* | 32 /* |
33 * Initiates the bitmap decode | 33 * Initiates the bitmap decode |
34 */ | 34 */ |
35 SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo, | 35 SkCodec::Result SkBmpStandardCodec::onGetPixels(const SkImageInfo& dstInfo, |
36 void* dst, size_t dstRowBytes, | 36 void* dst, size_t dstRowBytes, |
37 const Options& opts, | 37 const Options& opts, |
38 SkPMColor* inputColorPtr, | 38 SkPMColor* inputColorPtr, |
39 int* inputColorCount) { | 39 int* inputColorCount) { |
40 if (!this->rewindIfNeeded()) { | |
41 return kCouldNotRewind; | |
42 } | |
43 if (opts.fSubset) { | 40 if (opts.fSubset) { |
44 // Subsets are not supported. | 41 // Subsets are not supported. |
45 return kUnimplemented; | 42 return kUnimplemented; |
46 } | 43 } |
47 if (dstInfo.dimensions() != this->getInfo().dimensions()) { | 44 if (dstInfo.dimensions() != this->getInfo().dimensions()) { |
48 SkCodecPrintf("Error: scaling not supported.\n"); | 45 SkCodecPrintf("Error: scaling not supported.\n"); |
49 return kInvalidScale; | 46 return kInvalidScale; |
50 } | 47 } |
51 if (!conversion_possible(dstInfo, this->getInfo())) { | 48 if (!conversion_possible(dstInfo, this->getInfo())) { |
52 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 49 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 int modulus; | 287 int modulus; |
291 SkTDivMod(x, 8, "ient, &modulus); | 288 SkTDivMod(x, 8, "ient, &modulus); |
292 uint32_t shift = 7 - modulus; | 289 uint32_t shift = 7 - modulus; |
293 uint32_t alphaBit = | 290 uint32_t alphaBit = |
294 (fSrcBuffer.get()[quotient] >> shift) & 0x1; | 291 (fSrcBuffer.get()[quotient] >> shift) & 0x1; |
295 dstRow[x] &= alphaBit - 1; | 292 dstRow[x] &= alphaBit - 1; |
296 } | 293 } |
297 } | 294 } |
298 return kSuccess; | 295 return kSuccess; |
299 } | 296 } |
OLD | NEW |