| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 107 |
| 108 void BitmapImage::destroyDecodedData(bool destroyAll) | 108 void BitmapImage::destroyDecodedData(bool destroyAll) |
| 109 { | 109 { |
| 110 for (size_t i = 0; i < m_frames.size(); ++i) { | 110 for (size_t i = 0; i < m_frames.size(); ++i) { |
| 111 // The underlying frame isn't actually changing (we're just trying to | 111 // The underlying frame isn't actually changing (we're just trying to |
| 112 // save the memory for the framebuffer data), so we don't need to clear | 112 // save the memory for the framebuffer data), so we don't need to clear |
| 113 // the metadata. | 113 // the metadata. |
| 114 m_frames[i].clear(false); | 114 m_frames[i].clear(false); |
| 115 } | 115 } |
| 116 | 116 |
| 117 destroyMetadataAndNotify(m_source.clearCacheExceptFrame(destroyAll ? notFoun
d : m_currentFrame)); | 117 destroyMetadataAndNotify(m_source.clearCacheExceptFrame(destroyAll ? kNotFou
nd : m_currentFrame)); |
| 118 } | 118 } |
| 119 | 119 |
| 120 void BitmapImage::destroyDecodedDataIfNecessary() | 120 void BitmapImage::destroyDecodedDataIfNecessary() |
| 121 { | 121 { |
| 122 // Animated images >5MB are considered large enough that we'll only hang on | 122 // Animated images >5MB are considered large enough that we'll only hang on |
| 123 // to one frame at a time. | 123 // to one frame at a time. |
| 124 static const size_t cLargeAnimationCutoff = 5242880; | 124 static const size_t cLargeAnimationCutoff = 5242880; |
| 125 size_t allFrameBytes = 0; | 125 size_t allFrameBytes = 0; |
| 126 for (size_t i = 0; i < m_frames.size(); ++i) | 126 for (size_t i = 0; i < m_frames.size(); ++i) |
| 127 allFrameBytes += m_frames[i].m_frameBytes; | 127 allFrameBytes += m_frames[i].m_frameBytes; |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 } | 645 } |
| 646 return m_isSolidColor && !m_currentFrame; | 646 return m_isSolidColor && !m_currentFrame; |
| 647 } | 647 } |
| 648 | 648 |
| 649 Color BitmapImage::solidColor() const | 649 Color BitmapImage::solidColor() const |
| 650 { | 650 { |
| 651 return m_solidColor; | 651 return m_solidColor; |
| 652 } | 652 } |
| 653 | 653 |
| 654 } | 654 } |
| OLD | NEW |