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 23 matching lines...) Expand all Loading... |
34 | 34 |
35 PassRefPtr<Image> bitmapImage() const; | 35 PassRefPtr<Image> bitmapImage() const; |
36 PassRefPtrWillBeRawPtr<HTMLImageElement> imageElement() const { return m_ima
geElement; } | 36 PassRefPtrWillBeRawPtr<HTMLImageElement> imageElement() const { return m_ima
geElement; } |
37 | 37 |
38 IntRect bitmapRect() const { return m_bitmapRect; } | 38 IntRect bitmapRect() const { return m_bitmapRect; } |
39 | 39 |
40 int width() const { return m_cropRect.width(); } | 40 int width() const { return m_cropRect.width(); } |
41 int height() const { return m_cropRect.height(); } | 41 int height() const { return m_cropRect.height(); } |
42 IntSize size() const { return m_cropRect.size(); } | 42 IntSize size() const { return m_cropRect.size(); } |
43 | 43 |
44 virtual ~ImageBitmap(); | 44 ~ImageBitmap() override; |
45 | 45 |
46 // CanvasImageSource implementation | 46 // CanvasImageSource implementation |
47 virtual PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceIma
geStatus*) const override; | 47 PassRefPtr<Image> getSourceImageForCanvas(SourceImageMode, SourceImageStatus
*) const override; |
48 virtual bool wouldTaintOrigin(SecurityOrigin*) const override { return false
; } | 48 bool wouldTaintOrigin(SecurityOrigin*) const override { return false; } |
49 virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const o
verride; | 49 void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const override; |
50 virtual FloatSize elementSize() const override; | 50 FloatSize elementSize() const override; |
51 | 51 |
52 DECLARE_VIRTUAL_TRACE(); | 52 DECLARE_VIRTUAL_TRACE(); |
53 | 53 |
54 private: | 54 private: |
55 ImageBitmap(HTMLImageElement*, const IntRect&); | 55 ImageBitmap(HTMLImageElement*, const IntRect&); |
56 ImageBitmap(HTMLVideoElement*, const IntRect&); | 56 ImageBitmap(HTMLVideoElement*, const IntRect&); |
57 ImageBitmap(HTMLCanvasElement*, const IntRect&); | 57 ImageBitmap(HTMLCanvasElement*, const IntRect&); |
58 ImageBitmap(ImageData*, const IntRect&); | 58 ImageBitmap(ImageData*, const IntRect&); |
59 ImageBitmap(ImageBitmap*, const IntRect&); | 59 ImageBitmap(ImageBitmap*, const IntRect&); |
60 ImageBitmap(Image*, const IntRect&); | 60 ImageBitmap(Image*, const IntRect&); |
61 | 61 |
62 // ImageLoaderClient | 62 // ImageLoaderClient |
63 virtual void notifyImageSourceChanged() override; | 63 void notifyImageSourceChanged() override; |
64 virtual bool requestsHighLiveResourceCachePriority() override { return true;
} | 64 bool requestsHighLiveResourceCachePriority() override { return true; } |
65 | 65 |
66 // ImageBitmaps constructed from HTMLImageElements hold a reference to the H
TMLImageElement until | 66 // ImageBitmaps constructed from HTMLImageElements hold a reference to the H
TMLImageElement until |
67 // the image source changes. | 67 // the image source changes. |
68 RefPtrWillBeMember<HTMLImageElement> m_imageElement; | 68 RefPtrWillBeMember<HTMLImageElement> m_imageElement; |
69 RefPtr<Image> m_bitmap; | 69 RefPtr<Image> m_bitmap; |
70 | 70 |
71 IntRect m_bitmapRect; // The rect where the underlying Image should be place
d in reference to the ImageBitmap. | 71 IntRect m_bitmapRect; // The rect where the underlying Image should be place
d in reference to the ImageBitmap. |
72 IntRect m_cropRect; | 72 IntRect m_cropRect; |
73 | 73 |
74 // The offset by which the desired Image is stored internally. | 74 // The offset by which the desired Image is stored internally. |
75 // ImageBitmaps constructed from HTMLImageElements reference the entire Imag
eResource and may have a non-zero bitmap offset. | 75 // ImageBitmaps constructed from HTMLImageElements reference the entire Imag
eResource and may have a non-zero bitmap offset. |
76 // ImageBitmaps not constructed from HTMLImageElements always pre-crop and s
tore the image at (0, 0). | 76 // ImageBitmaps not constructed from HTMLImageElements always pre-crop and s
tore the image at (0, 0). |
77 IntPoint m_bitmapOffset; | 77 IntPoint m_bitmapOffset; |
78 | 78 |
79 }; | 79 }; |
80 | 80 |
81 } // namespace blink | 81 } // namespace blink |
82 | 82 |
83 #endif // ImageBitmap_h | 83 #endif // ImageBitmap_h |
OLD | NEW |