| 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 10 matching lines...) Expand all Loading... |
| 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef DeferredImageDecoder_h | 26 #ifndef DeferredImageDecoder_h |
| 27 #define DeferredImageDecoder_h | 27 #define DeferredImageDecoder_h |
| 28 | 28 |
| 29 #include <memory> | 29 #include <memory> |
| 30 #include "platform/PlatformExport.h" | 30 #include "platform/PlatformExport.h" |
| 31 #include "platform/SharedBuffer.h" |
| 31 #include "platform/geometry/IntSize.h" | 32 #include "platform/geometry/IntSize.h" |
| 32 #include "platform/image-decoders/ImageDecoder.h" | 33 #include "platform/image-decoders/ImageDecoder.h" |
| 33 #include "platform/wtf/Allocator.h" | 34 #include "platform/wtf/Allocator.h" |
| 34 #include "platform/wtf/Forward.h" | 35 #include "platform/wtf/Forward.h" |
| 36 #include "platform/wtf/RefPtr.h" |
| 35 #include "platform/wtf/Vector.h" | 37 #include "platform/wtf/Vector.h" |
| 36 #include "third_party/skia/include/core/SkRWBuffer.h" | 38 #include "third_party/skia/include/core/SkRWBuffer.h" |
| 37 #include "third_party/skia/include/core/SkRefCnt.h" | 39 #include "third_party/skia/include/core/SkRefCnt.h" |
| 38 | 40 |
| 39 class SkImage; | 41 class SkImage; |
| 40 | 42 |
| 41 namespace blink { | 43 namespace blink { |
| 42 | 44 |
| 43 class ImageFrameGenerator; | 45 class ImageFrameGenerator; |
| 44 class SharedBuffer; | 46 class SharedBuffer; |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 explicit DeferredImageDecoder(std::unique_ptr<ImageDecoder> actual_decoder); | 86 explicit DeferredImageDecoder(std::unique_ptr<ImageDecoder> actual_decoder); |
| 85 | 87 |
| 86 friend class DeferredImageDecoderTest; | 88 friend class DeferredImageDecoderTest; |
| 87 ImageFrameGenerator* FrameGenerator() { return frame_generator_.Get(); } | 89 ImageFrameGenerator* FrameGenerator() { return frame_generator_.Get(); } |
| 88 | 90 |
| 89 void ActivateLazyDecoding(); | 91 void ActivateLazyDecoding(); |
| 90 void PrepareLazyDecodedFrames(); | 92 void PrepareLazyDecodedFrames(); |
| 91 | 93 |
| 92 sk_sp<SkImage> CreateFrameImageAtIndex(size_t index, bool known_to_be_opaque); | 94 sk_sp<SkImage> CreateFrameImageAtIndex(size_t index, bool known_to_be_opaque); |
| 93 | 95 |
| 94 void SetDataInternal(RefPtr<SharedBuffer> data, | 96 void SetDataInternal(PassRefPtr<SharedBuffer> data, |
| 95 bool all_data_received, | 97 bool all_data_received, |
| 96 bool push_data_to_decoder); | 98 bool push_data_to_decoder); |
| 97 | 99 |
| 98 // Copy of the data that is passed in, used by deferred decoding. | 100 // Copy of the data that is passed in, used by deferred decoding. |
| 99 // Allows creating readonly snapshots that may be read in another thread. | 101 // Allows creating readonly snapshots that may be read in another thread. |
| 100 std::unique_ptr<SkRWBuffer> rw_buffer_; | 102 RefPtr<SharedBuffer> buffer_; |
| 101 std::unique_ptr<ImageDecoder> actual_decoder_; | 103 std::unique_ptr<ImageDecoder> actual_decoder_; |
| 102 | 104 |
| 103 String filename_extension_; | 105 String filename_extension_; |
| 104 IntSize size_; | 106 IntSize size_; |
| 105 int repetition_count_; | 107 int repetition_count_; |
| 106 bool has_embedded_color_space_ = false; | 108 bool has_embedded_color_space_ = false; |
| 107 bool all_data_received_; | 109 bool all_data_received_; |
| 108 bool can_yuv_decode_; | 110 bool can_yuv_decode_; |
| 109 bool has_hot_spot_; | 111 bool has_hot_spot_; |
| 110 sk_sp<SkColorSpace> color_space_for_sk_images_; | 112 sk_sp<SkColorSpace> color_space_for_sk_images_; |
| 111 IntPoint hot_spot_; | 113 IntPoint hot_spot_; |
| 112 | 114 |
| 113 // Caches frame state information. | 115 // Caches frame state information. |
| 114 Vector<DeferredFrameData> frame_data_; | 116 Vector<DeferredFrameData> frame_data_; |
| 115 RefPtr<ImageFrameGenerator> frame_generator_; | 117 RefPtr<ImageFrameGenerator> frame_generator_; |
| 116 }; | 118 }; |
| 117 | 119 |
| 118 } // namespace blink | 120 } // namespace blink |
| 119 | 121 |
| 120 #endif | 122 #endif |
| OLD | NEW |