| 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 "SkOpts.h" | 13 #include "SkOpts.h" |
| 14 #include "SkPngCodec.h" | 14 #include "SkPngCodec.h" |
| 15 #include "SkPngFilters.h" | 15 #include "SkPngFilters.h" |
| 16 #include "SkSize.h" | 16 #include "SkSize.h" |
| 17 #include "SkStream.h" | 17 #include "SkStream.h" |
| 18 #include "SkSwizzler.h" | 18 #include "SkSwizzler.h" |
| 19 #include "SkTemplates.h" | 19 #include "SkTemplates.h" |
| 20 | 20 |
| 21 // png_struct::read_filter[] was added in libpng 1.5.7. | 21 // png_struct::read_filter[] was added in libpng 1.5.7. |
| 22 #if defined(__SSE2__) && PNG_LIBPNG_VER >= 10507 | 22 #if defined(__SSE2__) && PNG_LIBPNG_VER >= 10507 && !defined(PNG_SKIP_SKIA_OPTS) |
| 23 #include "pngstruct.h" | 23 #include "pngstruct.h" |
| 24 | 24 |
| 25 extern "C" void sk_png_init_filter_functions_sse2(png_structp png, unsigned
int bpp) { | 25 extern "C" void sk_png_init_filter_functions_sse2(png_structp png, unsigned
int bpp) { |
| 26 if (bpp == 3) { | 26 if (bpp == 3) { |
| 27 png->read_filter[PNG_FILTER_VALUE_SUB -1] = sk_sub3_sse2; | 27 png->read_filter[PNG_FILTER_VALUE_SUB -1] = sk_sub3_sse2; |
| 28 png->read_filter[PNG_FILTER_VALUE_AVG -1] = sk_avg3_sse2; | 28 png->read_filter[PNG_FILTER_VALUE_AVG -1] = sk_avg3_sse2; |
| 29 png->read_filter[PNG_FILTER_VALUE_PAETH-1] = sk_paeth3_sse2; | 29 png->read_filter[PNG_FILTER_VALUE_PAETH-1] = sk_paeth3_sse2; |
| 30 } | 30 } |
| 31 if (bpp == 4) { | 31 if (bpp == 4) { |
| 32 png->read_filter[PNG_FILTER_VALUE_SUB -1] = sk_sub4_sse2; | 32 png->read_filter[PNG_FILTER_VALUE_SUB -1] = sk_sub4_sse2; |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 758 } |
| 759 | 759 |
| 760 if (1 == numberPasses) { | 760 if (1 == numberPasses) { |
| 761 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk
Reader, | 761 return new SkPngScanlineDecoder(imageInfo, streamDeleter.detach(), chunk
Reader, |
| 762 png_ptr, info_ptr, bitDepth); | 762 png_ptr, info_ptr, bitDepth); |
| 763 } | 763 } |
| 764 | 764 |
| 765 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
chunkReader, | 765 return new SkPngInterlacedScanlineDecoder(imageInfo, streamDeleter.detach(),
chunkReader, |
| 766 png_ptr, info_ptr, bitDepth, numbe
rPasses); | 766 png_ptr, info_ptr, bitDepth, numbe
rPasses); |
| 767 } | 767 } |
| OLD | NEW |