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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
377 } | 377 } |
378 | 378 |
379 return Image::imageForDefaultFrame(); | 379 return Image::imageForDefaultFrame(); |
380 } | 380 } |
381 | 381 |
382 bool BitmapImage::frameHasAlphaAtIndex(size_t index) | 382 bool BitmapImage::frameHasAlphaAtIndex(size_t index) |
383 { | 383 { |
384 if (m_frames.size() <= index) | 384 if (m_frames.size() <= index) |
385 return true; | 385 return true; |
386 | 386 |
387 if (m_frames[index].m_haveMetadata && !m_frames[index].m_hasAlpha) | |
388 return false; | |
389 | |
390 // m_hasAlpha may change after m_haveMetadata is set to true, so always ask | |
391 // ImageSource for the value if the cached value is the default value. | |
392 bool hasAlpha = m_source.frameHasAlphaAtIndex(index); | |
Stephen Chennney
2016/08/09 14:22:31
Based on trying a similar change I believe this ha
Xianzhu
2016/08/09 18:51:48
Which benchmark do you think the best to reflect t
Stephen Chennney
2016/08/09 19:06:04
I would try a cluster telemetry run. Here's the on
| |
393 | |
387 if (m_frames[index].m_haveMetadata) | 394 if (m_frames[index].m_haveMetadata) |
388 return m_frames[index].m_hasAlpha; | 395 m_frames[index].m_hasAlpha = hasAlpha; |
389 | 396 |
390 return m_source.frameHasAlphaAtIndex(index); | 397 return hasAlpha; |
391 } | 398 } |
392 | 399 |
393 bool BitmapImage::currentFrameKnownToBeOpaque(MetadataMode metadataMode) | 400 bool BitmapImage::currentFrameKnownToBeOpaque(MetadataMode metadataMode) |
394 { | 401 { |
395 if (metadataMode == PreCacheMetadata) { | 402 if (metadataMode == PreCacheMetadata) { |
396 // frameHasAlphaAtIndex() conservatively returns false for uncached fram es. To increase the | 403 // frameHasAlphaAtIndex() conservatively returns false for uncached fram es. To increase the |
397 // chance of an accurate answer, pre-cache the current frame metadata. | 404 // chance of an accurate answer, pre-cache the current frame metadata. |
398 frameAtIndex(currentFrame()); | 405 frameAtIndex(currentFrame()); |
399 } | 406 } |
400 return !frameHasAlphaAtIndex(currentFrame()); | 407 return !frameHasAlphaAtIndex(currentFrame()); |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
610 | 617 |
611 // 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 |
612 // 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. |
613 if (skippingFrames != advancedAnimation) | 620 if (skippingFrames != advancedAnimation) |
614 getImageObserver()->animationAdvanced(this); | 621 getImageObserver()->animationAdvanced(this); |
615 | 622 |
616 return advancedAnimation; | 623 return advancedAnimation; |
617 } | 624 } |
618 | 625 |
619 } // namespace blink | 626 } // namespace blink |
OLD | NEW |