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 "SkCodec_libgif.h" | 8 #include "SkCodec_libgif.h" |
9 #include "SkCodecPriv.h" | 9 #include "SkCodecPriv.h" |
10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 // Modify the dst pointer | 435 // Modify the dst pointer |
436 const int32_t dstBytesPerPixel = | 436 const int32_t dstBytesPerPixel = |
437 SkColorTypeBytesPerPixel(dstColorType); | 437 SkColorTypeBytesPerPixel(dstColorType); |
438 dst = SkTAddOffset<void*>(dst, | 438 dst = SkTAddOffset<void*>(dst, |
439 dstRowBytes * imageTop + | 439 dstRowBytes * imageTop + |
440 dstBytesPerPixel * imageLeft); | 440 dstBytesPerPixel * imageLeft); |
441 | 441 |
442 // Create the subset swizzler | 442 // Create the subset swizzler |
443 swizzler.reset(SkSwizzler::CreateSwizzler( | 443 swizzler.reset(SkSwizzler::CreateSwizzler( |
444 SkSwizzler::kIndex, colorTable, subsetDstInfo, | 444 SkSwizzler::kIndex, colorTable, subsetDstInfo, |
445 zeroInit)); | 445 zeroInit, this->getInfo().width())); |
446 } else { | 446 } else { |
447 // Create the fully dimensional swizzler | 447 // Create the fully dimensional swizzler |
448 swizzler.reset(SkSwizzler::CreateSwizzler( | 448 swizzler.reset(SkSwizzler::CreateSwizzler( |
449 SkSwizzler::kIndex, colorTable, dstInfo, zeroInit)); | 449 SkSwizzler::kIndex, colorTable, dstInfo, |
| 450 zeroInit, this->getInfo().width())); |
450 } | 451 } |
451 | 452 |
452 // Stores output from dgiflib and input to the swizzler | 453 // Stores output from dgiflib and input to the swizzler |
453 SkAutoTDeleteArray<uint8_t> | 454 SkAutoTDeleteArray<uint8_t> |
454 buffer(SkNEW_ARRAY(uint8_t, innerWidth)); | 455 buffer(SkNEW_ARRAY(uint8_t, innerWidth)); |
455 | 456 |
456 // Check the interlace flag and iterate over rows of the input | 457 // Check the interlace flag and iterate over rows of the input |
457 if (fGif->Image.Interlace) { | 458 if (fGif->Image.Interlace) { |
458 // In interlace mode, the rows of input are rearranged in | 459 // In interlace mode, the rows of input are rearranged in |
459 // the output image. We use an iterator to take care of | 460 // the output image. We use an iterator to take care of |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // giflib returns an error code if the record type is not known. | 572 // giflib returns an error code if the record type is not known. |
572 // We should catch this error immediately. | 573 // We should catch this error immediately. |
573 SkASSERT(false); | 574 SkASSERT(false); |
574 break; | 575 break; |
575 } | 576 } |
576 } while (TERMINATE_RECORD_TYPE != recordType); | 577 } while (TERMINATE_RECORD_TYPE != recordType); |
577 | 578 |
578 return gif_error("Could not find any images to decode in gif file.\n", | 579 return gif_error("Could not find any images to decode in gif file.\n", |
579 kInvalidInput); | 580 kInvalidInput); |
580 } | 581 } |
OLD | NEW |