Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Side by Side Diff: third_party/WebKit/Source/platform/image-decoders/jpeg/JPEGImageDecoder.cpp

Issue 2749703002: Refactor ImageFrame::setSizeAndColorSpace() (Closed)
Patch Set: Fix alloc returned value flipped Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.setSizeAndColorSpace(info->output_width, info->output_height,
941 colorSpaceForSkImages())) 941 colorSpaceForSkImages()))
942 return setFailed(); 942 return setFailed();
943 943
944 buffer.zeroFillPixelData();
Noel Gordon 2017/03/14 06:30:41 Here and elsewhere you made this change, consider
Peter Kasting 2017/03/14 07:34:40 Hmm. It worries me that zeroFillPixelData() sets
cblume 2017/03/14 17:30:50 I think both of you had really good points. I woul
945
944 // The buffer is transparent outside the decoded area while the image is 946 // The buffer is transparent outside the decoded area while the image is
945 // loading. The image will be marked fully opaque in complete(). 947 // loading. The image will be marked fully opaque in complete().
946 buffer.setStatus(ImageFrame::FramePartial); 948 buffer.setStatus(ImageFrame::FramePartial);
947 buffer.setHasAlpha(true); 949 buffer.setHasAlpha(true);
948 950
949 // For JPEGs, the frame always fills the entire image. 951 // For JPEGs, the frame always fills the entire image.
950 buffer.setOriginalFrameRect(IntRect(IntPoint(), size())); 952 buffer.setOriginalFrameRect(IntRect(IntPoint(), size()));
951 } 953 }
952 954
953 #if defined(TURBO_JPEG_RGB_SWIZZLE) 955 #if defined(TURBO_JPEG_RGB_SWIZZLE)
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1009 // has failed. 1011 // has failed.
1010 if (!m_reader->decode(onlySize) && isAllDataReceived()) 1012 if (!m_reader->decode(onlySize) && isAllDataReceived())
1011 setFailed(); 1013 setFailed();
1012 1014
1013 // If decoding is done or failed, we don't need the JPEGImageReader anymore. 1015 // If decoding is done or failed, we don't need the JPEGImageReader anymore.
1014 if (isComplete(this, onlySize) || failed()) 1016 if (isComplete(this, onlySize) || failed())
1015 m_reader.reset(); 1017 m_reader.reset();
1016 } 1018 }
1017 1019
1018 } // namespace blink 1020 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698