| OLD | NEW |
| (Empty) |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef Float32ImageData_h | |
| 6 #define Float32ImageData_h | |
| 7 | |
| 8 #include "bindings/core/v8/ScriptWrappable.h" | |
| 9 #include "core/CoreExport.h" | |
| 10 #include "core/dom/DOMTypedArray.h" | |
| 11 #include "core/html/ImageData.h" | |
| 12 #include "core/imagebitmap/ImageBitmapSource.h" | |
| 13 #include "platform/geometry/IntRect.h" | |
| 14 #include "platform/geometry/IntSize.h" | |
| 15 #include "platform/heap/Handle.h" | |
| 16 #include "wtf/Compiler.h" | |
| 17 #include "wtf/text/WTFString.h" | |
| 18 | |
| 19 namespace blink { | |
| 20 | |
| 21 class ExceptionState; | |
| 22 | |
| 23 class CORE_EXPORT Float32ImageData final | |
| 24 : public GarbageCollected<Float32ImageData>, | |
| 25 public ScriptWrappable { | |
| 26 DEFINE_WRAPPERTYPEINFO(); | |
| 27 | |
| 28 public: | |
| 29 static Float32ImageData* create(const IntSize&); | |
| 30 static Float32ImageData* create(const IntSize&, DOMFloat32Array*); | |
| 31 static Float32ImageData* create(unsigned width, | |
| 32 unsigned height, | |
| 33 ExceptionState&); | |
| 34 static Float32ImageData* create(unsigned width, | |
| 35 unsigned height, | |
| 36 String colorSpace, | |
| 37 ExceptionState&); | |
| 38 static Float32ImageData* create(DOMFloat32Array*, | |
| 39 unsigned width, | |
| 40 ExceptionState&); | |
| 41 static Float32ImageData* create(DOMFloat32Array*, | |
| 42 unsigned width, | |
| 43 String colorSpace, | |
| 44 ExceptionState&); | |
| 45 static Float32ImageData* create(DOMFloat32Array*, | |
| 46 unsigned width, | |
| 47 unsigned height, | |
| 48 ExceptionState&); | |
| 49 static Float32ImageData* create(DOMFloat32Array*, | |
| 50 unsigned width, | |
| 51 unsigned height, | |
| 52 String colorSpace, | |
| 53 ExceptionState&); | |
| 54 | |
| 55 IntSize size() const { return m_size; } | |
| 56 int width() const { return m_size.width(); } | |
| 57 int height() const { return m_size.height(); } | |
| 58 String colorSpace() const { | |
| 59 return ImageData::getImageDataColorSpaceName(m_colorSpace); | |
| 60 } | |
| 61 ImageDataColorSpace imageDataColorSpace() { return m_colorSpace; } | |
| 62 const DOMFloat32Array* data() const { return m_data; } | |
| 63 DOMFloat32Array* data() { return m_data; } | |
| 64 | |
| 65 DEFINE_INLINE_TRACE() { visitor->trace(m_data); } | |
| 66 | |
| 67 WARN_UNUSED_RESULT v8::Local<v8::Object> associateWithWrapper( | |
| 68 v8::Isolate*, | |
| 69 const WrapperTypeInfo*, | |
| 70 v8::Local<v8::Object> wrapper) override; | |
| 71 | |
| 72 private: | |
| 73 Float32ImageData(const IntSize&, | |
| 74 DOMFloat32Array*, | |
| 75 String = kLinearRGBImageDataColorSpaceName); | |
| 76 | |
| 77 IntSize m_size; | |
| 78 ImageDataColorSpace m_colorSpace; | |
| 79 Member<DOMFloat32Array> m_data; | |
| 80 | |
| 81 static bool validateConstructorArguments(const unsigned&, | |
| 82 const IntSize* = nullptr, | |
| 83 const unsigned& = 0, | |
| 84 const unsigned& = 0, | |
| 85 const DOMFloat32Array* = nullptr, | |
| 86 const String* = nullptr, | |
| 87 ExceptionState* = nullptr); | |
| 88 | |
| 89 static DOMFloat32Array* allocateAndValidateFloat32Array( | |
| 90 const unsigned&, | |
| 91 ExceptionState* = nullptr); | |
| 92 }; | |
| 93 | |
| 94 } // namespace blink | |
| 95 | |
| 96 #endif // Float32ImageData_h | |
| OLD | NEW |