| 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 23 matching lines...) Expand all Loading... |
| 34 #include "wtf/PassOwnPtr.h" | 34 #include "wtf/PassOwnPtr.h" |
| 35 #include "wtf/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
| 36 #include "wtf/RefCounted.h" | 36 #include "wtf/RefCounted.h" |
| 37 #include "wtf/RefPtr.h" | 37 #include "wtf/RefPtr.h" |
| 38 #include "wtf/ThreadingPrimitives.h" | 38 #include "wtf/ThreadingPrimitives.h" |
| 39 #include "wtf/ThreadSafeRefCounted.h" | 39 #include "wtf/ThreadSafeRefCounted.h" |
| 40 #include "wtf/Vector.h" | 40 #include "wtf/Vector.h" |
| 41 | 41 |
| 42 namespace blink { | 42 namespace blink { |
| 43 | 43 |
| 44 class ColorSpaceProfile; |
| 44 class ImageDecoder; | 45 class ImageDecoder; |
| 45 class SharedBuffer; | 46 class SharedBuffer; |
| 46 | 47 |
| 47 class PLATFORM_EXPORT ImageDecoderFactory { | 48 class PLATFORM_EXPORT ImageDecoderFactory { |
| 48 WTF_MAKE_NONCOPYABLE(ImageDecoderFactory); | 49 WTF_MAKE_NONCOPYABLE(ImageDecoderFactory); |
| 49 public: | 50 public: |
| 50 ImageDecoderFactory() {} | 51 ImageDecoderFactory() {} |
| 51 virtual ~ImageDecoderFactory() { } | 52 virtual ~ImageDecoderFactory() { } |
| 52 virtual PassOwnPtr<ImageDecoder> create() = 0; | 53 virtual PassOwnPtr<ImageDecoder> create() = 0; |
| 53 }; | 54 }; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 68 // into |pixels| with a stride of |rowBytes|. | 69 // into |pixels| with a stride of |rowBytes|. |
| 69 // | 70 // |
| 70 // Returns true if decoding was successful. | 71 // Returns true if decoding was successful. |
| 71 bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t r
owBytes); | 72 bool decodeAndScale(const SkImageInfo&, size_t index, void* pixels, size_t r
owBytes); |
| 72 | 73 |
| 73 // Decodes YUV components directly into the provided memory planes. | 74 // Decodes YUV components directly into the provided memory planes. |
| 74 bool decodeToYUV(SkISize componentSizes[3], void* planes[3], size_t rowBytes
[3]); | 75 bool decodeToYUV(SkISize componentSizes[3], void* planes[3], size_t rowBytes
[3]); |
| 75 | 76 |
| 76 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); | 77 void setData(PassRefPtr<SharedBuffer>, bool allDataReceived); |
| 77 | 78 |
| 79 void setDeviceProfile(ColorSpaceProfile*); |
| 80 |
| 78 // Creates a new SharedBuffer containing the data received so far. | 81 // Creates a new SharedBuffer containing the data received so far. |
| 79 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived); | 82 void copyData(RefPtr<SharedBuffer>*, bool* allDataReceived); |
| 80 | 83 |
| 81 SkISize getFullSize() const { return m_fullSize; } | 84 SkISize getFullSize() const { return m_fullSize; } |
| 82 | 85 |
| 83 bool isMultiFrame() const { return m_isMultiFrame; } | 86 bool isMultiFrame() const { return m_isMultiFrame; } |
| 84 | 87 |
| 85 // FIXME: Return alpha state for each frame. | 88 // FIXME: Return alpha state for each frame. |
| 86 bool hasAlpha(size_t); | 89 bool hasAlpha(size_t); |
| 87 | 90 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 104 bool decode(size_t index, ImageDecoder**, SkBitmap*); | 107 bool decode(size_t index, ImageDecoder**, SkBitmap*); |
| 105 | 108 |
| 106 SkISize m_fullSize; | 109 SkISize m_fullSize; |
| 107 ThreadSafeDataTransport m_data; | 110 ThreadSafeDataTransport m_data; |
| 108 bool m_isMultiFrame; | 111 bool m_isMultiFrame; |
| 109 bool m_decodeFailedAndEmpty; | 112 bool m_decodeFailedAndEmpty; |
| 110 Vector<bool> m_hasAlpha; | 113 Vector<bool> m_hasAlpha; |
| 111 int m_decodeCount; | 114 int m_decodeCount; |
| 112 Vector<bool> m_frameComplete; | 115 Vector<bool> m_frameComplete; |
| 113 size_t m_frameCount; | 116 size_t m_frameCount; |
| 117 |
| 118 RefPtr<ColorSpaceProfile> m_deviceProfile; |
| 119 |
| 114 OwnPtr<ExternalMemoryAllocator> m_externalAllocator; | 120 OwnPtr<ExternalMemoryAllocator> m_externalAllocator; |
| 115 | 121 |
| 116 OwnPtr<ImageDecoderFactory> m_imageDecoderFactory; | 122 OwnPtr<ImageDecoderFactory> m_imageDecoderFactory; |
| 117 | 123 |
| 118 // Prevents multiple decode operations on the same data. | 124 // Prevents multiple decode operations on the same data. |
| 119 Mutex m_decodeMutex; | 125 Mutex m_decodeMutex; |
| 120 | 126 |
| 121 // Protect concurrent access to m_hasAlpha. | 127 // Protect concurrent access to m_hasAlpha. |
| 122 Mutex m_alphaMutex; | 128 Mutex m_alphaMutex; |
| 123 }; | 129 }; |
| 124 | 130 |
| 125 } // namespace blink | 131 } // namespace blink |
| 126 | 132 |
| 127 #endif | 133 #endif |
| OLD | NEW |