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 "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 19 matching lines...) Expand all Loading... | |
| 30 PremultiplyAlpha, | 30 PremultiplyAlpha, |
| 31 DontPremultiplyAlpha, | 31 DontPremultiplyAlpha, |
| 32 }; | 32 }; |
| 33 | 33 |
| 34 class CORE_EXPORT ImageBitmap final : public GarbageCollectedFinalized<ImageBitm ap>, public ScriptWrappable, public CanvasImageSource, public ImageBitmapSource { | 34 class CORE_EXPORT ImageBitmap final : public GarbageCollectedFinalized<ImageBitm ap>, public ScriptWrappable, public CanvasImageSource, public ImageBitmapSource { |
| 35 DEFINE_WRAPPERTYPEINFO(); | 35 DEFINE_WRAPPERTYPEINFO(); |
| 36 public: | 36 public: |
| 37 static ImageBitmap* create(HTMLImageElement*, const IntRect&, Document*, con st ImageBitmapOptions& = ImageBitmapOptions()); | 37 static ImageBitmap* create(HTMLImageElement*, const IntRect&, Document*, con st ImageBitmapOptions& = ImageBitmapOptions()); |
| 38 static ImageBitmap* create(HTMLVideoElement*, const IntRect&, Document*, con st ImageBitmapOptions& = ImageBitmapOptions()); | 38 static ImageBitmap* create(HTMLVideoElement*, const IntRect&, Document*, con st ImageBitmapOptions& = ImageBitmapOptions()); |
| 39 static ImageBitmap* create(HTMLCanvasElement*, const IntRect&, const ImageBi tmapOptions& = ImageBitmapOptions()); | 39 static ImageBitmap* create(HTMLCanvasElement*, const IntRect&, const ImageBi tmapOptions& = ImageBitmapOptions()); |
| 40 static ImageBitmap* create(ImageData*, const IntRect&, const ImageBitmapOpti ons& = ImageBitmapOptions(), const bool& isImageDataPremultiplied = false, const bool& isImageDataOriginClean = true); | 40 static ImageBitmap* create(ImageData*, const IntRect&, const ImageBitmapOpti ons& = ImageBitmapOptions()); |
| 41 static ImageBitmap* create(ImageBitmap*, const IntRect&, const ImageBitmapOp tions& = ImageBitmapOptions()); | 41 static ImageBitmap* create(ImageBitmap*, const IntRect&, const ImageBitmapOp tions& = ImageBitmapOptions()); |
| 42 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); | 42 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>); |
| 43 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, const IntRect&, co nst ImageBitmapOptions& = ImageBitmapOptions()); | 43 static ImageBitmap* create(PassRefPtr<StaticBitmapImage>, const IntRect&, co nst ImageBitmapOptions& = ImageBitmapOptions()); |
| 44 static ImageBitmap* create(WebExternalTextureMailbox&); | 44 static ImageBitmap* create(WebExternalTextureMailbox&); |
| 45 static ImageBitmap* create(std::unique_ptr<uint8_t[]>, uint32_t, uint32_t, b ool, bool); | |
|
jbroman
2016/06/28 18:50:22
Please name these parameters, here and below. "uin
xidachen
2016/06/29 12:58:35
Done.
| |
| 45 static PassRefPtr<SkImage> getSkImageFromDecoder(std::unique_ptr<ImageDecode r>); | 46 static PassRefPtr<SkImage> getSkImageFromDecoder(std::unique_ptr<ImageDecode r>); |
| 46 | 47 |
| 47 // Type and helper function required by CallbackPromiseAdapter: | 48 // Type and helper function required by CallbackPromiseAdapter: |
| 48 using WebType = sk_sp<SkImage>; | 49 using WebType = sk_sp<SkImage>; |
| 49 static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>); | 50 static ImageBitmap* take(ScriptPromiseResolver*, sk_sp<SkImage>); |
| 50 | 51 |
| 51 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; } | 52 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() : nullptr; } |
| 52 std::unique_ptr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPre multiplyAlpha); | 53 std::unique_ptr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPre multiplyAlpha); |
| 53 unsigned long width() const; | 54 unsigned long width() const; |
| 54 unsigned long height() const; | 55 unsigned long height() const; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 75 // ImageBitmapSource implementation | 76 // ImageBitmapSource implementation |
| 76 IntSize bitmapSourceSize() const override { return size(); } | 77 IntSize bitmapSourceSize() const override { return size(); } |
| 77 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; | 78 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy, int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; |
| 78 | 79 |
| 79 DECLARE_VIRTUAL_TRACE(); | 80 DECLARE_VIRTUAL_TRACE(); |
| 80 | 81 |
| 81 private: | 82 private: |
| 82 ImageBitmap(HTMLImageElement*, const IntRect&, Document*, const ImageBitmapO ptions&); | 83 ImageBitmap(HTMLImageElement*, const IntRect&, Document*, const ImageBitmapO ptions&); |
| 83 ImageBitmap(HTMLVideoElement*, const IntRect&, Document*, const ImageBitmapO ptions&); | 84 ImageBitmap(HTMLVideoElement*, const IntRect&, Document*, const ImageBitmapO ptions&); |
| 84 ImageBitmap(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions&); | 85 ImageBitmap(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions&); |
| 85 ImageBitmap(ImageData*, const IntRect&, const ImageBitmapOptions&, const boo l&, const bool&); | 86 ImageBitmap(ImageData*, const IntRect&, const ImageBitmapOptions&); |
| 86 ImageBitmap(ImageBitmap*, const IntRect&, const ImageBitmapOptions&); | 87 ImageBitmap(ImageBitmap*, const IntRect&, const ImageBitmapOptions&); |
| 87 ImageBitmap(PassRefPtr<StaticBitmapImage>); | 88 ImageBitmap(PassRefPtr<StaticBitmapImage>); |
| 88 ImageBitmap(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmap Options&); | 89 ImageBitmap(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmap Options&); |
| 89 ImageBitmap(WebExternalTextureMailbox&); | 90 ImageBitmap(WebExternalTextureMailbox&); |
| 91 ImageBitmap(std::unique_ptr<uint8_t[]>, uint32_t, uint32_t, bool, bool); | |
| 90 | 92 |
| 91 void parseOptions(const ImageBitmapOptions&, bool&, bool&); | 93 void parseOptions(const ImageBitmapOptions&, bool&, bool&); |
| 92 | 94 |
| 93 RefPtr<StaticBitmapImage> m_image; | 95 RefPtr<StaticBitmapImage> m_image; |
| 94 bool m_isNeutered = false; | 96 bool m_isNeutered = false; |
| 95 }; | 97 }; |
| 96 | 98 |
| 97 } // namespace blink | 99 } // namespace blink |
| 98 | 100 |
| 99 #endif // ImageBitmap_h | 101 #endif // ImageBitmap_h |
| OLD | NEW |