| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 2001 mozilla.org | 5 * Portions are Copyright (C) 2001 mozilla.org |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Stuart Parmenter <stuart@mozilla.com> | 8 * Stuart Parmenter <stuart@mozilla.com> |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 #include "platform/image-decoders/png/PNGImageDecoder.h" | 39 #include "platform/image-decoders/png/PNGImageDecoder.h" |
| 40 | 40 |
| 41 #include "platform/image-decoders/png/PNGImageReader.h" | 41 #include "platform/image-decoders/png/PNGImageReader.h" |
| 42 #include "png.h" | 42 #include "png.h" |
| 43 #include "wtf/PtrUtil.h" | 43 #include "wtf/PtrUtil.h" |
| 44 #include <memory> | 44 #include <memory> |
| 45 | 45 |
| 46 namespace blink { | 46 namespace blink { |
| 47 | 47 |
| 48 PNGImageDecoder::PNGImageDecoder(AlphaOption alphaOption, | 48 PNGImageDecoder::PNGImageDecoder(AlphaOption alphaOption, |
| 49 ColorSpaceOption colorOptions, | 49 const ColorBehavior& colorBehavior, |
| 50 sk_sp<SkColorSpace> targetColorSpace, | |
| 51 size_t maxDecodedBytes, | 50 size_t maxDecodedBytes, |
| 52 size_t offset) | 51 size_t offset) |
| 53 : ImageDecoder(alphaOption, | 52 : ImageDecoder(alphaOption, colorBehavior, maxDecodedBytes), |
| 54 colorOptions, | |
| 55 std::move(targetColorSpace), | |
| 56 maxDecodedBytes), | |
| 57 m_offset(offset) {} | 53 m_offset(offset) {} |
| 58 | 54 |
| 59 PNGImageDecoder::~PNGImageDecoder() {} | 55 PNGImageDecoder::~PNGImageDecoder() {} |
| 60 | 56 |
| 61 inline float pngFixedToFloat(png_fixed_point x) { | 57 inline float pngFixedToFloat(png_fixed_point x) { |
| 62 return ((float)x) * 0.00001f; | 58 return ((float)x) * 0.00001f; |
| 63 } | 59 } |
| 64 | 60 |
| 65 inline sk_sp<SkColorSpace> readColorSpace(png_structp png, png_infop info) { | 61 inline sk_sp<SkColorSpace> readColorSpace(png_structp png, png_infop info) { |
| 66 if (png_get_valid(png, info, PNG_INFO_sRGB)) { | 62 if (png_get_valid(png, info, PNG_INFO_sRGB)) { |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 // has failed. | 381 // has failed. |
| 386 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 382 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
| 387 setFailed(); | 383 setFailed(); |
| 388 | 384 |
| 389 // If decoding is done or failed, we don't need the PNGImageReader anymore. | 385 // If decoding is done or failed, we don't need the PNGImageReader anymore. |
| 390 if (isComplete(this) || failed()) | 386 if (isComplete(this) || failed()) |
| 391 m_reader.reset(); | 387 m_reader.reset(); |
| 392 } | 388 } |
| 393 | 389 |
| 394 } // namespace blink | 390 } // namespace blink |
| OLD | NEW |