| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) | 2 * Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) |
| 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 | 191 |
| 192 Image::SizeAvailability BitmapImage::setData(PassRefPtr<SharedBuffer> data, bool
allDataReceived) | 192 Image::SizeAvailability BitmapImage::setData(PassRefPtr<SharedBuffer> data, bool
allDataReceived) |
| 193 { | 193 { |
| 194 if (!data.get()) | 194 if (!data.get()) |
| 195 return SizeAvailable; | 195 return SizeAvailable; |
| 196 | 196 |
| 197 int length = data->size(); | 197 int length = data->size(); |
| 198 if (!length) | 198 if (!length) |
| 199 return SizeAvailable; | 199 return SizeAvailable; |
| 200 | 200 |
| 201 // If ImageSource::setData() returns Invalid, we know that this is a decode
error. | 201 // If ImageSource::setData() fails, we know that this is a decode error. |
| 202 // Report size available so that it gets registered as such in ImageResource
. | 202 // Report size available so that it gets registered as such in ImageResource
. |
| 203 if (m_source.setData(*data, allDataReceived) == ImageDecoder::SniffResult::I
nvalid) | 203 if (!m_source.setData(data, allDataReceived)) |
| 204 return SizeAvailable; | 204 return SizeAvailable; |
| 205 | 205 |
| 206 return dataChanged(allDataReceived); | 206 return dataChanged(allDataReceived); |
| 207 } | 207 } |
| 208 | 208 |
| 209 Image::SizeAvailability BitmapImage::dataChanged(bool allDataReceived) | 209 Image::SizeAvailability BitmapImage::dataChanged(bool allDataReceived) |
| 210 { | 210 { |
| 211 TRACE_EVENT0("blink", "BitmapImage::dataChanged"); | 211 TRACE_EVENT0("blink", "BitmapImage::dataChanged"); |
| 212 | 212 |
| 213 // Clear all partially-decoded frames. For most image formats, there is only | 213 // Clear all partially-decoded frames. For most image formats, there is only |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 617 | 617 |
| 618 // We need to draw this frame if we advanced to it while not skipping, or if | 618 // We need to draw this frame if we advanced to it while not skipping, or if |
| 619 // while trying to skip frames we hit the last frame and thus had to stop. | 619 // while trying to skip frames we hit the last frame and thus had to stop. |
| 620 if (skippingFrames != advancedAnimation) | 620 if (skippingFrames != advancedAnimation) |
| 621 getImageObserver()->animationAdvanced(this); | 621 getImageObserver()->animationAdvanced(this); |
| 622 | 622 |
| 623 return advancedAnimation; | 623 return advancedAnimation; |
| 624 } | 624 } |
| 625 | 625 |
| 626 } // namespace blink | 626 } // namespace blink |
| OLD | NEW |