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 "bindings/core/v8/ScriptWrappable.h" | 8 #include "bindings/core/v8/ScriptWrappable.h" |
9 #include "core/CoreExport.h" | 9 #include "core/CoreExport.h" |
10 #include "core/html/HTMLImageElement.h" | 10 #include "core/html/HTMLImageElement.h" |
11 #include "core/html/canvas/CanvasImageSource.h" | 11 #include "core/html/canvas/CanvasImageSource.h" |
12 #include "core/imagebitmap/ImageBitmapOptions.h" | 12 #include "core/imagebitmap/ImageBitmapOptions.h" |
13 #include "core/imagebitmap/ImageBitmapSource.h" | 13 #include "core/imagebitmap/ImageBitmapSource.h" |
14 #include "platform/geometry/IntRect.h" | 14 #include "platform/geometry/IntRect.h" |
15 #include "platform/graphics/Image.h" | 15 #include "platform/graphics/Image.h" |
16 #include "platform/graphics/ImageBuffer.h" | 16 #include "platform/graphics/ImageBuffer.h" |
17 #include "platform/graphics/StaticBitmapImage.h" | 17 #include "platform/graphics/StaticBitmapImage.h" |
18 #include "platform/heap/Handle.h" | 18 #include "platform/heap/Handle.h" |
19 #include "third_party/skia/include/core/SkRefCnt.h" | 19 #include "third_party/skia/include/core/SkRefCnt.h" |
20 #include "wtf/PassRefPtr.h" | 20 #include "wtf/PassRefPtr.h" |
21 #include <memory> | 21 #include <memory> |
22 | 22 |
23 namespace blink { | 23 namespace blink { |
24 class HTMLCanvasElement; | 24 class HTMLCanvasElement; |
25 class HTMLVideoElement; | 25 class HTMLVideoElement; |
26 class ImageData; | 26 class ImageData; |
27 class ImageDecoder; | 27 class ImageDecoder; |
| 28 class OffscreenCanvas; |
28 | 29 |
29 enum AlphaDisposition { | 30 enum AlphaDisposition { |
30 PremultiplyAlpha, | 31 PremultiplyAlpha, |
31 DontPremultiplyAlpha, | 32 DontPremultiplyAlpha, |
32 }; | 33 }; |
33 enum DataColorFormat { | 34 enum DataColorFormat { |
34 RGBAColorType, | 35 RGBAColorType, |
35 N32ColorType, | 36 N32ColorType, |
36 }; | 37 }; |
37 | 38 |
38 class CORE_EXPORT ImageBitmap final | 39 class CORE_EXPORT ImageBitmap final |
39 : public GarbageCollectedFinalized<ImageBitmap>, | 40 : public GarbageCollectedFinalized<ImageBitmap>, |
40 public ScriptWrappable, | 41 public ScriptWrappable, |
41 public CanvasImageSource, | 42 public CanvasImageSource, |
42 public ImageBitmapSource { | 43 public ImageBitmapSource { |
43 DEFINE_WRAPPERTYPEINFO(); | 44 DEFINE_WRAPPERTYPEINFO(); |
44 | 45 |
45 public: | 46 public: |
46 static ImageBitmap* create(HTMLImageElement*, | 47 static ImageBitmap* create(HTMLImageElement*, |
47 Optional<IntRect>, | 48 Optional<IntRect>, |
48 Document*, | 49 Document*, |
49 const ImageBitmapOptions& = ImageBitmapOptions()); | 50 const ImageBitmapOptions& = ImageBitmapOptions()); |
50 static ImageBitmap* create(HTMLVideoElement*, | 51 static ImageBitmap* create(HTMLVideoElement*, |
51 Optional<IntRect>, | 52 Optional<IntRect>, |
52 Document*, | 53 Document*, |
53 const ImageBitmapOptions& = ImageBitmapOptions()); | 54 const ImageBitmapOptions& = ImageBitmapOptions()); |
54 static ImageBitmap* create(HTMLCanvasElement*, | 55 static ImageBitmap* create(HTMLCanvasElement*, |
55 Optional<IntRect>, | 56 Optional<IntRect>, |
56 const ImageBitmapOptions& = ImageBitmapOptions()); | 57 const ImageBitmapOptions& = ImageBitmapOptions()); |
| 58 static ImageBitmap* create(OffscreenCanvas*, |
| 59 Optional<IntRect>, |
| 60 const ImageBitmapOptions& = ImageBitmapOptions()); |
57 static ImageBitmap* create(ImageData*, | 61 static ImageBitmap* create(ImageData*, |
58 Optional<IntRect>, | 62 Optional<IntRect>, |
59 const ImageBitmapOptions& = ImageBitmapOptions()); | 63 const ImageBitmapOptions& = ImageBitmapOptions()); |
60 static ImageBitmap* create(ImageBitmap*, | 64 static ImageBitmap* create(ImageBitmap*, |
61 Optional<IntRect>, | 65 Optional<IntRect>, |
62 const ImageBitmapOptions& = ImageBitmapOptions()); | 66 const ImageBitmapOptions& = ImageBitmapOptions()); |
63 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); | 67 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); |
64 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, | 68 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, |
65 Optional<IntRect>, | 69 Optional<IntRect>, |
66 const ImageBitmapOptions& = ImageBitmapOptions()); | 70 const ImageBitmapOptions& = ImageBitmapOptions()); |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 private: | 133 private: |
130 ImageBitmap(HTMLImageElement*, | 134 ImageBitmap(HTMLImageElement*, |
131 Optional<IntRect>, | 135 Optional<IntRect>, |
132 Document*, | 136 Document*, |
133 const ImageBitmapOptions&); | 137 const ImageBitmapOptions&); |
134 ImageBitmap(HTMLVideoElement*, | 138 ImageBitmap(HTMLVideoElement*, |
135 Optional<IntRect>, | 139 Optional<IntRect>, |
136 Document*, | 140 Document*, |
137 const ImageBitmapOptions&); | 141 const ImageBitmapOptions&); |
138 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions&); | 142 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions&); |
| 143 ImageBitmap(OffscreenCanvas*, Optional<IntRect>, const ImageBitmapOptions&); |
139 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&); | 144 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&); |
140 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&); | 145 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&); |
141 ImageBitmap(PassRefPtr<StaticBitmapImage>); | 146 ImageBitmap(PassRefPtr<StaticBitmapImage>); |
142 ImageBitmap(PassRefPtr<StaticBitmapImage>, | 147 ImageBitmap(PassRefPtr<StaticBitmapImage>, |
143 Optional<IntRect>, | 148 Optional<IntRect>, |
144 const ImageBitmapOptions&); | 149 const ImageBitmapOptions&); |
145 ImageBitmap(const void* pixelData, | 150 ImageBitmap(const void* pixelData, |
146 uint32_t width, | 151 uint32_t width, |
147 uint32_t height, | 152 uint32_t height, |
148 bool isImageBitmapPremultiplied, | 153 bool isImageBitmapPremultiplied, |
149 bool isImageBitmapOriginClean); | 154 bool isImageBitmapOriginClean); |
150 | 155 |
151 RefPtr<StaticBitmapImage> m_image; | 156 RefPtr<StaticBitmapImage> m_image; |
152 bool m_isNeutered = false; | 157 bool m_isNeutered = false; |
153 }; | 158 }; |
154 | 159 |
155 } // namespace blink | 160 } // namespace blink |
156 | 161 |
157 #endif // ImageBitmap_h | 162 #endif // ImageBitmap_h |
OLD | NEW |