| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 IntSize frameSizeAtIndex(size_t index) const; | 74 IntSize frameSizeAtIndex(size_t index) const; |
| 75 size_t frameCount(); | 75 size_t frameCount(); |
| 76 int repetitionCount() const; | 76 int repetitionCount() const; |
| 77 size_t clearCacheExceptFrame(size_t index); | 77 size_t clearCacheExceptFrame(size_t index); |
| 78 bool frameHasAlphaAtIndex(size_t index) const; | 78 bool frameHasAlphaAtIndex(size_t index) const; |
| 79 bool frameIsCompleteAtIndex(size_t index) const; | 79 bool frameIsCompleteAtIndex(size_t index) const; |
| 80 float frameDurationAtIndex(size_t index) const; | 80 float frameDurationAtIndex(size_t index) const; |
| 81 size_t frameBytesAtIndex(size_t index) const; | 81 size_t frameBytesAtIndex(size_t index) const; |
| 82 ImageOrientation orientationAtIndex(size_t index) const; | 82 ImageOrientation orientationAtIndex(size_t index) const; |
| 83 bool hotSpot(IntPoint&) const; | 83 bool hotSpot(IntPoint&) const; |
| 84 sk_sp<SkColorSpace> targetColorSpace() const { return m_targetColorSpace; } |
| 84 | 85 |
| 85 private: | 86 private: |
| 86 explicit DeferredImageDecoder(std::unique_ptr<ImageDecoder> actualDecoder); | 87 explicit DeferredImageDecoder(std::unique_ptr<ImageDecoder> actualDecoder); |
| 87 | 88 |
| 88 friend class DeferredImageDecoderTest; | 89 friend class DeferredImageDecoderTest; |
| 89 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } | 90 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } |
| 90 | 91 |
| 91 void activateLazyDecoding(); | 92 void activateLazyDecoding(); |
| 92 void prepareLazyDecodedFrames(); | 93 void prepareLazyDecodedFrames(); |
| 93 | 94 |
| 94 sk_sp<SkImage> createFrameImageAtIndex(size_t index, bool knownToBeOpaque); | 95 sk_sp<SkImage> createFrameImageAtIndex(size_t index, bool knownToBeOpaque); |
| 95 | 96 |
| 96 void setDataInternal(PassRefPtr<SharedBuffer> data, | 97 void setDataInternal(PassRefPtr<SharedBuffer> data, |
| 97 bool allDataReceived, | 98 bool allDataReceived, |
| 98 bool pushDataToDecoder); | 99 bool pushDataToDecoder); |
| 99 | 100 |
| 100 // Copy of the data that is passed in, used by deferred decoding. | 101 // Copy of the data that is passed in, used by deferred decoding. |
| 101 // Allows creating readonly snapshots that may be read in another thread. | 102 // Allows creating readonly snapshots that may be read in another thread. |
| 102 std::unique_ptr<SkRWBuffer> m_rwBuffer; | 103 std::unique_ptr<SkRWBuffer> m_rwBuffer; |
| 103 bool m_allDataReceived; | 104 bool m_allDataReceived; |
| 104 std::unique_ptr<ImageDecoder> m_actualDecoder; | 105 std::unique_ptr<ImageDecoder> m_actualDecoder; |
| 106 sk_sp<SkColorSpace> m_targetColorSpace; |
| 105 | 107 |
| 106 String m_filenameExtension; | 108 String m_filenameExtension; |
| 107 IntSize m_size; | 109 IntSize m_size; |
| 108 int m_repetitionCount; | 110 int m_repetitionCount; |
| 109 bool m_hasEmbeddedColorSpace = false; | 111 bool m_hasEmbeddedColorSpace = false; |
| 110 sk_sp<SkColorSpace> m_colorSpaceForSkImages; | 112 sk_sp<SkColorSpace> m_colorSpaceForSkImages; |
| 111 bool m_canYUVDecode; | 113 bool m_canYUVDecode; |
| 112 bool m_hasHotSpot; | 114 bool m_hasHotSpot; |
| 113 IntPoint m_hotSpot; | 115 IntPoint m_hotSpot; |
| 114 | 116 |
| 115 // Caches frame state information. | 117 // Caches frame state information. |
| 116 Vector<DeferredFrameData> m_frameData; | 118 Vector<DeferredFrameData> m_frameData; |
| 117 RefPtr<ImageFrameGenerator> m_frameGenerator; | 119 RefPtr<ImageFrameGenerator> m_frameGenerator; |
| 118 }; | 120 }; |
| 119 | 121 |
| 120 } // namespace blink | 122 } // namespace blink |
| 121 | 123 |
| 122 #endif | 124 #endif |
| OLD | NEW |