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 "SkBitmap.h" | 11 #include "SkBitmap.h" |
12 #include "SkMath.h" | 12 #include "SkMath.h" |
13 #include "SkPngCodec.h" | 13 #include "SkPngCodec.h" |
14 #include "SkPngFilters.h" | 14 #include "SkPngFilters.h" |
15 #include "SkSize.h" | 15 #include "SkSize.h" |
16 #include "SkStream.h" | 16 #include "SkStream.h" |
17 #include "SkSwizzler.h" | 17 #include "SkSwizzler.h" |
18 #include "SkTemplates.h" | 18 #include "SkTemplates.h" |
19 | 19 |
20 #if defined(__SSE2__) | 20 // png_struct::read_filter[] was added in libpng 1.5.7. |
| 21 #if defined(__SSE2__) && PNG_LIBPNG_VER >= 10507 |
21 #include "pngstruct.h" | 22 #include "pngstruct.h" |
22 | 23 |
23 extern "C" void sk_png_init_filter_functions_sse2(png_structp png, unsigned
int bpp) { | 24 extern "C" void sk_png_init_filter_functions_sse2(png_structp png, unsigned
int bpp) { |
24 if (bpp == 3) { | 25 if (bpp == 3) { |
25 png->read_filter[PNG_FILTER_VALUE_SUB -1] = sk_sub3_sse2; | 26 png->read_filter[PNG_FILTER_VALUE_SUB -1] = sk_sub3_sse2; |
26 png->read_filter[PNG_FILTER_VALUE_AVG -1] = sk_avg3_sse2; | 27 png->read_filter[PNG_FILTER_VALUE_AVG -1] = sk_avg3_sse2; |
27 png->read_filter[PNG_FILTER_VALUE_PAETH-1] = sk_paeth3_sse2; | 28 png->read_filter[PNG_FILTER_VALUE_PAETH-1] = sk_paeth3_sse2; |
28 } | 29 } |
29 if (bpp == 4) { | 30 if (bpp == 4) { |
30 png->read_filter[PNG_FILTER_VALUE_SUB -1] = sk_sub4_sse2; | 31 png->read_filter[PNG_FILTER_VALUE_SUB -1] = sk_sub4_sse2; |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 } | 797 } |
797 | 798 |
798 if (1 == numberPasses) { | 799 if (1 == numberPasses) { |
799 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk
Reader, | 800 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk
Reader, |
800 png_ptr, info_ptr, bitDepth); | 801 png_ptr, info_ptr, bitDepth); |
801 } | 802 } |
802 | 803 |
803 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
chunkReader, | 804 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
chunkReader, |
804 png_ptr, info_ptr, bitDepth, numbe
rPasses); | 805 png_ptr, info_ptr, bitDepth, numbe
rPasses); |
805 } | 806 } |
OLD | NEW |