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 15 matching lines...) Expand all Loading... | |
26 class CORE_EXPORT ImageBitmap final : public RefCountedWillBeGarbageCollectedFin alized<ImageBitmap>, public ScriptWrappable, public ImageLoaderClient, public Ca nvasImageSource { | 26 class CORE_EXPORT ImageBitmap final : public RefCountedWillBeGarbageCollectedFin alized<ImageBitmap>, public ScriptWrappable, public ImageLoaderClient, public Ca nvasImageSource { |
27 DEFINE_WRAPPERTYPEINFO(); | 27 DEFINE_WRAPPERTYPEINFO(); |
28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageBitmap); | 28 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageBitmap); |
29 public: | 29 public: |
30 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLImageElement*, const I ntRect&); | 30 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLImageElement*, const I ntRect&); |
31 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLVideoElement*, const I ntRect&); | 31 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLVideoElement*, const I ntRect&); |
32 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); | 32 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); |
33 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageData*, const IntRect& ); | 33 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageData*, const IntRect& ); |
34 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageBitmap*, const IntRec t&); | 34 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageBitmap*, const IntRec t&); |
35 static PassRefPtrWillBeRawPtr<ImageBitmap> create(Image*, const IntRect&); | 35 static PassRefPtrWillBeRawPtr<ImageBitmap> create(Image*, const IntRect&); |
36 static PassRefPtrWillBeRawPtr<ImageBitmap> create(PassRefPtr<SkImage>); | |
36 | 37 |
37 SkImage* skImage() const { return (m_image) ? m_image.get() : nullptr; } | 38 SkImage* skImage() const { return (m_image) ? m_image.get() : nullptr; } |
38 int width() const { return (m_image) ? m_image->width(): 0; } | 39 int width() const { return (m_image) ? m_image->width(): 0; } |
39 int height() const { return (m_image) ? m_image->height(): 0; } | 40 int height() const { return (m_image) ? m_image->height(): 0; } |
40 IntSize size() const { return (m_image) ? IntSize(m_image->width(), m_image- >height()) : IntSize(); } | 41 IntSize size() const { return (m_image) ? IntSize(m_image->width(), m_image- >height()) : IntSize(); } |
41 | 42 |
43 bool isNeutered() const { return m_isNeutered; } | |
44 PassRefPtr<SkImage> transfer(); | |
45 | |
42 ~ImageBitmap() override; | 46 ~ImageBitmap() override; |
43 | 47 |
44 // CanvasImageSource implementation | 48 // CanvasImageSource implementation |
45 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt) const override; | 49 PassRefPtr<Image> getSourceImageForCanvas(SourceImageStatus*, AccelerationHi nt) const override; |
46 bool wouldTaintOrigin(SecurityOrigin*) const override { return false; } | 50 bool wouldTaintOrigin(SecurityOrigin*) const override { return false; } |
47 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override; | 51 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override; |
48 FloatSize elementSize() const override; | 52 FloatSize elementSize() const override; |
49 | 53 |
50 DECLARE_VIRTUAL_TRACE(); | 54 DECLARE_VIRTUAL_TRACE(); |
51 | 55 |
52 private: | 56 private: |
53 ImageBitmap(HTMLImageElement*, const IntRect&); | 57 ImageBitmap(HTMLImageElement*, const IntRect&); |
54 ImageBitmap(HTMLVideoElement*, const IntRect&); | 58 ImageBitmap(HTMLVideoElement*, const IntRect&); |
55 ImageBitmap(HTMLCanvasElement*, const IntRect&); | 59 ImageBitmap(HTMLCanvasElement*, const IntRect&); |
56 ImageBitmap(ImageData*, const IntRect&); | 60 ImageBitmap(ImageData*, const IntRect&); |
57 ImageBitmap(ImageBitmap*, const IntRect&); | 61 ImageBitmap(ImageBitmap*, const IntRect&); |
58 ImageBitmap(Image*, const IntRect&); | 62 ImageBitmap(Image*, const IntRect&); |
63 ImageBitmap(PassRefPtr<SkImage>); | |
59 | 64 |
60 PassRefPtr<SkImage> cropImage(PassRefPtr<SkImage>, const IntRect&); | 65 PassRefPtr<SkImage> cropImage(PassRefPtr<SkImage>, const IntRect&); |
61 | 66 |
62 // ImageLoaderClient | 67 // ImageLoaderClient |
63 void notifyImageSourceChanged() override; | 68 void notifyImageSourceChanged() override; |
64 bool requestsHighLiveResourceCachePriority() override { return true; } | 69 bool requestsHighLiveResourceCachePriority() override { return true; } |
65 | 70 |
66 RefPtr<SkImage> m_image; | 71 RefPtr<SkImage> m_image; |
72 bool m_isNeutered; | |
sof
2015/11/16 20:56:17
nit: if you provide the initial value here (bool m
xidachen
2015/11/17 15:24:27
Done.
| |
67 }; | 73 }; |
68 | 74 |
69 } // namespace blink | 75 } // namespace blink |
70 | 76 |
71 #endif // ImageBitmap_h | 77 #endif // ImageBitmap_h |
OLD | NEW |