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 "SkCodecPriv.h" | 8 #include "SkCodecPriv.h" |
9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
10 #include "SkColorTable.h" | 10 #include "SkColorTable.h" |
11 #include "SkGifCodec.h" | 11 #include "SkGifCodec.h" |
12 #include "SkStream.h" | 12 #include "SkStream.h" |
13 #include "SkSwizzler.h" | 13 #include "SkSwizzler.h" |
14 #include "SkUtils.h" | 14 #include "SkUtils.h" |
15 | 15 |
| 16 #include "gif_lib.h" |
| 17 |
| 18 #if (GIFLIB_MAJOR * 1000 + GIFLIB_MINOR) < 5001 |
| 19 bool SkGifCodec::IsGif(const void*, size_t) { return false; } |
| 20 SkCodec* SkGifCodec::NewFromStream(SkStream* s) { delete s; return nullptr;
} |
| 21 |
| 22 #else |
| 23 |
16 /* | 24 /* |
17 * Checks the start of the stream to see if the image is a gif | 25 * Checks the start of the stream to see if the image is a gif |
18 */ | 26 */ |
19 bool SkGifCodec::IsGif(const void* buf, size_t bytesRead) { | 27 bool SkGifCodec::IsGif(const void* buf, size_t bytesRead) { |
20 if (bytesRead >= GIF_STAMP_LEN) { | 28 if (bytesRead >= GIF_STAMP_LEN) { |
21 if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 || | 29 if (memcmp(GIF_STAMP, buf, GIF_STAMP_LEN) == 0 || |
22 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || | 30 memcmp(GIF87_STAMP, buf, GIF_STAMP_LEN) == 0 || |
23 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) | 31 memcmp(GIF89_STAMP, buf, GIF_STAMP_LEN) == 0) |
24 { | 32 { |
25 return true; | 33 return true; |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 int SkGifCodec::onOutputScanline(int inputScanline) const { | 587 int SkGifCodec::onOutputScanline(int inputScanline) const { |
580 if (fGif->Image.Interlace) { | 588 if (fGif->Image.Interlace) { |
581 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { | 589 if (inputScanline < fFrameRect.top() || inputScanline >= fFrameRect.bott
om()) { |
582 return inputScanline; | 590 return inputScanline; |
583 } | 591 } |
584 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + | 592 return get_output_row_interlaced(inputScanline - fFrameRect.top(), fFram
eRect.height()) + |
585 fFrameRect.top(); | 593 fFrameRect.top(); |
586 } | 594 } |
587 return inputScanline; | 595 return inputScanline; |
588 } | 596 } |
| 597 |
| 598 #endif |
OLD | NEW |