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 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
333 return m_frameCount; | 333 return m_frameCount; |
334 } | 334 } |
335 | 335 |
336 bool BitmapImage::isSizeAvailable() | 336 bool BitmapImage::isSizeAvailable() |
337 { | 337 { |
338 if (m_sizeAvailable) | 338 if (m_sizeAvailable) |
339 return true; | 339 return true; |
340 | 340 |
341 m_sizeAvailable = m_source.isSizeAvailable(); | 341 m_sizeAvailable = m_source.isSizeAvailable(); |
342 | 342 |
343 if (m_sizeAvailable && (size().width() > 1 || size().height() > 1)) { | |
Noel Gordon
2015/08/01 02:33:06
Yes better. Let's define a static inline hasVisib
urvang
2015/08/04 20:21:16
Done.
| |
344 String fileExtention = m_source.filenameExtension(); | |
345 DecodedImageType type = | |
346 fileExtention == "jpg" ? ImageJPEG : | |
347 fileExtention == "png" ? ImagePNG : | |
348 fileExtention == "gif" ? ImageGIF : | |
349 fileExtention == "webp" ? ImageWebP : | |
350 fileExtention == "ico" ? ImageICO : | |
351 fileExtention == "bmp" ? ImageBMP : | |
352 ImageUnknown; | |
353 Platform::current()->histogramEnumeration("Blink.DecodedImageType", type , DecodedImageTypeMax + 1); | |
354 } | |
355 | |
343 return m_sizeAvailable; | 356 return m_sizeAvailable; |
344 } | 357 } |
345 | 358 |
346 bool BitmapImage::ensureFrameIsCached(size_t index) | 359 bool BitmapImage::ensureFrameIsCached(size_t index) |
347 { | 360 { |
348 if (index >= frameCount()) | 361 if (index >= frameCount()) |
349 return false; | 362 return false; |
350 | 363 |
351 if (index >= m_frames.size() || !m_frames[index].m_frame) | 364 if (index >= m_frames.size() || !m_frames[index].m_frame) |
352 cacheFrame(index); | 365 cacheFrame(index); |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
643 destroyDecodedDataIfNecessary(); | 656 destroyDecodedDataIfNecessary(); |
644 | 657 |
645 // We need to draw this frame if we advanced to it while not skipping, or if | 658 // We need to draw this frame if we advanced to it while not skipping, or if |
646 // while trying to skip frames we hit the last frame and thus had to stop. | 659 // while trying to skip frames we hit the last frame and thus had to stop. |
647 if (skippingFrames != advancedAnimation) | 660 if (skippingFrames != advancedAnimation) |
648 imageObserver()->animationAdvanced(this); | 661 imageObserver()->animationAdvanced(this); |
649 return advancedAnimation; | 662 return advancedAnimation; |
650 } | 663 } |
651 | 664 |
652 } // namespace blink | 665 } // namespace blink |
OLD | NEW |