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 "SkBmpRLECodec.h" | 8 #include "SkBmpRLECodec.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 {} | 32 {} |
33 | 33 |
34 /* | 34 /* |
35 * Initiates the bitmap decode | 35 * Initiates the bitmap decode |
36 */ | 36 */ |
37 SkCodec::Result SkBmpRLECodec::onGetPixels(const SkImageInfo& dstInfo, | 37 SkCodec::Result SkBmpRLECodec::onGetPixels(const SkImageInfo& dstInfo, |
38 void* dst, size_t dstRowBytes, | 38 void* dst, size_t dstRowBytes, |
39 const Options& opts, | 39 const Options& opts, |
40 SkPMColor* inputColorPtr, | 40 SkPMColor* inputColorPtr, |
41 int* inputColorCount) { | 41 int* inputColorCount) { |
42 if (!this->rewindIfNeeded()) { | |
43 return kCouldNotRewind; | |
44 } | |
45 if (opts.fSubset) { | 42 if (opts.fSubset) { |
46 // Subsets are not supported. | 43 // Subsets are not supported. |
47 return kUnimplemented; | 44 return kUnimplemented; |
48 } | 45 } |
49 if (dstInfo.dimensions() != this->getInfo().dimensions()) { | 46 if (dstInfo.dimensions() != this->getInfo().dimensions()) { |
50 SkCodecPrintf("Error: scaling not supported.\n"); | 47 SkCodecPrintf("Error: scaling not supported.\n"); |
51 return kInvalidScale; | 48 return kInvalidScale; |
52 } | 49 } |
53 if (!conversion_possible(dstInfo, this->getInfo())) { | 50 if (!conversion_possible(dstInfo, this->getInfo())) { |
54 SkCodecPrintf("Error: cannot convert input type to output type.\n"); | 51 SkCodecPrintf("Error: cannot convert input type to output type.\n"); |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 | 459 |
463 // Set the indicated number of pixels | 460 // Set the indicated number of pixels |
464 for (int which = 0; x < endX; x++) { | 461 for (int which = 0; x < endX; x++) { |
465 setPixel(dst, dstRowBytes, dstInfo, x, y, indices[which]); | 462 setPixel(dst, dstRowBytes, dstInfo, x, y, indices[which]); |
466 which = !which; | 463 which = !which; |
467 } | 464 } |
468 } | 465 } |
469 } | 466 } |
470 } | 467 } |
471 } | 468 } |
OLD | NEW |