| 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 919 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 930 jpeg_decompress_struct* info = m_reader->info(); | 930 jpeg_decompress_struct* info = m_reader->info(); |
| 931 | 931 |
| 932 // Initialize the framebuffer if needed. | 932 // Initialize the framebuffer if needed. |
| 933 ImageFrame& buffer = m_frameBufferCache[0]; | 933 ImageFrame& buffer = m_frameBufferCache[0]; |
| 934 if (buffer.getStatus() == ImageFrame::FrameEmpty) { | 934 if (buffer.getStatus() == ImageFrame::FrameEmpty) { |
| 935 DCHECK_EQ(info->output_width, | 935 DCHECK_EQ(info->output_width, |
| 936 static_cast<JDIMENSION>(m_decodedSize.width())); | 936 static_cast<JDIMENSION>(m_decodedSize.width())); |
| 937 DCHECK_EQ(info->output_height, | 937 DCHECK_EQ(info->output_height, |
| 938 static_cast<JDIMENSION>(m_decodedSize.height())); | 938 static_cast<JDIMENSION>(m_decodedSize.height())); |
| 939 | 939 |
| 940 if (!buffer.setSizeAndColorSpace(info->output_width, info->output_height, | 940 if (!buffer.allocatePixelData(info->output_width, info->output_height, |
| 941 colorSpaceForSkImages())) | 941 colorSpaceForSkImages())) |
| 942 return setFailed(); | 942 return setFailed(); |
| 943 | 943 |
| 944 buffer.zeroFillPixelData(); |
| 944 // The buffer is transparent outside the decoded area while the image is | 945 // The buffer is transparent outside the decoded area while the image is |
| 945 // loading. The image will be marked fully opaque in complete(). | 946 // loading. The image will be marked fully opaque in complete(). |
| 946 buffer.setStatus(ImageFrame::FramePartial); | 947 buffer.setStatus(ImageFrame::FramePartial); |
| 947 buffer.setHasAlpha(true); | 948 buffer.setHasAlpha(true); |
| 948 | 949 |
| 949 // For JPEGs, the frame always fills the entire image. | 950 // For JPEGs, the frame always fills the entire image. |
| 950 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); | 951 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
| 951 } | 952 } |
| 952 | 953 |
| 953 #if defined(TURBO_JPEG_RGB_SWIZZLE) | 954 #if defined(TURBO_JPEG_RGB_SWIZZLE) |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1009 // has failed. | 1010 // has failed. |
| 1010 if (!m_reader->decode(onlySize) && isAllDataReceived()) | 1011 if (!m_reader->decode(onlySize) && isAllDataReceived()) |
| 1011 setFailed(); | 1012 setFailed(); |
| 1012 | 1013 |
| 1013 // If decoding is done or failed, we don't need the JPEGImageReader anymore. | 1014 // If decoding is done or failed, we don't need the JPEGImageReader anymore. |
| 1014 if (isComplete(this, onlySize) || failed()) | 1015 if (isComplete(this, onlySize) || failed()) |
| 1015 m_reader.reset(); | 1016 m_reader.reset(); |
| 1016 } | 1017 } |
| 1017 | 1018 |
| 1018 } // namespace blink | 1019 } // namespace blink |
| OLD | NEW |