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" |
(...skipping 24 matching lines...) Expand all Loading... |
35 public: | 35 public: |
36 static ImageBitmap* create(HTMLImageElement*, const IntRect&, Document*, con
st ImageBitmapOptions& = ImageBitmapOptions()); | 36 static ImageBitmap* create(HTMLImageElement*, const IntRect&, Document*, con
st ImageBitmapOptions& = ImageBitmapOptions()); |
37 static ImageBitmap* create(HTMLVideoElement*, const IntRect&, Document*, con
st ImageBitmapOptions& = ImageBitmapOptions()); | 37 static ImageBitmap* create(HTMLVideoElement*, const IntRect&, Document*, con
st ImageBitmapOptions& = ImageBitmapOptions()); |
38 static ImageBitmap* create(HTMLCanvasElement*, const IntRect&, const ImageBi
tmapOptions& = ImageBitmapOptions()); | 38 static ImageBitmap* create(HTMLCanvasElement*, const IntRect&, const ImageBi
tmapOptions& = ImageBitmapOptions()); |
39 static ImageBitmap* create(ImageData*, const IntRect&, const ImageBitmapOpti
ons& = ImageBitmapOptions(), const bool& isImageDataPremultiplied = false); | 39 static ImageBitmap* create(ImageData*, const IntRect&, const ImageBitmapOpti
ons& = ImageBitmapOptions(), const bool& isImageDataPremultiplied = false); |
40 static ImageBitmap* create(ImageBitmap*, const IntRect&, const ImageBitmapOp
tions& = ImageBitmapOptions()); | 40 static ImageBitmap* create(ImageBitmap*, const IntRect&, const ImageBitmapOp
tions& = ImageBitmapOptions()); |
41 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); | 41 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); |
42 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, const IntRect&, co
nst ImageBitmapOptions& = ImageBitmapOptions()); | 42 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, const IntRect&, co
nst ImageBitmapOptions& = ImageBitmapOptions()); |
43 static PassRefPtr<SkImage> getSkImageFromDecoder(PassOwnPtr<ImageDecoder>); | 43 static PassRefPtr<SkImage> getSkImageFromDecoder(PassOwnPtr<ImageDecoder>); |
44 | 44 |
| 45 // Type and helper function required by CallbackPromiseAdapter: |
| 46 using WebType = sk_sp<SkImage>; |
| 47 static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>); |
| 48 |
45 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() :
nullptr; } | 49 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() :
nullptr; } |
46 PassOwnPtr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremulti
plyAlpha); | 50 PassOwnPtr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremulti
plyAlpha); |
47 unsigned long width() const; | 51 unsigned long width() const; |
48 unsigned long height() const; | 52 unsigned long height() const; |
49 IntSize size() const; | 53 IntSize size() const; |
50 | 54 |
51 bool isNeutered() const { return m_isNeutered; } | 55 bool isNeutered() const { return m_isNeutered; } |
52 bool originClean() const { return m_image->originClean(); } | 56 bool originClean() const { return m_image->originClean(); } |
53 bool isPremultiplied() const { return m_image->isPremultiplied(); } | 57 bool isPremultiplied() const { return m_image->isPremultiplied(); } |
54 PassRefPtr<StaticBitmapImage> transfer(); | 58 PassRefPtr<StaticBitmapImage> transfer(); |
(...skipping 25 matching lines...) Expand all Loading... |
80 | 84 |
81 void parseOptions(const ImageBitmapOptions&, bool&, bool&); | 85 void parseOptions(const ImageBitmapOptions&, bool&, bool&); |
82 | 86 |
83 RefPtr<StaticBitmapImage> m_image; | 87 RefPtr<StaticBitmapImage> m_image; |
84 bool m_isNeutered = false; | 88 bool m_isNeutered = false; |
85 }; | 89 }; |
86 | 90 |
87 } // namespace blink | 91 } // namespace blink |
88 | 92 |
89 #endif // ImageBitmap_h | 93 #endif // ImageBitmap_h |
OLD | NEW |