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 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 { | 429 { |
430 if (m_frames.size() <= index) | 430 if (m_frames.size() <= index) |
431 return true; | 431 return true; |
432 | 432 |
433 if (m_frames[index].m_haveMetadata) | 433 if (m_frames[index].m_haveMetadata) |
434 return m_frames[index].m_hasAlpha; | 434 return m_frames[index].m_hasAlpha; |
435 | 435 |
436 return m_source.frameHasAlphaAtIndex(index); | 436 return m_source.frameHasAlphaAtIndex(index); |
437 } | 437 } |
438 | 438 |
439 bool BitmapImage::currentFrameKnownToBeOpaque() | 439 bool BitmapImage::currentFrameKnownToBeOpaque(MetadataMode metadataMode) |
440 { | 440 { |
| 441 if (metadataMode == PreCacheMetadata) { |
| 442 // frameHasAlphaAtIndex() conservatively returns false for uncached fram
es. To increase the |
| 443 // chance of an accurate answer, pre-cache the current frame metadata. |
| 444 frameAtIndex(currentFrame()); |
| 445 } |
441 return !frameHasAlphaAtIndex(currentFrame()); | 446 return !frameHasAlphaAtIndex(currentFrame()); |
442 } | 447 } |
443 | 448 |
444 bool BitmapImage::currentFrameIsComplete() | 449 bool BitmapImage::currentFrameIsComplete() |
445 { | 450 { |
446 return frameIsCompleteAtIndex(currentFrame()); | 451 return frameIsCompleteAtIndex(currentFrame()); |
447 } | 452 } |
448 | 453 |
449 bool BitmapImage::currentFrameIsLazyDecoded() | 454 bool BitmapImage::currentFrameIsLazyDecoded() |
450 { | 455 { |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
664 destroyDecodedDataIfNecessary(); | 669 destroyDecodedDataIfNecessary(); |
665 | 670 |
666 // We need to draw this frame if we advanced to it while not skipping, or if | 671 // We need to draw this frame if we advanced to it while not skipping, or if |
667 // while trying to skip frames we hit the last frame and thus had to stop. | 672 // while trying to skip frames we hit the last frame and thus had to stop. |
668 if (skippingFrames != advancedAnimation) | 673 if (skippingFrames != advancedAnimation) |
669 imageObserver()->animationAdvanced(this); | 674 imageObserver()->animationAdvanced(this); |
670 return advancedAnimation; | 675 return advancedAnimation; |
671 } | 676 } |
672 | 677 |
673 } // namespace blink | 678 } // namespace blink |
OLD | NEW |