OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006 Apple Computer, Inc. | 2 * Copyright (C) 2006 Apple Computer, Inc. |
3 * | 3 * |
4 * Portions are Copyright (C) 2001-6 mozilla.org | 4 * Portions are Copyright (C) 2001-6 mozilla.org |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Stuart Parmenter <stuart@mozilla.com> | 7 * Stuart Parmenter <stuart@mozilla.com> |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
715 } | 715 } |
716 | 716 |
717 void term_source(j_decompress_ptr jd) { | 717 void term_source(j_decompress_ptr jd) { |
718 reinterpret_cast_ptr<decoder_source_mgr*>(jd->src) | 718 reinterpret_cast_ptr<decoder_source_mgr*>(jd->src) |
719 ->reader->decoder() | 719 ->reader->decoder() |
720 ->complete(); | 720 ->complete(); |
721 } | 721 } |
722 | 722 |
723 JPEGImageDecoder::JPEGImageDecoder(AlphaOption alphaOption, | 723 JPEGImageDecoder::JPEGImageDecoder(AlphaOption alphaOption, |
724 ColorSpaceOption colorOptions, | 724 ColorSpaceOption colorOptions, |
| 725 sk_sp<SkColorSpace> targetColorSpace, |
725 size_t maxDecodedBytes) | 726 size_t maxDecodedBytes) |
726 : ImageDecoder(alphaOption, colorOptions, maxDecodedBytes) {} | 727 : ImageDecoder(alphaOption, |
| 728 colorOptions, |
| 729 std::move(targetColorSpace), |
| 730 maxDecodedBytes) {} |
727 | 731 |
728 JPEGImageDecoder::~JPEGImageDecoder() {} | 732 JPEGImageDecoder::~JPEGImageDecoder() {} |
729 | 733 |
730 bool JPEGImageDecoder::setSize(unsigned width, unsigned height) { | 734 bool JPEGImageDecoder::setSize(unsigned width, unsigned height) { |
731 if (!ImageDecoder::setSize(width, height)) | 735 if (!ImageDecoder::setSize(width, height)) |
732 return false; | 736 return false; |
733 | 737 |
734 if (!desiredScaleNumerator()) | 738 if (!desiredScaleNumerator()) |
735 return setFailed(); | 739 return setFailed(); |
736 | 740 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 | 942 |
939 // Initialize the framebuffer if needed. | 943 // Initialize the framebuffer if needed. |
940 ImageFrame& buffer = m_frameBufferCache[0]; | 944 ImageFrame& buffer = m_frameBufferCache[0]; |
941 if (buffer.getStatus() == ImageFrame::FrameEmpty) { | 945 if (buffer.getStatus() == ImageFrame::FrameEmpty) { |
942 ASSERT(info->output_width == | 946 ASSERT(info->output_width == |
943 static_cast<JDIMENSION>(m_decodedSize.width())); | 947 static_cast<JDIMENSION>(m_decodedSize.width())); |
944 ASSERT(info->output_height == | 948 ASSERT(info->output_height == |
945 static_cast<JDIMENSION>(m_decodedSize.height())); | 949 static_cast<JDIMENSION>(m_decodedSize.height())); |
946 | 950 |
947 if (!buffer.setSizeAndColorSpace(info->output_width, info->output_height, | 951 if (!buffer.setSizeAndColorSpace(info->output_width, info->output_height, |
948 colorSpace())) | 952 colorSpaceForSkImages())) |
949 return setFailed(); | 953 return setFailed(); |
950 | 954 |
951 // The buffer is transparent outside the decoded area while the image is | 955 // The buffer is transparent outside the decoded area while the image is |
952 // loading. The image will be marked fully opaque in complete(). | 956 // loading. The image will be marked fully opaque in complete(). |
953 buffer.setStatus(ImageFrame::FramePartial); | 957 buffer.setStatus(ImageFrame::FramePartial); |
954 buffer.setHasAlpha(true); | 958 buffer.setHasAlpha(true); |
955 | 959 |
956 // For JPEGs, the frame always fills the entire image. | 960 // For JPEGs, the frame always fills the entire image. |
957 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); | 961 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
958 } | 962 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1016 // has failed. | 1020 // has failed. |
1017 if (!m_reader->decode(onlySize) && isAllDataReceived()) | 1021 if (!m_reader->decode(onlySize) && isAllDataReceived()) |
1018 setFailed(); | 1022 setFailed(); |
1019 | 1023 |
1020 // If decoding is done or failed, we don't need the JPEGImageReader anymore. | 1024 // If decoding is done or failed, we don't need the JPEGImageReader anymore. |
1021 if (isComplete(this, onlySize) || failed()) | 1025 if (isComplete(this, onlySize) || failed()) |
1022 m_reader.reset(); | 1026 m_reader.reset(); |
1023 } | 1027 } |
1024 | 1028 |
1025 } // namespace blink | 1029 } // namespace blink |
OLD | NEW |