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