OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef ImageBitmap_h | 5 #ifndef ImageBitmap_h |
6 #define ImageBitmap_h | 6 #define ImageBitmap_h |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include "bindings/core/v8/ScriptWrappable.h" | 9 #include "bindings/core/v8/ScriptWrappable.h" |
10 #include "core/CoreExport.h" | 10 #include "core/CoreExport.h" |
| 11 #include "core/html/HTMLImageElement.h" |
11 #include "core/html/canvas/CanvasImageSource.h" | 12 #include "core/html/canvas/CanvasImageSource.h" |
12 #include "core/html/canvas/ImageElementBase.h" | |
13 #include "core/imagebitmap/ImageBitmapOptions.h" | 13 #include "core/imagebitmap/ImageBitmapOptions.h" |
14 #include "core/imagebitmap/ImageBitmapSource.h" | 14 #include "core/imagebitmap/ImageBitmapSource.h" |
15 #include "platform/geometry/IntRect.h" | 15 #include "platform/geometry/IntRect.h" |
16 #include "platform/graphics/Image.h" | 16 #include "platform/graphics/Image.h" |
17 #include "platform/graphics/ImageBuffer.h" | 17 #include "platform/graphics/ImageBuffer.h" |
18 #include "platform/graphics/StaticBitmapImage.h" | 18 #include "platform/graphics/StaticBitmapImage.h" |
19 #include "platform/heap/Handle.h" | 19 #include "platform/heap/Handle.h" |
20 #include "platform/wtf/PassRefPtr.h" | 20 #include "platform/wtf/PassRefPtr.h" |
21 #include "third_party/skia/include/core/SkRefCnt.h" | 21 #include "third_party/skia/include/core/SkRefCnt.h" |
22 | 22 |
23 namespace blink { | 23 namespace blink { |
24 class Document; | |
25 class HTMLCanvasElement; | 24 class HTMLCanvasElement; |
26 class HTMLVideoElement; | 25 class HTMLVideoElement; |
27 class ImageData; | 26 class ImageData; |
28 class ImageDecoder; | 27 class ImageDecoder; |
29 class OffscreenCanvas; | 28 class OffscreenCanvas; |
30 | 29 |
31 enum AlphaDisposition { | 30 enum AlphaDisposition { |
32 kPremultiplyAlpha, | 31 kPremultiplyAlpha, |
33 kDontPremultiplyAlpha, | 32 kDontPremultiplyAlpha, |
34 }; | 33 }; |
35 enum DataColorFormat { | 34 enum DataColorFormat { |
36 kRGBAColorType, | 35 kRGBAColorType, |
37 kN32ColorType, | 36 kN32ColorType, |
38 }; | 37 }; |
39 enum ColorSpaceInfoUpdate { | 38 enum ColorSpaceInfoUpdate { |
40 kUpdateColorSpaceInformation, | 39 kUpdateColorSpaceInformation, |
41 kDontUpdateColorSpaceInformation, | 40 kDontUpdateColorSpaceInformation, |
42 }; | 41 }; |
43 | 42 |
44 class CORE_EXPORT ImageBitmap final | 43 class CORE_EXPORT ImageBitmap final |
45 : public GarbageCollectedFinalized<ImageBitmap>, | 44 : public GarbageCollectedFinalized<ImageBitmap>, |
46 public ScriptWrappable, | 45 public ScriptWrappable, |
47 public CanvasImageSource, | 46 public CanvasImageSource, |
48 public ImageBitmapSource { | 47 public ImageBitmapSource { |
49 DEFINE_WRAPPERTYPEINFO(); | 48 DEFINE_WRAPPERTYPEINFO(); |
50 | 49 |
51 public: | 50 public: |
52 static ImageBitmap* Create(ImageElementBase*, | 51 static ImageBitmap* Create(HTMLImageElement*, |
53 Optional<IntRect>, | 52 Optional<IntRect>, |
54 Document*, | 53 Document*, |
55 const ImageBitmapOptions& = ImageBitmapOptions()); | 54 const ImageBitmapOptions& = ImageBitmapOptions()); |
56 static ImageBitmap* Create(HTMLVideoElement*, | 55 static ImageBitmap* Create(HTMLVideoElement*, |
57 Optional<IntRect>, | 56 Optional<IntRect>, |
58 Document*, | 57 Document*, |
59 const ImageBitmapOptions& = ImageBitmapOptions()); | 58 const ImageBitmapOptions& = ImageBitmapOptions()); |
60 static ImageBitmap* Create(HTMLCanvasElement*, | 59 static ImageBitmap* Create(HTMLCanvasElement*, |
61 Optional<IntRect>, | 60 Optional<IntRect>, |
62 const ImageBitmapOptions& = ImageBitmapOptions()); | 61 const ImageBitmapOptions& = ImageBitmapOptions()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 IntSize BitmapSourceSize() const override { return Size(); } | 131 IntSize BitmapSourceSize() const override { return Size(); } |
133 ScriptPromise CreateImageBitmap(ScriptState*, | 132 ScriptPromise CreateImageBitmap(ScriptState*, |
134 EventTarget&, | 133 EventTarget&, |
135 Optional<IntRect>, | 134 Optional<IntRect>, |
136 const ImageBitmapOptions&, | 135 const ImageBitmapOptions&, |
137 ExceptionState&) override; | 136 ExceptionState&) override; |
138 | 137 |
139 DECLARE_VIRTUAL_TRACE(); | 138 DECLARE_VIRTUAL_TRACE(); |
140 | 139 |
141 private: | 140 private: |
142 ImageBitmap(ImageElementBase*, | 141 ImageBitmap(HTMLImageElement*, |
143 Optional<IntRect>, | 142 Optional<IntRect>, |
144 Document*, | 143 Document*, |
145 const ImageBitmapOptions&); | 144 const ImageBitmapOptions&); |
146 ImageBitmap(HTMLVideoElement*, | 145 ImageBitmap(HTMLVideoElement*, |
147 Optional<IntRect>, | 146 Optional<IntRect>, |
148 Document*, | 147 Document*, |
149 const ImageBitmapOptions&); | 148 const ImageBitmapOptions&); |
150 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions&); | 149 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions&); |
151 ImageBitmap(OffscreenCanvas*, Optional<IntRect>, const ImageBitmapOptions&); | 150 ImageBitmap(OffscreenCanvas*, Optional<IntRect>, const ImageBitmapOptions&); |
152 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&); | 151 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&); |
153 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&); | 152 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&); |
154 ImageBitmap(PassRefPtr<StaticBitmapImage>); | 153 ImageBitmap(PassRefPtr<StaticBitmapImage>); |
155 ImageBitmap(RefPtr<StaticBitmapImage>, | 154 ImageBitmap(RefPtr<StaticBitmapImage>, |
156 Optional<IntRect>, | 155 Optional<IntRect>, |
157 const ImageBitmapOptions&); | 156 const ImageBitmapOptions&); |
158 ImageBitmap(const void* pixel_data, | 157 ImageBitmap(const void* pixel_data, |
159 uint32_t width, | 158 uint32_t width, |
160 uint32_t height, | 159 uint32_t height, |
161 bool is_image_bitmap_premultiplied, | 160 bool is_image_bitmap_premultiplied, |
162 bool is_image_bitmap_origin_clean); | 161 bool is_image_bitmap_origin_clean); |
163 | 162 |
164 RefPtr<StaticBitmapImage> image_; | 163 RefPtr<StaticBitmapImage> image_; |
165 bool is_neutered_ = false; | 164 bool is_neutered_ = false; |
166 }; | 165 }; |
167 | 166 |
168 } // namespace blink | 167 } // namespace blink |
169 | 168 |
170 #endif // ImageBitmap_h | 169 #endif // ImageBitmap_h |
OLD | NEW |