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 bool BitmapImage::setData(PassRefPtr<SharedBuffer> data, bool allDataReceived) | 192 bool BitmapImage::setData(PassRefPtr<SharedBuffer> data, bool allDataReceived) |
193 { | 193 { |
194 if (!data.get()) | 194 if (!data.get()) |
195 return true; | 195 return true; |
196 | 196 |
197 int length = data->size(); | 197 int length = data->size(); |
198 if (!length) | 198 if (!length) |
199 return true; | 199 return true; |
200 | 200 |
201 m_source.setData(*data, allDataReceived); | 201 // If setData() returns InvalidData, we know that this is a decode error. |
pdr.
2016/07/21 04:39:06
Nit: "If ImageSource::setData returns Invalid, we
Nate Chapin
2016/07/21 20:59:05
Done.
| |
202 // Report size available so that it gets registered as such in | |
203 // ImageResource. | |
204 if (m_source.setData(*data, allDataReceived) == ImageDecoder::SniffResult::I nvalid) | |
205 return true; | |
202 | 206 |
203 return dataChanged(allDataReceived); | 207 return dataChanged(allDataReceived); |
pdr.
2016/07/21 04:39:06
Not your fault, but would you mind changing the re
Nate Chapin
2016/07/21 20:59:05
Went with 'enum SizeAvailability' inside the Image
| |
204 } | 208 } |
205 | 209 |
206 bool BitmapImage::dataChanged(bool allDataReceived) | 210 bool BitmapImage::dataChanged(bool allDataReceived) |
207 { | 211 { |
208 TRACE_EVENT0("blink", "BitmapImage::dataChanged"); | 212 TRACE_EVENT0("blink", "BitmapImage::dataChanged"); |
209 | 213 |
210 // Clear all partially-decoded frames. For most image formats, there is only | 214 // Clear all partially-decoded frames. For most image formats, there is only |
211 // one frame, but at least GIF and ICO can have more. With GIFs, the frames | 215 // one frame, but at least GIF and ICO can have more. With GIFs, the frames |
212 // come in order and we ask to decode them in order, waiting to request a | 216 // come in order and we ask to decode them in order, waiting to request a |
213 // subsequent frame until the prior one is complete. Given that we clear | 217 // subsequent frame until the prior one is complete. Given that we clear |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
607 | 611 |
608 // We need to draw this frame if we advanced to it while not skipping, or if | 612 // We need to draw this frame if we advanced to it while not skipping, or if |
609 // while trying to skip frames we hit the last frame and thus had to stop. | 613 // while trying to skip frames we hit the last frame and thus had to stop. |
610 if (skippingFrames != advancedAnimation) | 614 if (skippingFrames != advancedAnimation) |
611 getImageObserver()->animationAdvanced(this); | 615 getImageObserver()->animationAdvanced(this); |
612 | 616 |
613 return advancedAnimation; | 617 return advancedAnimation; |
614 } | 618 } |
615 | 619 |
616 } // namespace blink | 620 } // namespace blink |
OLD | NEW |