Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(222)

Side by Side Diff: third_party/WebKit/Source/core/frame/ImageBitmap.h

Issue 2802813002: Adds SVGImageElement as a ImageBitmapSource (Closed)
Patch Set: merge Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "bindings/core/v8/ScriptWrappable.h" 9 #include "bindings/core/v8/ScriptWrappable.h"
9 #include "core/CoreExport.h" 10 #include "core/CoreExport.h"
10 #include "core/html/HTMLImageElement.h"
11 #include "core/html/canvas/CanvasImageSource.h" 11 #include "core/html/canvas/CanvasImageSource.h"
12 #include "core/html/canvas/HTMLAndSVGImageElementSource.h"
12 #include "core/imagebitmap/ImageBitmapOptions.h" 13 #include "core/imagebitmap/ImageBitmapOptions.h"
13 #include "core/imagebitmap/ImageBitmapSource.h" 14 #include "core/imagebitmap/ImageBitmapSource.h"
14 #include "platform/geometry/IntRect.h" 15 #include "platform/geometry/IntRect.h"
15 #include "platform/graphics/Image.h" 16 #include "platform/graphics/Image.h"
16 #include "platform/graphics/ImageBuffer.h" 17 #include "platform/graphics/ImageBuffer.h"
17 #include "platform/graphics/StaticBitmapImage.h" 18 #include "platform/graphics/StaticBitmapImage.h"
18 #include "platform/heap/Handle.h" 19 #include "platform/heap/Handle.h"
19 #include "third_party/skia/include/core/SkRefCnt.h" 20 #include "third_party/skia/include/core/SkRefCnt.h"
20 #include "wtf/PassRefPtr.h" 21 #include "wtf/PassRefPtr.h"
21 #include <memory>
22 22
23 namespace blink { 23 namespace blink {
24 class Document;
24 class HTMLCanvasElement; 25 class HTMLCanvasElement;
25 class HTMLVideoElement; 26 class HTMLVideoElement;
26 class ImageData; 27 class ImageData;
27 class ImageDecoder; 28 class ImageDecoder;
28 class OffscreenCanvas; 29 class OffscreenCanvas;
29 30
30 enum AlphaDisposition { 31 enum AlphaDisposition {
31 kPremultiplyAlpha, 32 kPremultiplyAlpha,
32 kDontPremultiplyAlpha, 33 kDontPremultiplyAlpha,
33 }; 34 };
34 enum DataColorFormat { 35 enum DataColorFormat {
35 kRGBAColorType, 36 kRGBAColorType,
36 kN32ColorType, 37 kN32ColorType,
37 }; 38 };
38 enum ColorSpaceInfoUpdate { 39 enum ColorSpaceInfoUpdate {
39 kUpdateColorSpaceInformation, 40 kUpdateColorSpaceInformation,
40 kDontUpdateColorSpaceInformation, 41 kDontUpdateColorSpaceInformation,
41 }; 42 };
42 43
43 class CORE_EXPORT ImageBitmap final 44 class CORE_EXPORT ImageBitmap final
44 : public GarbageCollectedFinalized<ImageBitmap>, 45 : public GarbageCollectedFinalized<ImageBitmap>,
45 public ScriptWrappable, 46 public ScriptWrappable,
46 public CanvasImageSource, 47 public CanvasImageSource,
47 public ImageBitmapSource { 48 public ImageBitmapSource {
48 DEFINE_WRAPPERTYPEINFO(); 49 DEFINE_WRAPPERTYPEINFO();
49 50
50 public: 51 public:
51 static ImageBitmap* Create(HTMLImageElement*, 52 static ImageBitmap* Create(HTMLAndSVGImageElementSource*,
52 Optional<IntRect>, 53 Optional<IntRect>,
53 Document*, 54 Document*,
54 const ImageBitmapOptions& = ImageBitmapOptions()); 55 const ImageBitmapOptions& = ImageBitmapOptions());
55 static ImageBitmap* Create(HTMLVideoElement*, 56 static ImageBitmap* Create(HTMLVideoElement*,
56 Optional<IntRect>, 57 Optional<IntRect>,
57 Document*, 58 Document*,
58 const ImageBitmapOptions& = ImageBitmapOptions()); 59 const ImageBitmapOptions& = ImageBitmapOptions());
59 static ImageBitmap* Create(HTMLCanvasElement*, 60 static ImageBitmap* Create(HTMLCanvasElement*,
60 Optional<IntRect>, 61 Optional<IntRect>,
61 const ImageBitmapOptions& = ImageBitmapOptions()); 62 const ImageBitmapOptions& = ImageBitmapOptions());
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 IntSize BitmapSourceSize() const override { return size(); } 132 IntSize BitmapSourceSize() const override { return size(); }
132 ScriptPromise CreateImageBitmap(ScriptState*, 133 ScriptPromise CreateImageBitmap(ScriptState*,
133 EventTarget&, 134 EventTarget&,
134 Optional<IntRect>, 135 Optional<IntRect>,
135 const ImageBitmapOptions&, 136 const ImageBitmapOptions&,
136 ExceptionState&) override; 137 ExceptionState&) override;
137 138
138 DECLARE_VIRTUAL_TRACE(); 139 DECLARE_VIRTUAL_TRACE();
139 140
140 private: 141 private:
141 ImageBitmap(HTMLImageElement*, 142 ImageBitmap(HTMLAndSVGImageElementSource*,
142 Optional<IntRect>, 143 Optional<IntRect>,
143 Document*, 144 Document*,
144 const ImageBitmapOptions&); 145 const ImageBitmapOptions&);
145 ImageBitmap(HTMLVideoElement*, 146 ImageBitmap(HTMLVideoElement*,
146 Optional<IntRect>, 147 Optional<IntRect>,
147 Document*, 148 Document*,
148 const ImageBitmapOptions&); 149 const ImageBitmapOptions&);
149 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions&); 150 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions&);
150 ImageBitmap(OffscreenCanvas*, Optional<IntRect>, const ImageBitmapOptions&); 151 ImageBitmap(OffscreenCanvas*, Optional<IntRect>, const ImageBitmapOptions&);
151 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&); 152 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&);
152 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&); 153 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&);
153 ImageBitmap(PassRefPtr<StaticBitmapImage>); 154 ImageBitmap(PassRefPtr<StaticBitmapImage>);
154 ImageBitmap(PassRefPtr<StaticBitmapImage>, 155 ImageBitmap(PassRefPtr<StaticBitmapImage>,
155 Optional<IntRect>, 156 Optional<IntRect>,
156 const ImageBitmapOptions&); 157 const ImageBitmapOptions&);
157 ImageBitmap(const void* pixel_data, 158 ImageBitmap(const void* pixel_data,
158 uint32_t width, 159 uint32_t width,
159 uint32_t height, 160 uint32_t height,
160 bool is_image_bitmap_premultiplied, 161 bool is_image_bitmap_premultiplied,
161 bool is_image_bitmap_origin_clean); 162 bool is_image_bitmap_origin_clean);
162 163
163 RefPtr<StaticBitmapImage> image_; 164 RefPtr<StaticBitmapImage> image_;
164 bool is_neutered_ = false; 165 bool is_neutered_ = false;
165 }; 166 };
166 167
167 } // namespace blink 168 } // namespace blink
168 169
169 #endif // ImageBitmap_h 170 #endif // ImageBitmap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698