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