| 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 11 matching lines...) Expand all Loading... |
| 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 ImageFrameGenerator_h | 26 #ifndef ImageFrameGenerator_h |
| 27 #define ImageFrameGenerator_h | 27 #define ImageFrameGenerator_h |
| 28 | 28 |
| 29 #include "SkBitmap.h" | 29 #include "SkBitmap.h" |
| 30 #include "SkSize.h" | 30 #include "SkSize.h" |
| 31 #include "SkTypes.h" | 31 #include "SkTypes.h" |
| 32 #include "platform/PlatformExport.h" |
| 32 #include "platform/graphics/ThreadSafeDataTransport.h" | 33 #include "platform/graphics/ThreadSafeDataTransport.h" |
| 33 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
| 34 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 35 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 36 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 37 #include "wtf/ThreadingPrimitives.h" | 38 #include "wtf/ThreadingPrimitives.h" |
| 38 #include "wtf/ThreadSafeRefCounted.h" | 39 #include "wtf/ThreadSafeRefCounted.h" |
| 39 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 40 | 41 |
| 41 namespace WebCore { | 42 namespace WebCore { |
| 42 | 43 |
| 43 class ImageDecoder; | 44 class ImageDecoder; |
| 44 class ScaledImageFragment; | 45 class ScaledImageFragment; |
| 45 class SharedBuffer; | 46 class SharedBuffer; |
| 46 | 47 |
| 47 class ImageDecoderFactory { | 48 class PLATFORM_EXPORT ImageDecoderFactory { |
| 49 WTF_MAKE_NONCOPYABLE(ImageDecoderFactory); |
| 48 public: | 50 public: |
| 51 ImageDecoderFactory() {} |
| 49 virtual ~ImageDecoderFactory() { } | 52 virtual ~ImageDecoderFactory() { } |
| 50 virtual PassOwnPtr<ImageDecoder> create() = 0; | 53 virtual PassOwnPtr<ImageDecoder> create() = 0; |
| 51 }; | 54 }; |
| 52 | 55 |
| 53 class ImageFrameGenerator : public ThreadSafeRefCounted<ImageFrameGenerator> { | 56 class PLATFORM_EXPORT ImageFrameGenerator : public ThreadSafeRefCounted<ImageFra
meGenerator> { |
| 57 WTF_MAKE_NONCOPYABLE(ImageFrameGenerator); |
| 54 public: | 58 public: |
| 55 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, PassR
efPtr<SharedBuffer> data, bool allDataReceived, bool isMultiFrame = false) | 59 static PassRefPtr<ImageFrameGenerator> create(const SkISize& fullSize, PassR
efPtr<SharedBuffer> data, bool allDataReceived, bool isMultiFrame = false) |
| 56 { | 60 { |
| 57 return adoptRef(new ImageFrameGenerator(fullSize, data, allDataReceived,
isMultiFrame)); | 61 return adoptRef(new ImageFrameGenerator(fullSize, data, allDataReceived,
isMultiFrame)); |
| 58 } | 62 } |
| 59 | 63 |
| 60 ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<SharedBuffer>, bool
allDataReceived, bool isMultiFrame); | 64 ImageFrameGenerator(const SkISize& fullSize, PassRefPtr<SharedBuffer>, bool
allDataReceived, bool isMultiFrame); |
| 61 ~ImageFrameGenerator(); | 65 ~ImageFrameGenerator(); |
| 62 | 66 |
| 63 const ScaledImageFragment* decodeAndScale(const SkISize& scaledSize, size_t
index = 0); | 67 const ScaledImageFragment* decodeAndScale(const SkISize& scaledSize, size_t
index = 0); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Prevents multiple decode operations on the same data. | 113 // Prevents multiple decode operations on the same data. |
| 110 Mutex m_decodeMutex; | 114 Mutex m_decodeMutex; |
| 111 | 115 |
| 112 // Protect concurrent access to m_hasAlpha. | 116 // Protect concurrent access to m_hasAlpha. |
| 113 Mutex m_alphaMutex; | 117 Mutex m_alphaMutex; |
| 114 }; | 118 }; |
| 115 | 119 |
| 116 } // namespace WebCore | 120 } // namespace WebCore |
| 117 | 121 |
| 118 #endif | 122 #endif |
| OLD | NEW |