| 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 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 // so this method can be made non-virtual. It is used in the test | 251 // so this method can be made non-virtual. It is used in the test |
| 252 // ImageFrameGeneratorTest::clearMultiFrameDecode. The test needs to | 252 // ImageFrameGeneratorTest::clearMultiFrameDecode. The test needs to |
| 253 // be modified since two frames may be kept in cache, instead of | 253 // be modified since two frames may be kept in cache, instead of |
| 254 // always just one, with this clearCacheExceptFrame implementation. | 254 // always just one, with this clearCacheExceptFrame implementation. |
| 255 virtual size_t clearCacheExceptFrame(size_t); | 255 virtual size_t clearCacheExceptFrame(size_t); |
| 256 | 256 |
| 257 // If the image has a cursor hot-spot, stores it in the argument | 257 // If the image has a cursor hot-spot, stores it in the argument |
| 258 // and returns true. Otherwise returns false. | 258 // and returns true. Otherwise returns false. |
| 259 virtual bool hotSpot(IntPoint&) const { return false; } | 259 virtual bool hotSpot(IntPoint&) const { return false; } |
| 260 | 260 |
| 261 virtual void setMemoryAllocator(SkBitmap::Allocator* allocator) { | 261 void setMemoryAllocator(SkBitmap::Allocator* allocator) { |
| 262 // FIXME: this doesn't work for images with multiple frames. | 262 // FIXME: this doesn't work for images with multiple frames. |
| 263 if (m_frameBufferCache.isEmpty()) { | 263 if (m_frameBufferCache.isEmpty()) { |
| 264 m_frameBufferCache.resize(1); | 264 // Ensure that initializeNewFrame is called, after parsing if |
| 265 m_frameBufferCache[0].setRequiredPreviousFrameIndex( | 265 // necessary. |
| 266 findRequiredPreviousFrame(0, false)); | 266 if (!frameCount()) |
| 267 return; |
| 267 } | 268 } |
| 269 |
| 268 m_frameBufferCache[0].setMemoryAllocator(allocator); | 270 m_frameBufferCache[0].setMemoryAllocator(allocator); |
| 269 } | 271 } |
| 270 | 272 |
| 271 virtual bool canDecodeToYUV() { return false; } | 273 virtual bool canDecodeToYUV() { return false; } |
| 272 virtual bool decodeToYUV() { return false; } | 274 virtual bool decodeToYUV() { return false; } |
| 273 virtual void setImagePlanes(std::unique_ptr<ImagePlanes>) {} | 275 virtual void setImagePlanes(std::unique_ptr<ImagePlanes>) {} |
| 274 | 276 |
| 275 protected: | 277 protected: |
| 276 ImageDecoder(AlphaOption alphaOption, | 278 ImageDecoder(AlphaOption alphaOption, |
| 277 const ColorBehavior& colorBehavior, | 279 const ColorBehavior& colorBehavior, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 306 virtual void clearFrameBuffer(size_t frameIndex); | 308 virtual void clearFrameBuffer(size_t frameIndex); |
| 307 | 309 |
| 308 // Decodes the image sufficiently to determine the image size. | 310 // Decodes the image sufficiently to determine the image size. |
| 309 virtual void decodeSize() = 0; | 311 virtual void decodeSize() = 0; |
| 310 | 312 |
| 311 // Decodes the image sufficiently to determine the number of frames and | 313 // Decodes the image sufficiently to determine the number of frames and |
| 312 // returns that number. | 314 // returns that number. |
| 313 virtual size_t decodeFrameCount() { return 1; } | 315 virtual size_t decodeFrameCount() { return 1; } |
| 314 | 316 |
| 315 // Called to initialize the frame buffer with the given index, based on the | 317 // Called to initialize the frame buffer with the given index, based on the |
| 316 // provided and previous frame's characteristics. Returns true on success. On | 318 // provided and previous frame's characteristics. Returns true on success. |
| 317 // failure, this will mark the image as failed. Before calling this method, | 319 // Before calling this method, the caller must verify that the frame exists. |
| 318 // the caller must verify that the frame exists. | 320 // On failure, the client should call setFailed. This method does not call |
| 321 // setFailed itself because that might delete the object directly making this |
| 322 // call. |
| 319 bool initFrameBuffer(size_t); | 323 bool initFrameBuffer(size_t); |
| 320 | 324 |
| 321 // Performs any additional setup of the requested frame after it has been | 325 // Performs any additional setup of the requested frame after it has been |
| 322 // initially created, e.g. setting a duration or disposal method. | 326 // initially created, e.g. setting a duration or disposal method. |
| 323 virtual void initializeNewFrame(size_t) {} | 327 virtual void initializeNewFrame(size_t) {} |
| 324 | 328 |
| 325 // Decodes the requested frame. | 329 // Decodes the requested frame. |
| 326 virtual void decode(size_t) = 0; | 330 virtual void decode(size_t) = 0; |
| 327 | 331 |
| 328 // This method is only required for animated images. It returns a vector with | 332 // This method is only required for animated images. It returns a vector with |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 bool m_hasHistogrammedColorSpace = false; | 423 bool m_hasHistogrammedColorSpace = false; |
| 420 | 424 |
| 421 sk_sp<SkColorSpace> m_embeddedColorSpace = nullptr; | 425 sk_sp<SkColorSpace> m_embeddedColorSpace = nullptr; |
| 422 bool m_sourceToTargetColorTransformNeedsUpdate = false; | 426 bool m_sourceToTargetColorTransformNeedsUpdate = false; |
| 423 std::unique_ptr<SkColorSpaceXform> m_sourceToTargetColorTransform; | 427 std::unique_ptr<SkColorSpaceXform> m_sourceToTargetColorTransform; |
| 424 }; | 428 }; |
| 425 | 429 |
| 426 } // namespace blink | 430 } // namespace blink |
| 427 | 431 |
| 428 #endif | 432 #endif |
| OLD | NEW |