| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) Research In Motion Limited 2009-2010. All rights reserved. | 3 * Copyright (C) Research In Motion Limited 2009-2010. 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 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 } | 270 } |
| 271 | 271 |
| 272 virtual bool canDecodeToYUV() { return false; } | 272 virtual bool canDecodeToYUV() { return false; } |
| 273 virtual bool decodeToYUV() { return false; } | 273 virtual bool decodeToYUV() { return false; } |
| 274 virtual void setImagePlanes(std::unique_ptr<ImagePlanes>) { } | 274 virtual void setImagePlanes(std::unique_ptr<ImagePlanes>) { } |
| 275 | 275 |
| 276 protected: | 276 protected: |
| 277 ImageDecoder(AlphaOption alphaOption, GammaAndColorProfileOption colorOption
s, size_t maxDecodedBytes) | 277 ImageDecoder(AlphaOption alphaOption, GammaAndColorProfileOption colorOption
s, size_t maxDecodedBytes) |
| 278 : m_premultiplyAlpha(alphaOption == AlphaPremultiplied) | 278 : m_premultiplyAlpha(alphaOption == AlphaPremultiplied) |
| 279 , m_ignoreGammaAndColorProfile(colorOptions == GammaAndColorProfileIgnor
ed) | 279 , m_ignoreGammaAndColorProfile(colorOptions == GammaAndColorProfileIgnor
ed) |
| 280 , m_maxDecodedBytes(maxDecodedBytes) { } | 280 , m_maxDecodedBytes(maxDecodedBytes) |
| 281 , m_purgeAggressively(false) { } |
| 281 | 282 |
| 282 // Calculates the most recent frame whose image data may be needed in | 283 // Calculates the most recent frame whose image data may be needed in |
| 283 // order to decode frame |frameIndex|, based on frame disposal methods | 284 // order to decode frame |frameIndex|, based on frame disposal methods |
| 284 // and |frameRectIsOpaque|, where |frameRectIsOpaque| signifies whether | 285 // and |frameRectIsOpaque|, where |frameRectIsOpaque| signifies whether |
| 285 // the rectangle of frame at |frameIndex| is known to be opaque. | 286 // the rectangle of frame at |frameIndex| is known to be opaque. |
| 286 // If no previous frame's data is required, returns WTF::kNotFound. | 287 // If no previous frame's data is required, returns WTF::kNotFound. |
| 287 // | 288 // |
| 288 // This function requires that the previous frame's | 289 // This function requires that the previous frame's |
| 289 // |m_requiredPreviousFrameIndex| member has been set correctly. The | 290 // |m_requiredPreviousFrameIndex| member has been set correctly. The |
| 290 // easiest way to ensure this is for subclasses to call this method and | 291 // easiest way to ensure this is for subclasses to call this method and |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 323 const bool m_ignoreGammaAndColorProfile; | 324 const bool m_ignoreGammaAndColorProfile; |
| 324 ImageOrientation m_orientation; | 325 ImageOrientation m_orientation; |
| 325 | 326 |
| 326 // The maximum amount of memory a decoded image should require. Ideally, | 327 // The maximum amount of memory a decoded image should require. Ideally, |
| 327 // image decoders should downsample large images to fit under this limit | 328 // image decoders should downsample large images to fit under this limit |
| 328 // (and then return the downsampled size from decodedSize()). Ignoring | 329 // (and then return the downsampled size from decodedSize()). Ignoring |
| 329 // this limit can cause excessive memory use or even crashes on low- | 330 // this limit can cause excessive memory use or even crashes on low- |
| 330 // memory devices. | 331 // memory devices. |
| 331 const size_t m_maxDecodedBytes; | 332 const size_t m_maxDecodedBytes; |
| 332 | 333 |
| 334 // While decoding, we may learn that there are so many animation frames that |
| 335 // we would go beyond our cache budget. |
| 336 // If that happens, m_purgeAggressively is set to true. This signals |
| 337 // future decodes to purge old frames as it goes. |
| 338 void updateAggressivePurging(size_t index); |
| 339 bool m_purgeAggressively; |
| 340 |
| 333 private: | 341 private: |
| 334 enum class SniffResult { | 342 enum class SniffResult { |
| 335 JPEG, | 343 JPEG, |
| 336 PNG, | 344 PNG, |
| 337 GIF, | 345 GIF, |
| 338 WEBP, | 346 WEBP, |
| 339 ICO, | 347 ICO, |
| 340 BMP, | 348 BMP, |
| 341 Invalid | 349 Invalid |
| 342 }; | 350 }; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 361 ImageFrame::ICCProfile m_colorProfile; | 369 ImageFrame::ICCProfile m_colorProfile; |
| 362 | 370 |
| 363 #if USE(QCMSLIB) | 371 #if USE(QCMSLIB) |
| 364 QCMSTransformUniquePtr m_sourceToOutputDeviceColorTransform; | 372 QCMSTransformUniquePtr m_sourceToOutputDeviceColorTransform; |
| 365 #endif | 373 #endif |
| 366 }; | 374 }; |
| 367 | 375 |
| 368 } // namespace blink | 376 } // namespace blink |
| 369 | 377 |
| 370 #endif | 378 #endif |
| OLD | NEW |