| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 // Set the indicated number of pixels | 449 // Set the indicated number of pixels |
| 450 for (int which = 0; x < endX; x++) { | 450 for (int which = 0; x < endX; x++) { |
| 451 setPixel(dst, dstRowBytes, dstInfo, x, y, | 451 setPixel(dst, dstRowBytes, dstInfo, x, y, |
| 452 indices[which]); | 452 indices[which]); |
| 453 which = !which; | 453 which = !which; |
| 454 } | 454 } |
| 455 } | 455 } |
| 456 } | 456 } |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 |
| 460 SkCodec::Result SkBmpRLECodec::onStart(const SkImageInfo& dstInfo, |
| 461 const SkCodec::Options& options, SkPMColor inputColorPtr[], int* inputCo
lorCount) { |
| 462 // Create the color table if necessary and prepare the stream for decode |
| 463 // Note that if it is non-NULL, inputColorCount will be modified |
| 464 if (!this->createColorTable(inputColorCount)) { |
| 465 SkCodecPrintf("Error: could not create color table.\n"); |
| 466 return SkCodec::kInvalidInput; |
| 467 } |
| 468 |
| 469 // Copy the color table to the client if necessary |
| 470 copy_color_table(dstInfo, this->fColorTable, inputColorPtr, inputColorCount)
; |
| 471 |
| 472 // Initialize a buffer for encoded RLE data |
| 473 if (!this->initializeStreamBuffer()) { |
| 474 SkCodecPrintf("Error: cannot initialize swizzler.\n"); |
| 475 return SkCodec::kInvalidConversion; |
| 476 } |
| 477 |
| 478 return SkCodec::kSuccess; |
| 479 } |
| OLD | NEW |