| Index: third_party/WebKit/Source/core/html/ImageData.h
|
| diff --git a/third_party/WebKit/Source/core/html/ImageData.h b/third_party/WebKit/Source/core/html/ImageData.h
|
| index 206671a1b48fba1f7b1937dc4cb78414fcb93f8b..286092d814f72f1f2ca689ec7ede782b27f07420 100644
|
| --- a/third_party/WebKit/Source/core/html/ImageData.h
|
| +++ b/third_party/WebKit/Source/core/html/ImageData.h
|
| @@ -31,18 +31,44 @@
|
|
|
| #include "bindings/core/v8/ScriptWrappable.h"
|
| #include "core/CoreExport.h"
|
| +#include "core/dom/DOMArrayBufferView.h"
|
| #include "core/dom/DOMTypedArray.h"
|
| #include "core/imagebitmap/ImageBitmapSource.h"
|
| #include "platform/geometry/IntRect.h"
|
| #include "platform/geometry/IntSize.h"
|
| #include "platform/heap/Handle.h"
|
| +#include "wtf/CheckedNumeric.h"
|
| #include "wtf/Compiler.h"
|
| +#include "wtf/text/WTFString.h"
|
|
|
| namespace blink {
|
|
|
| class ExceptionState;
|
| class ImageBitmapOptions;
|
|
|
| +enum ConstructorParams {
|
| + kParamSize = 1,
|
| + kParamWidth = 1 << 1,
|
| + kParamHeight = 1 << 2,
|
| + kParamData = 1 << 3,
|
| + kParamColorSpace = 1 << 4,
|
| +};
|
| +
|
| +enum ImageDataType {
|
| + kUint8ClampedImageData,
|
| + kFloat32ImageData,
|
| +};
|
| +
|
| +enum ImageDataColorSpace {
|
| + kLegacyImageDataColorSpace,
|
| + kSRGBImageDataColorSpace,
|
| + kLinearRGBImageDataColorSpace,
|
| +};
|
| +
|
| +const char* const kLinearRGBImageDataColorSpaceName = "linear-rgb";
|
| +const char* const kSRGBImageDataColorSpaceName = "srgb";
|
| +const char* const kLegacyImageDataColorSpaceName = "legacy-srgb";
|
| +
|
| class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>,
|
| public ScriptWrappable,
|
| public ImageBitmapSource {
|
| @@ -60,9 +86,30 @@ class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>,
|
| unsigned height,
|
| ExceptionState&);
|
|
|
| + static ImageData* createForTest(const IntSize&);
|
| +
|
| + ImageData* createImageData(unsigned width,
|
| + unsigned height,
|
| + String colorSpace,
|
| + ExceptionState&);
|
| + ImageData* createImageData(DOMUint8ClampedArray*,
|
| + unsigned width,
|
| + String colorSpace,
|
| + ExceptionState&);
|
| + ImageData* createImageData(DOMUint8ClampedArray*,
|
| + unsigned width,
|
| + unsigned height,
|
| + String colorSpace,
|
| + ExceptionState&);
|
| +
|
| + static ImageDataColorSpace getImageDataColorSpace(String);
|
| + static String getImageDataColorSpaceName(ImageDataColorSpace);
|
| +
|
| IntSize size() const { return m_size; }
|
| int width() const { return m_size.width(); }
|
| int height() const { return m_size.height(); }
|
| + String colorSpace() const { return getImageDataColorSpaceName(m_colorSpace); }
|
| + ImageDataColorSpace imageDataColorSpace() { return m_colorSpace; }
|
| const DOMUint8ClampedArray* data() const { return m_data.get(); }
|
| DOMUint8ClampedArray* data() { return m_data.get(); }
|
|
|
| @@ -81,16 +128,28 @@ class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>,
|
| const WrapperTypeInfo*,
|
| v8::Local<v8::Object> wrapper) override;
|
|
|
| - private:
|
| - ImageData(const IntSize&, DOMUint8ClampedArray*);
|
| + static bool validateConstructorArguments(
|
| + const unsigned&,
|
| + const IntSize* = nullptr,
|
| + const unsigned& = 0,
|
| + const unsigned& = 0,
|
| + const DOMArrayBufferView* = nullptr,
|
| + const String* = nullptr,
|
| + ExceptionState* = nullptr,
|
| + ImageDataType = kUint8ClampedImageData);
|
|
|
| - static bool validateConstructorArguments(DOMUint8ClampedArray*,
|
| - unsigned width,
|
| - unsigned&,
|
| - ExceptionState&);
|
| + private:
|
| + ImageData(const IntSize&,
|
| + DOMUint8ClampedArray*,
|
| + String = kLegacyImageDataColorSpaceName);
|
|
|
| IntSize m_size;
|
| + ImageDataColorSpace m_colorSpace;
|
| Member<DOMUint8ClampedArray> m_data;
|
| +
|
| + static DOMUint8ClampedArray* allocateAndValidateUint8ClampedArray(
|
| + const unsigned&,
|
| + ExceptionState* = nullptr);
|
| };
|
|
|
| } // namespace blink
|
|
|