| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 m_offset(offset) {} | 53 m_offset(offset) {} |
| 54 | 54 |
| 55 PNGImageDecoder::~PNGImageDecoder() {} | 55 PNGImageDecoder::~PNGImageDecoder() {} |
| 56 | 56 |
| 57 inline float pngFixedToFloat(png_fixed_point x) { | 57 inline float pngFixedToFloat(png_fixed_point x) { |
| 58 return ((float)x) * 0.00001f; | 58 return ((float)x) * 0.00001f; |
| 59 } | 59 } |
| 60 | 60 |
| 61 inline sk_sp<SkColorSpace> readColorSpace(png_structp png, png_infop info) { | 61 inline sk_sp<SkColorSpace> readColorSpace(png_structp png, png_infop info) { |
| 62 if (png_get_valid(png, info, PNG_INFO_sRGB)) { | 62 if (png_get_valid(png, info, PNG_INFO_sRGB)) { |
| 63 return SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); | 63 return SkColorSpace::MakeSRGB(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 png_charp name = nullptr; | 66 png_charp name = nullptr; |
| 67 int compression = 0; | 67 int compression = 0; |
| 68 png_bytep profile = nullptr; | 68 png_bytep profile = nullptr; |
| 69 png_uint_32 length = 0; | 69 png_uint_32 length = 0; |
| 70 if (png_get_iCCP(png, info, &name, &compression, &profile, &length)) { | 70 if (png_get_iCCP(png, info, &name, &compression, &profile, &length)) { |
| 71 return SkColorSpace::MakeICC(profile, length); | 71 return SkColorSpace::MakeICC(profile, length); |
| 72 } | 72 } |
| 73 | 73 |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 // has failed. | 381 // has failed. |
| 382 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) | 382 if (!m_reader->decode(*m_data, onlySize) && isAllDataReceived()) |
| 383 setFailed(); | 383 setFailed(); |
| 384 | 384 |
| 385 // 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. |
| 386 if (isComplete(this) || failed()) | 386 if (isComplete(this) || failed()) |
| 387 m_reader.reset(); | 387 m_reader.reset(); |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace blink | 390 } // namespace blink |
| OLD | NEW |