| 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 25 matching lines...) Expand all Loading... |
| 36 #include "wtf/Forward.h" | 36 #include "wtf/Forward.h" |
| 37 #include "wtf/OwnPtr.h" | 37 #include "wtf/OwnPtr.h" |
| 38 #include "wtf/Vector.h" | 38 #include "wtf/Vector.h" |
| 39 | 39 |
| 40 class SkImage; | 40 class SkImage; |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class ImageFrameGenerator; | 44 class ImageFrameGenerator; |
| 45 class SharedBuffer; | 45 class SharedBuffer; |
| 46 struct FrameData; | 46 struct DeferredFrameData; |
| 47 | 47 |
| 48 class PLATFORM_EXPORT DeferredImageDecoder final { | 48 class PLATFORM_EXPORT DeferredImageDecoder final { |
| 49 WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); | 49 WTF_MAKE_NONCOPYABLE(DeferredImageDecoder); |
| 50 USING_FAST_MALLOC(DeferredImageDecoder); | 50 USING_FAST_MALLOC(DeferredImageDecoder); |
| 51 public: | 51 public: |
| 52 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima
geDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); | 52 static PassOwnPtr<DeferredImageDecoder> create(const SharedBuffer& data, Ima
geDecoder::AlphaOption, ImageDecoder::GammaAndColorProfileOption); |
| 53 | 53 |
| 54 static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec
oder>); | 54 static PassOwnPtr<DeferredImageDecoder> createForTesting(PassOwnPtr<ImageDec
oder>); |
| 55 | 55 |
| 56 ~DeferredImageDecoder(); | 56 ~DeferredImageDecoder(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 80 | 80 |
| 81 private: | 81 private: |
| 82 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); | 82 explicit DeferredImageDecoder(PassOwnPtr<ImageDecoder> actualDecoder); |
| 83 | 83 |
| 84 friend class DeferredImageDecoderTest; | 84 friend class DeferredImageDecoderTest; |
| 85 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } | 85 ImageFrameGenerator* frameGenerator() { return m_frameGenerator.get(); } |
| 86 | 86 |
| 87 void activateLazyDecoding(); | 87 void activateLazyDecoding(); |
| 88 void prepareLazyDecodedFrames(); | 88 void prepareLazyDecodedFrames(); |
| 89 | 89 |
| 90 PassRefPtr<SkImage> createFrameImageAtIndex(size_t index, bool knownToBeOpaq
ue) const; | 90 PassRefPtr<SkImage> createFrameImageAtIndex(size_t index, bool knownToBeOpaq
ue); |
| 91 | 91 |
| 92 // Copy of the data that is passed in, used by deferred decoding. | 92 // Copy of the data that is passed in, used by deferred decoding. |
| 93 // Allows creating readonly snapshots that may be read in another thread. | 93 // Allows creating readonly snapshots that may be read in another thread. |
| 94 OwnPtr<SkRWBuffer> m_rwBuffer; | 94 OwnPtr<SkRWBuffer> m_rwBuffer; |
| 95 bool m_allDataReceived; | 95 bool m_allDataReceived; |
| 96 OwnPtr<ImageDecoder> m_actualDecoder; | 96 OwnPtr<ImageDecoder> m_actualDecoder; |
| 97 | 97 |
| 98 String m_filenameExtension; | 98 String m_filenameExtension; |
| 99 IntSize m_size; | 99 IntSize m_size; |
| 100 int m_repetitionCount; | 100 int m_repetitionCount; |
| 101 bool m_hasColorProfile; | 101 bool m_hasColorProfile; |
| 102 bool m_canYUVDecode; | 102 bool m_canYUVDecode; |
| 103 | 103 |
| 104 // Carries only frame state and other information. Does not carry bitmap. | 104 // Caches frame state information. |
| 105 Vector<FrameData> m_frameData; | 105 Vector<DeferredFrameData> m_frameData; |
| 106 RefPtr<ImageFrameGenerator> m_frameGenerator; | 106 RefPtr<ImageFrameGenerator> m_frameGenerator; |
| 107 | 107 |
| 108 static bool s_enabled; | 108 static bool s_enabled; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 } // namespace blink | 111 } // namespace blink |
| 112 | 112 |
| 113 #endif | 113 #endif |
| OLD | NEW |