| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 Apple 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 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 ImageData* createImageData(unsigned width, | 92 ImageData* createImageData(unsigned width, |
| 93 unsigned height, | 93 unsigned height, |
| 94 const ImageDataColorSettings&, | 94 const ImageDataColorSettings&, |
| 95 ExceptionState&); | 95 ExceptionState&); |
| 96 ImageData* createImageData(ImageDataArray&, | 96 ImageData* createImageData(ImageDataArray&, |
| 97 unsigned width, | 97 unsigned width, |
| 98 unsigned height, | 98 unsigned height, |
| 99 ImageDataColorSettings&, | 99 ImageDataColorSettings&, |
| 100 ExceptionState&); | 100 ExceptionState&); |
| 101 | 101 |
| 102 void getColorSettings(ImageDataColorSettings& result) { |
| 103 result = m_colorSettings; |
| 104 } |
| 105 |
| 102 static ImageData* createForTest(const IntSize&); | 106 static ImageData* createForTest(const IntSize&); |
| 103 static ImageData* createForTest(const IntSize&, | 107 static ImageData* createForTest(const IntSize&, |
| 104 DOMArrayBufferView*, | 108 DOMArrayBufferView*, |
| 105 const ImageDataColorSettings* = nullptr); | 109 const ImageDataColorSettings* = nullptr); |
| 106 static sk_sp<SkColorSpace> getSkColorSpaceForTest(const CanvasColorSpace&, | 110 static sk_sp<SkColorSpace> getSkColorSpaceForTest(const CanvasColorSpace&, |
| 107 const CanvasPixelFormat&); | 111 const CanvasPixelFormat&); |
| 108 | 112 |
| 109 static CanvasColorSpace canvasColorSpace(const String&); | 113 static CanvasColorSpace canvasColorSpace(const String&); |
| 110 static String canvasColorSpaceName(const CanvasColorSpace&); | 114 static String canvasColorSpaceName(const CanvasColorSpace&); |
| 111 static ImageDataStorageFormat imageDataStorageFormat(const String&); | 115 static ImageDataStorageFormat imageDataStorageFormat(const String&); |
| 112 static unsigned storageFormatDataSize(const String&); | 116 static unsigned storageFormatDataSize(const String&); |
| 113 static DOMArrayBufferView* | 117 static DOMArrayBufferView* |
| 114 convertPixelsFromCanvasPixelFormatToImageDataStorageFormat( | 118 convertPixelsFromCanvasPixelFormatToImageDataStorageFormat( |
| 115 WTF::ArrayBufferContents&, | 119 WTF::ArrayBufferContents&, |
| 116 CanvasPixelFormat, | 120 CanvasPixelFormat, |
| 117 ImageDataStorageFormat); | 121 ImageDataStorageFormat); |
| 118 | 122 |
| 119 IntSize size() const { return m_size; } | 123 IntSize size() const { return m_size; } |
| 120 int width() const { return m_size.width(); } | 124 int width() const { return m_size.width(); } |
| 121 int height() const { return m_size.height(); } | 125 int height() const { return m_size.height(); } |
| 122 | 126 |
| 123 DOMUint8ClampedArray* data(); | 127 DOMUint8ClampedArray* data(); |
| 124 const DOMUint8ClampedArray* data() const; | 128 const DOMUint8ClampedArray* data() const; |
| 125 ImageDataArray& dataUnion() { return m_dataUnion; } | 129 ImageDataArray& dataUnion() { return m_dataUnion; } |
| 126 const ImageDataArray& dataUnion() const { return m_dataUnion; } | 130 const ImageDataArray& dataUnion() const { return m_dataUnion; } |
| 127 void dataUnion(ImageDataArray& result) { result = m_dataUnion; }; | 131 void dataUnion(ImageDataArray& result) { result = m_dataUnion; }; |
| 128 const ImageDataColorSettings& colorSettings() const { | |
| 129 return m_colorSettings; | |
| 130 } | |
| 131 void colorSettings(ImageDataColorSettings& result) { | |
| 132 result = m_colorSettings; | |
| 133 }; | |
| 134 | 132 |
| 135 sk_sp<SkColorSpace> skColorSpace(); | 133 sk_sp<SkColorSpace> skColorSpace(); |
| 136 bool imageDataInCanvasColorSettings(const CanvasColorSpace&, | 134 bool imageDataInCanvasColorSettings(const CanvasColorSpace&, |
| 137 const CanvasPixelFormat&, | 135 const CanvasPixelFormat&, |
| 138 std::unique_ptr<uint8_t[]>&); | 136 std::unique_ptr<uint8_t[]>&); |
| 139 | 137 |
| 140 // ImageBitmapSource implementation | 138 // ImageBitmapSource implementation |
| 141 IntSize bitmapSourceSize() const override { return m_size; } | 139 IntSize bitmapSourceSize() const override { return m_size; } |
| 142 ScriptPromise createImageBitmap(ScriptState*, | 140 ScriptPromise createImageBitmap(ScriptState*, |
| 143 EventTarget&, | 141 EventTarget&, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 static DOMFloat32Array* convertFloat16ArrayToFloat32Array(const uint16_t*, | 191 static DOMFloat32Array* convertFloat16ArrayToFloat32Array(const uint16_t*, |
| 194 unsigned); | 192 unsigned); |
| 195 | 193 |
| 196 static sk_sp<SkColorSpace> getSkColorSpace(const CanvasColorSpace&, | 194 static sk_sp<SkColorSpace> getSkColorSpace(const CanvasColorSpace&, |
| 197 const CanvasPixelFormat&); | 195 const CanvasPixelFormat&); |
| 198 }; | 196 }; |
| 199 | 197 |
| 200 } // namespace blink | 198 } // namespace blink |
| 201 | 199 |
| 202 #endif // ImageData_h | 200 #endif // ImageData_h |
| OLD | NEW |