| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 static PassRefPtr<SkImage> getSkImageFromDecoder(PassOwnPtr<ImageDecoder>); | 44 static PassRefPtr<SkImage> getSkImageFromDecoder(PassOwnPtr<ImageDecoder>); |
| 45 | 45 |
| 46 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() :
nullptr; } | 46 StaticBitmapImage* bitmapImage() const { return (m_image) ? m_image.get() :
nullptr; } |
| 47 PassOwnPtr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremulti
plyAlpha); | 47 PassOwnPtr<uint8_t[]> copyBitmapData(AlphaDisposition alphaOp = DontPremulti
plyAlpha); |
| 48 unsigned long width() const; | 48 unsigned long width() const; |
| 49 unsigned long height() const; | 49 unsigned long height() const; |
| 50 IntSize size() const; | 50 IntSize size() const; |
| 51 | 51 |
| 52 bool isNeutered() const { return m_isNeutered; } | 52 bool isNeutered() const { return m_isNeutered; } |
| 53 bool originClean() const { return m_image->originClean(); } | 53 bool originClean() const { return m_image->originClean(); } |
| 54 bool isPremultiplied() const { return m_isPremultiplied; } | 54 bool isPremultiplied() const { return m_image->isPremultiplied(); } |
| 55 PassRefPtr<StaticBitmapImage> transfer(); | 55 PassRefPtr<StaticBitmapImage> transfer(); |
| 56 void close(); | 56 void close(); |
| 57 | 57 |
| 58 ~ImageBitmap() override; | 58 ~ImageBitmap() override; |
| 59 | 59 |
| 60 // CanvasImageSource implementation | 60 // CanvasImageSource implementation |
| 61 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; | 61 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi
nt, SnapshotReason, const FloatSize&) const override; |
| 62 bool wouldTaintOrigin(SecurityOrigin*) const override { return !m_image->ori
ginClean(); } | 62 bool wouldTaintOrigin(SecurityOrigin*) const override { return !m_image->ori
ginClean(); } |
| 63 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override; | 63 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override; |
| 64 FloatSize elementSize(const FloatSize&) const override; | 64 FloatSize elementSize(const FloatSize&) const override; |
| 65 | 65 |
| 66 // ImageBitmapSource implementation | 66 // ImageBitmapSource implementation |
| 67 IntSize bitmapSourceSize() const override { return size(); } | 67 IntSize bitmapSourceSize() const override { return size(); } |
| 68 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy,
int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; | 68 ScriptPromise createImageBitmap(ScriptState*, EventTarget&, int sx, int sy,
int sw, int sh, const ImageBitmapOptions&, ExceptionState&) override; |
| 69 | 69 |
| 70 DECLARE_VIRTUAL_TRACE(); | 70 DECLARE_VIRTUAL_TRACE(); |
| 71 | 71 |
| 72 private: | 72 private: |
| 73 ImageBitmap(HTMLImageElement*, const IntRect&, Document*, const ImageBitmapO
ptions&); | 73 ImageBitmap(HTMLImageElement*, const IntRect&, Document*, const ImageBitmapO
ptions&); |
| 74 ImageBitmap(HTMLVideoElement*, const IntRect&, Document*, const ImageBitmapO
ptions&); | 74 ImageBitmap(HTMLVideoElement*, const IntRect&, Document*, const ImageBitmapO
ptions&); |
| 75 ImageBitmap(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions&); | 75 ImageBitmap(HTMLCanvasElement*, const IntRect&, const ImageBitmapOptions&); |
| 76 ImageBitmap(ImageData*, const IntRect&, const ImageBitmapOptions&); | 76 ImageBitmap(ImageData*, const IntRect&, const ImageBitmapOptions&); |
| 77 ImageBitmap(ImageBitmap*, const IntRect&, const ImageBitmapOptions&); | 77 ImageBitmap(ImageBitmap*, const IntRect&, const ImageBitmapOptions&); |
| 78 ImageBitmap(PassRefPtr<StaticBitmapImage>); | 78 ImageBitmap(PassRefPtr<StaticBitmapImage>); |
| 79 ImageBitmap(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmap
Options&); | 79 ImageBitmap(PassRefPtr<StaticBitmapImage>, const IntRect&, const ImageBitmap
Options&); |
| 80 | 80 |
| 81 void parseOptions(const ImageBitmapOptions&, bool&); | 81 void parseOptions(const ImageBitmapOptions&, bool&, bool&); |
| 82 | 82 |
| 83 RefPtr<StaticBitmapImage> m_image; | 83 RefPtr<StaticBitmapImage> m_image; |
| 84 bool m_isNeutered = false; | 84 bool m_isNeutered = false; |
| 85 bool m_isPremultiplied = true; | |
| 86 }; | 85 }; |
| 87 | 86 |
| 88 } // namespace blink | 87 } // namespace blink |
| 89 | 88 |
| 90 #endif // ImageBitmap_h | 89 #endif // ImageBitmap_h |
| OLD | NEW |