Chromium Code Reviews| 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 "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/HTMLImageElement.h" |
| 11 #include "core/html/canvas/CanvasImageSource.h" | 12 #include "core/html/canvas/CanvasImageSource.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" |
| 15 #include "core/svg/SVGImageElement.h" | |
|
fs
2017/04/06 20:27:54
Not needed now?
fserb
2017/04/06 21:03:49
done. Also removed HTMLImageElement.
| |
| 14 #include "platform/geometry/IntRect.h" | 16 #include "platform/geometry/IntRect.h" |
| 15 #include "platform/graphics/Image.h" | 17 #include "platform/graphics/Image.h" |
| 16 #include "platform/graphics/ImageBuffer.h" | 18 #include "platform/graphics/ImageBuffer.h" |
| 17 #include "platform/graphics/StaticBitmapImage.h" | 19 #include "platform/graphics/StaticBitmapImage.h" |
| 18 #include "platform/heap/Handle.h" | 20 #include "platform/heap/Handle.h" |
| 19 #include "third_party/skia/include/core/SkRefCnt.h" | 21 #include "third_party/skia/include/core/SkRefCnt.h" |
| 20 #include "wtf/PassRefPtr.h" | 22 #include "wtf/PassRefPtr.h" |
| 21 #include <memory> | |
| 22 | 23 |
| 23 namespace blink { | 24 namespace blink { |
| 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 PremultiplyAlpha, | 32 PremultiplyAlpha, |
| 32 DontPremultiplyAlpha, | 33 DontPremultiplyAlpha, |
| 33 }; | 34 }; |
| 34 enum DataColorFormat { | 35 enum DataColorFormat { |
| 35 RGBAColorType, | 36 RGBAColorType, |
| 36 N32ColorType, | 37 N32ColorType, |
| 37 }; | 38 }; |
| 38 enum ColorSpaceInfoUpdate { | 39 enum ColorSpaceInfoUpdate { |
| 39 UpdateColorSpaceInformation, | 40 UpdateColorSpaceInformation, |
| 40 DontUpdateColorSpaceInformation, | 41 DontUpdateColorSpaceInformation, |
| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 IntSize bitmapSourceSize() const override { return size(); } | 133 IntSize bitmapSourceSize() const override { return size(); } |
| 133 ScriptPromise createImageBitmap(ScriptState*, | 134 ScriptPromise createImageBitmap(ScriptState*, |
| 134 EventTarget&, | 135 EventTarget&, |
| 135 Optional<IntRect>, | 136 Optional<IntRect>, |
| 136 const ImageBitmapOptions&, | 137 const ImageBitmapOptions&, |
| 137 ExceptionState&) override; | 138 ExceptionState&) override; |
| 138 | 139 |
| 139 DECLARE_VIRTUAL_TRACE(); | 140 DECLARE_VIRTUAL_TRACE(); |
| 140 | 141 |
| 141 private: | 142 private: |
| 142 ImageBitmap(HTMLImageElement*, | 143 ImageBitmap(HTMLAndSVGImageElementSource*, |
| 143 Optional<IntRect>, | 144 Optional<IntRect>, |
| 144 Document*, | 145 Document*, |
| 145 const ImageBitmapOptions&); | 146 const ImageBitmapOptions&); |
| 146 ImageBitmap(HTMLVideoElement*, | 147 ImageBitmap(HTMLVideoElement*, |
| 147 Optional<IntRect>, | 148 Optional<IntRect>, |
| 148 Document*, | 149 Document*, |
| 149 const ImageBitmapOptions&); | 150 const ImageBitmapOptions&); |
| 150 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions&); | 151 ImageBitmap(HTMLCanvasElement*, Optional<IntRect>, const ImageBitmapOptions&); |
| 151 ImageBitmap(OffscreenCanvas*, Optional<IntRect>, const ImageBitmapOptions&); | 152 ImageBitmap(OffscreenCanvas*, Optional<IntRect>, const ImageBitmapOptions&); |
| 152 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&); | 153 ImageBitmap(ImageData*, Optional<IntRect>, const ImageBitmapOptions&); |
| 153 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&); | 154 ImageBitmap(ImageBitmap*, Optional<IntRect>, const ImageBitmapOptions&); |
| 154 ImageBitmap(PassRefPtr<StaticBitmapImage>); | 155 ImageBitmap(PassRefPtr<StaticBitmapImage>); |
| 155 ImageBitmap(PassRefPtr<StaticBitmapImage>, | 156 ImageBitmap(PassRefPtr<StaticBitmapImage>, |
| 156 Optional<IntRect>, | 157 Optional<IntRect>, |
| 157 const ImageBitmapOptions&); | 158 const ImageBitmapOptions&); |
| 158 ImageBitmap(const void* pixelData, | 159 ImageBitmap(const void* pixelData, |
| 159 uint32_t width, | 160 uint32_t width, |
| 160 uint32_t height, | 161 uint32_t height, |
| 161 bool isImageBitmapPremultiplied, | 162 bool isImageBitmapPremultiplied, |
| 162 bool isImageBitmapOriginClean); | 163 bool isImageBitmapOriginClean); |
| 163 | 164 |
| 164 RefPtr<StaticBitmapImage> m_image; | 165 RefPtr<StaticBitmapImage> m_image; |
| 165 bool m_isNeutered = false; | 166 bool m_isNeutered = false; |
| 166 }; | 167 }; |
| 167 | 168 |
| 168 } // namespace blink | 169 } // namespace blink |
| 169 | 170 |
| 170 #endif // ImageBitmap_h | 171 #endif // ImageBitmap_h |
| OLD | NEW |