| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 kParamHeight = 1 << 2, | 57 kParamHeight = 1 << 2, |
| 58 kParamData = 1 << 3, | 58 kParamData = 1 << 3, |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 enum ImageDataStorageFormat { | 61 enum ImageDataStorageFormat { |
| 62 kUint8ClampedArrayStorageFormat, | 62 kUint8ClampedArrayStorageFormat, |
| 63 kUint16ArrayStorageFormat, | 63 kUint16ArrayStorageFormat, |
| 64 kFloat32ArrayStorageFormat, | 64 kFloat32ArrayStorageFormat, |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 enum StorageFormatSource { |
| 68 kStorageFormatFromColorSettings, |
| 69 kStorageFormatFromBufferType, |
| 70 }; |
| 71 |
| 67 constexpr const char* kUint8ClampedArrayStorageFormatName = "uint8"; | 72 constexpr const char* kUint8ClampedArrayStorageFormatName = "uint8"; |
| 68 constexpr const char* kUint16ArrayStorageFormatName = "uint16"; | 73 constexpr const char* kUint16ArrayStorageFormatName = "uint16"; |
| 69 constexpr const char* kFloat32ArrayStorageFormatName = "float32"; | 74 constexpr const char* kFloat32ArrayStorageFormatName = "float32"; |
| 70 | 75 |
| 71 class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>, | 76 class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>, |
| 72 public ScriptWrappable, | 77 public ScriptWrappable, |
| 73 public ImageBitmapSource { | 78 public ImageBitmapSource { |
| 74 DEFINE_WRAPPERTYPEINFO(); | 79 DEFINE_WRAPPERTYPEINFO(); |
| 75 | 80 |
| 76 public: | 81 public: |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 static bool validateConstructorArguments(const unsigned&, | 141 static bool validateConstructorArguments(const unsigned&, |
| 137 const IntSize* = nullptr, | 142 const IntSize* = nullptr, |
| 138 const unsigned& = 0, | 143 const unsigned& = 0, |
| 139 const unsigned& = 0, | 144 const unsigned& = 0, |
| 140 const DOMArrayBufferView* = nullptr, | 145 const DOMArrayBufferView* = nullptr, |
| 141 ExceptionState* = nullptr); | 146 ExceptionState* = nullptr); |
| 142 | 147 |
| 143 private: | 148 private: |
| 144 ImageData(const IntSize&, | 149 ImageData(const IntSize&, |
| 145 DOMArrayBufferView*, | 150 DOMArrayBufferView*, |
| 146 const ImageDataColorSettings* = nullptr); | 151 const ImageDataColorSettings* = nullptr, |
| 152 StorageFormatSource = kStorageFormatFromColorSettings); |
| 147 | 153 |
| 148 IntSize m_size; | 154 IntSize m_size; |
| 149 ImageDataColorSettings m_colorSettings; | 155 ImageDataColorSettings m_colorSettings; |
| 150 ImageDataArray m_dataUnion; | 156 ImageDataArray m_dataUnion; |
| 151 Member<DOMUint8ClampedArray> m_data; | 157 Member<DOMUint8ClampedArray> m_data; |
| 152 Member<DOMUint16Array> m_dataU16; | 158 Member<DOMUint16Array> m_dataU16; |
| 153 Member<DOMFloat32Array> m_dataF32; | 159 Member<DOMFloat32Array> m_dataF32; |
| 154 | 160 |
| 155 static DOMArrayBufferView* allocateAndValidateDataArray( | 161 static DOMArrayBufferView* allocateAndValidateDataArray( |
| 156 const unsigned&, | 162 const unsigned&, |
| 157 ImageDataStorageFormat, | 163 ImageDataStorageFormat, |
| 158 ExceptionState* = nullptr); | 164 ExceptionState* = nullptr); |
| 159 }; | 165 }; |
| 160 | 166 |
| 161 } // namespace blink | 167 } // namespace blink |
| 162 | 168 |
| 163 #endif // ImageData_h | 169 #endif // ImageData_h |
| OLD | NEW |