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