| 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 18 matching lines...) Expand all Loading... |
| 29 #ifndef ImageData_h | 29 #ifndef ImageData_h |
| 30 #define ImageData_h | 30 #define ImageData_h |
| 31 | 31 |
| 32 #include "bindings/core/v8/ScriptWrappable.h" | 32 #include "bindings/core/v8/ScriptWrappable.h" |
| 33 #include "core/CoreExport.h" | 33 #include "core/CoreExport.h" |
| 34 #include "core/dom/DOMTypedArray.h" | 34 #include "core/dom/DOMTypedArray.h" |
| 35 #include "core/imagebitmap/ImageBitmapSource.h" | 35 #include "core/imagebitmap/ImageBitmapSource.h" |
| 36 #include "platform/geometry/IntRect.h" | 36 #include "platform/geometry/IntRect.h" |
| 37 #include "platform/geometry/IntSize.h" | 37 #include "platform/geometry/IntSize.h" |
| 38 #include "platform/heap/Handle.h" | 38 #include "platform/heap/Handle.h" |
| 39 #include "wtf/RefPtr.h" | |
| 40 | 39 |
| 41 namespace blink { | 40 namespace blink { |
| 42 | 41 |
| 43 class ExceptionState; | 42 class ExceptionState; |
| 44 class ImageBitmapOptions; | 43 class ImageBitmapOptions; |
| 45 | 44 |
| 46 class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>,
public ScriptWrappable, public ImageBitmapSource { | 45 class CORE_EXPORT ImageData final : public GarbageCollectedFinalized<ImageData>,
public ScriptWrappable, public ImageBitmapSource { |
| 47 DEFINE_WRAPPERTYPEINFO(); | 46 DEFINE_WRAPPERTYPEINFO(); |
| 48 public: | 47 public: |
| 49 static ImageData* create(const IntSize&); | 48 static ImageData* create(const IntSize&); |
| 50 static ImageData* create(const IntSize&, PassRefPtr<DOMUint8ClampedArray>); | 49 static ImageData* create(const IntSize&, DOMUint8ClampedArray*); |
| 51 static ImageData* create(unsigned width, unsigned height, ExceptionState&); | 50 static ImageData* create(unsigned width, unsigned height, ExceptionState&); |
| 52 static ImageData* create(DOMUint8ClampedArray*, unsigned width, ExceptionSta
te&); | 51 static ImageData* create(DOMUint8ClampedArray*, unsigned width, ExceptionSta
te&); |
| 53 static ImageData* create(DOMUint8ClampedArray*, unsigned width, unsigned hei
ght, ExceptionState&); | 52 static ImageData* create(DOMUint8ClampedArray*, unsigned width, unsigned hei
ght, ExceptionState&); |
| 54 | 53 |
| 55 IntSize size() const { return m_size; } | 54 IntSize size() const { return m_size; } |
| 56 int width() const { return m_size.width(); } | 55 int width() const { return m_size.width(); } |
| 57 int height() const { return m_size.height(); } | 56 int height() const { return m_size.height(); } |
| 58 const DOMUint8ClampedArray* data() const { return m_data.get(); } | 57 const DOMUint8ClampedArray* data() const { return m_data.get(); } |
| 59 DOMUint8ClampedArray* data() { return m_data.get(); } | 58 DOMUint8ClampedArray* data() { return m_data.get(); } |
| 60 | 59 |
| 61 // ImageBitmapSource implementation | 60 // ImageBitmapSource implementation |
| 62 IntSize bitmapSourceSize() const override { return m_size; } | 61 IntSize bitmapSourceSize() const override { return m_size; } |
| 63 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy,
int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; | 62 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy,
int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; |
| 64 | 63 |
| 65 DEFINE_INLINE_TRACE() { } | 64 DEFINE_INLINE_TRACE() |
| 65 { |
| 66 visitor->trace(m_data); |
| 67 } |
| 66 | 68 |
| 67 void dispose(); | 69 void dispose(); |
| 68 | 70 |
| 69 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; | 71 v8::Local<v8::Object> associateWithWrapper(v8::Isolate*, const WrapperTypeIn
fo*, v8::Local<v8::Object> wrapper) override WARN_UNUSED_RETURN; |
| 70 | 72 |
| 71 private: | 73 private: |
| 72 ImageData(const IntSize&, PassRefPtr<DOMUint8ClampedArray>); | 74 ImageData(const IntSize&, DOMUint8ClampedArray*); |
| 73 | 75 |
| 74 static bool validateConstructorArguments(DOMUint8ClampedArray*, unsigned wid
th, unsigned&, ExceptionState&); | 76 static bool validateConstructorArguments(DOMUint8ClampedArray*, unsigned wid
th, unsigned&, ExceptionState&); |
| 75 | 77 |
| 76 IntSize m_size; | 78 IntSize m_size; |
| 77 RefPtr<DOMUint8ClampedArray> m_data; | 79 Member<DOMUint8ClampedArray> m_data; |
| 78 }; | 80 }; |
| 79 | 81 |
| 80 } // namespace blink | 82 } // namespace blink |
| 81 | 83 |
| 82 #endif // ImageData_h | 84 #endif // ImageData_h |
| OLD | NEW |