OLD | NEW |
---|---|
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 Loading... | |
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 if (m_frameBufferCache.size() <= index) |
Peter Kasting
2013/05/03 22:03:19
Nit: This can now be simplified to:
return !fra
Alpha Left Google
2013/05/06 17:43:24
Done.
Noel Gordon
2013/05/16 14:35:24
I get nervous when we change the default implement
Peter Kasting
2013/05/16 21:37:53
I think this concern is valid, but I think it isn'
| |
124 return true; | 124 return true; |
125 if (m_frameBufferCache[index].status() == ImageFrame::FrameComplete) | 125 if (m_frameBufferCache[index].status() == ImageFrame::FrameComplete) |
126 return m_frameBufferCache[index].hasAlpha(); | 126 return m_frameBufferCache[index].hasAlpha(); |
127 return true; | 127 return true; |
128 } | 128 } |
129 | 129 |
130 bool ImageDecoder::frameIsCompleteAtIndex(size_t index) const | |
131 { | |
132 return (index < m_frameBufferCache.size()) && | |
133 (m_frameBufferCache[index].status() == ImageFrame::FrameComplete); | |
134 } | |
135 | |
130 unsigned ImageDecoder::frameBytesAtIndex(size_t index) const | 136 unsigned ImageDecoder::frameBytesAtIndex(size_t index) const |
131 { | 137 { |
132 if (m_frameBufferCache.size() <= index) | 138 if (m_frameBufferCache.size() <= index) |
133 return 0; | 139 return 0; |
134 // FIXME: Use the dimension of the requested frame. | 140 // FIXME: Use the dimension of the requested frame. |
135 return m_size.area() * sizeof(ImageFrame::PixelData); | 141 return m_size.area() * sizeof(ImageFrame::PixelData); |
136 } | 142 } |
137 | 143 |
138 void ImageDecoder::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const | 144 void ImageDecoder::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const |
139 { | 145 { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 { | 225 { |
220 return getScaledValue<LowerBound>(m_scaledRows, origY, searchStart); | 226 return getScaledValue<LowerBound>(m_scaledRows, origY, searchStart); |
221 } | 227 } |
222 | 228 |
223 int ImageDecoder::scaledY(int origY, int searchStart) | 229 int ImageDecoder::scaledY(int origY, int searchStart) |
224 { | 230 { |
225 return getScaledValue<Exact>(m_scaledRows, origY, searchStart); | 231 return getScaledValue<Exact>(m_scaledRows, origY, searchStart); |
226 } | 232 } |
227 | 233 |
228 } // namespace WebCore | 234 } // namespace WebCore |
OLD | NEW |