Chromium Code Reviews| Index: third_party/WebKit/Source/core/html/Float32ImageData.h |
| diff --git a/third_party/WebKit/Source/core/html/ImageData.h b/third_party/WebKit/Source/core/html/Float32ImageData.h |
| similarity index 58% |
| copy from third_party/WebKit/Source/core/html/ImageData.h |
| copy to third_party/WebKit/Source/core/html/Float32ImageData.h |
| index 206671a1b48fba1f7b1937dc4cb78414fcb93f8b..6777d8ae40e9596616babfb0f819d64a6543ef19 100644 |
| --- a/third_party/WebKit/Source/core/html/ImageData.h |
| +++ b/third_party/WebKit/Source/core/html/Float32ImageData.h |
| @@ -26,45 +26,60 @@ |
| * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| */ |
| -#ifndef ImageData_h |
| -#define ImageData_h |
| +#ifndef Float32ImageData_h |
| +#define Float32ImageData_h |
| #include "bindings/core/v8/ScriptWrappable.h" |
| #include "core/CoreExport.h" |
| #include "core/dom/DOMTypedArray.h" |
| +#include "core/html/ImageData.h" |
|
Justin Novosad
2016/12/08 18:16:34
Why is this needed?
zakerinasab
2016/12/08 20:40:52
To have access to ImageDataColorSpace enum and str
|
| #include "core/imagebitmap/ImageBitmapSource.h" |
| #include "platform/geometry/IntRect.h" |
| #include "platform/geometry/IntSize.h" |
| #include "platform/heap/Handle.h" |
| #include "wtf/Compiler.h" |
| +#include "wtf/text/WTFString.h" |
| namespace blink { |
| class ExceptionState; |
| class ImageBitmapOptions; |
| -class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>, |
| - public ScriptWrappable, |
| - public ImageBitmapSource { |
| +class CORE_EXPORT Float32ImageData final |
| + : public GarbageCollectedFinalized<Float32ImageData>, |
| + public ScriptWrappable, |
| + public ImageBitmapSource { |
| DEFINE_WRAPPERTYPEINFO(); |
| public: |
| - static ImageData* create(const IntSize&); |
| - static ImageData* create(const IntSize&, DOMUint8ClampedArray*); |
| - static ImageData* create(unsigned width, unsigned height, ExceptionState&); |
| - static ImageData* create(DOMUint8ClampedArray*, |
| - unsigned width, |
| - ExceptionState&); |
| - static ImageData* create(DOMUint8ClampedArray*, |
| - unsigned width, |
| - unsigned height, |
| - ExceptionState&); |
| + static Float32ImageData* create(const IntSize&); |
| + static Float32ImageData* create(const IntSize&, DOMFloat32Array*); |
| + static Float32ImageData* create(unsigned width, |
| + unsigned height, |
| + ExceptionState&); |
| + static Float32ImageData* create(unsigned width, |
| + unsigned height, |
| + String colorSpace, |
| + ExceptionState&); |
| + static Float32ImageData* create(DOMFloat32Array*, |
| + unsigned width, |
| + ExceptionState&); |
| + static Float32ImageData* create(DOMFloat32Array*, |
| + unsigned width, |
| + unsigned height, |
| + ExceptionState&); |
| + static Float32ImageData* create(DOMFloat32Array*, |
| + unsigned width, |
| + unsigned height, |
| + String colorSpace, |
| + ExceptionState&); |
| IntSize size() const { return m_size; } |
| int width() const { return m_size.width(); } |
| int height() const { return m_size.height(); } |
| - const DOMUint8ClampedArray* data() const { return m_data.get(); } |
| - DOMUint8ClampedArray* data() { return m_data.get(); } |
| + String colorSpace() const { return m_colorSpace; } |
| + const DOMFloat32Array* data() const { return m_data.get(); } |
| + DOMFloat32Array* data() { return m_data.get(); } |
| // ImageBitmapSource implementation |
| IntSize bitmapSourceSize() const override { return m_size; } |
| @@ -82,17 +97,25 @@ class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>, |
| v8::Local<v8::Object> wrapper) override; |
| private: |
| - ImageData(const IntSize&, DOMUint8ClampedArray*); |
| + Float32ImageData(const IntSize&, |
| + DOMFloat32Array*, |
| + String = kLegacyImageDataColorSpaceName); |
| - static bool validateConstructorArguments(DOMUint8ClampedArray*, |
| + static bool validateConstructorArguments(DOMFloat32Array*, |
| unsigned width, |
| unsigned&, |
| ExceptionState&); |
| + static bool validateConstructorArguments(DOMFloat32Array*, |
| + unsigned width, |
| + unsigned&, |
| + String, |
| + ExceptionState&); |
| IntSize m_size; |
| - Member<DOMUint8ClampedArray> m_data; |
| + String m_colorSpace; |
|
Justin Novosad
2016/12/08 18:16:35
You should not store this as a string. Use an enum
zakerinasab
2016/12/08 20:40:52
This is an older version. Fixed now.
|
| + Member<DOMFloat32Array> m_data; |
| }; |
| } // namespace blink |
| -#endif // ImageData_h |
| +#endif // Float32ImageData_h |