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

Side by Side Diff: Source/core/platform/image-decoders/ImageDecoder.cpp

Issue 14317005: Checking if frame is complete and access duration doesn't need a decode (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: done Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008-2009 Torch Mobile, Inc. 2 * Copyright (C) 2008-2009 Torch Mobile, 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 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 return adoptPtr(new WEBPImageDecoder(alphaOption, gammaAndColorProfileOp tion)); 113 return adoptPtr(new WEBPImageDecoder(alphaOption, gammaAndColorProfileOp tion));
114 114
115 if (matchesBMPSignature(contents)) 115 if (matchesBMPSignature(contents))
116 return adoptPtr(new BMPImageDecoder(alphaOption, gammaAndColorProfileOpt ion)); 116 return adoptPtr(new BMPImageDecoder(alphaOption, gammaAndColorProfileOpt ion));
117 117
118 return nullptr; 118 return nullptr;
119 } 119 }
120 120
121 bool ImageDecoder::frameHasAlphaAtIndex(size_t index) const 121 bool ImageDecoder::frameHasAlphaAtIndex(size_t index) const
122 { 122 {
123 if (m_frameBufferCache.size() <= index) 123 return !frameIsCompleteAtIndex(index) || m_frameBufferCache[index].hasAlpha( );
124 return true; 124 }
125 if (m_frameBufferCache[index].status() == ImageFrame::FrameComplete) 125
126 return m_frameBufferCache[index].hasAlpha(); 126 bool ImageDecoder::frameIsCompleteAtIndex(size_t index) const
127 return true; 127 {
128 return (index < m_frameBufferCache.size()) &&
129 (m_frameBufferCache[index].status() == ImageFrame::FrameComplete);
128 } 130 }
129 131
130 unsigned ImageDecoder::frameBytesAtIndex(size_t index) const 132 unsigned ImageDecoder::frameBytesAtIndex(size_t index) const
131 { 133 {
132 if (m_frameBufferCache.size() <= index) 134 if (m_frameBufferCache.size() <= index)
133 return 0; 135 return 0;
134 // FIXME: Use the dimension of the requested frame. 136 // FIXME: Use the dimension of the requested frame.
135 return m_size.area() * sizeof(ImageFrame::PixelData); 137 return m_size.area() * sizeof(ImageFrame::PixelData);
136 } 138 }
137 139
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 { 221 {
220 return getScaledValue<LowerBound>(m_scaledRows, origY, searchStart); 222 return getScaledValue<LowerBound>(m_scaledRows, origY, searchStart);
221 } 223 }
222 224
223 int ImageDecoder::scaledY(int origY, int searchStart) 225 int ImageDecoder::scaledY(int origY, int searchStart)
224 { 226 {
225 return getScaledValue<Exact>(m_scaledRows, origY, searchStart); 227 return getScaledValue<Exact>(m_scaledRows, origY, searchStart);
226 } 228 }
227 229
228 } // namespace WebCore 230 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/platform/image-decoders/ImageDecoder.h ('k') | Source/core/platform/image-decoders/gif/GIFImageDecoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698