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 // The buffer is transparent outside the decoded area while the image is | 944 buffer.zeroFillPixelData(); |
945 // loading. The image will be marked fully opaque in complete(). | |
946 buffer.setStatus(ImageFrame::FramePartial); | 945 buffer.setStatus(ImageFrame::FramePartial); |
947 buffer.setHasAlpha(true); | |
948 | 946 |
949 // For JPEGs, the frame always fills the entire image. | 947 // For JPEGs, the frame always fills the entire image. |
950 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); | 948 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); |
951 } | 949 } |
952 | 950 |
953 #if defined(TURBO_JPEG_RGB_SWIZZLE) | 951 #if defined(TURBO_JPEG_RGB_SWIZZLE) |
954 if (turboSwizzled(info->out_color_space)) { | 952 if (turboSwizzled(info->out_color_space)) { |
955 while (info->output_scanline < info->output_height) { | 953 while (info->output_scanline < info->output_height) { |
956 unsigned char* row = reinterpret_cast_ptr<unsigned char*>( | 954 unsigned char* row = reinterpret_cast_ptr<unsigned char*>( |
957 buffer.getAddr(0, info->output_scanline)); | 955 buffer.getAddr(0, info->output_scanline)); |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1009 // has failed. | 1007 // has failed. |
1010 if (!m_reader->decode(onlySize) && isAllDataReceived()) | 1008 if (!m_reader->decode(onlySize) && isAllDataReceived()) |
1011 setFailed(); | 1009 setFailed(); |
1012 | 1010 |
1013 // If decoding is done or failed, we don't need the JPEGImageReader anymore. | 1011 // If decoding is done or failed, we don't need the JPEGImageReader anymore. |
1014 if (isComplete(this, onlySize) || failed()) | 1012 if (isComplete(this, onlySize) || failed()) |
1015 m_reader.reset(); | 1013 m_reader.reset(); |
1016 } | 1014 } |
1017 | 1015 |
1018 } // namespace blink | 1016 } // namespace blink |
OLD | NEW |