| 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/v8/ScriptWrappable.h" | 8 #include "bindings/v8/ScriptWrappable.h" |
| 9 #include "core/html/HTMLImageElement.h" | 9 #include "core/html/HTMLImageElement.h" |
| 10 #include "platform/geometry/IntRect.h" | 10 #include "platform/geometry/IntRect.h" |
| 11 #include "platform/graphics/Image.h" | 11 #include "platform/graphics/Image.h" |
| 12 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
| 13 #include "wtf/RefCounted.h" | 13 #include "wtf/RefCounted.h" |
| 14 | 14 |
| 15 namespace WebCore { | 15 namespace WebCore { |
| 16 | 16 |
| 17 class HTMLCanvasElement; | 17 class HTMLCanvasElement; |
| 18 class HTMLVideoElement; | 18 class HTMLVideoElement; |
| 19 class ImageData; | 19 class ImageData; |
| 20 | 20 |
| 21 class ImageBitmap : public RefCounted<ImageBitmap>, public ScriptWrappable, publ
ic ImageLoaderClient { | 21 class ImageBitmap FINAL : public RefCounted<ImageBitmap>, public ScriptWrappable
, public ImageLoaderClient { |
| 22 | 22 |
| 23 public: | 23 public: |
| 24 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&); | 24 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&); |
| 25 static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, const IntRect&); | 25 static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, const IntRect&); |
| 26 static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); | 26 static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); |
| 27 static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&); | 27 static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&); |
| 28 static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&); | 28 static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&); |
| 29 static PassRefPtr<ImageBitmap> create(Image*, const IntRect&); | 29 static PassRefPtr<ImageBitmap> create(Image*, const IntRect&); |
| 30 | 30 |
| 31 PassRefPtr<Image> bitmapImage() const; | 31 PassRefPtr<Image> bitmapImage() const; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 42 | 42 |
| 43 private: | 43 private: |
| 44 ImageBitmap(HTMLImageElement*, const IntRect&); | 44 ImageBitmap(HTMLImageElement*, const IntRect&); |
| 45 ImageBitmap(HTMLVideoElement*, const IntRect&); | 45 ImageBitmap(HTMLVideoElement*, const IntRect&); |
| 46 ImageBitmap(HTMLCanvasElement*, const IntRect&); | 46 ImageBitmap(HTMLCanvasElement*, const IntRect&); |
| 47 ImageBitmap(ImageData*, const IntRect&); | 47 ImageBitmap(ImageData*, const IntRect&); |
| 48 ImageBitmap(ImageBitmap*, const IntRect&); | 48 ImageBitmap(ImageBitmap*, const IntRect&); |
| 49 ImageBitmap(Image*, const IntRect&); | 49 ImageBitmap(Image*, const IntRect&); |
| 50 | 50 |
| 51 // ImageLoaderClient | 51 // ImageLoaderClient |
| 52 virtual void notifyImageSourceChanged(); | 52 virtual void notifyImageSourceChanged() OVERRIDE; |
| 53 virtual bool requestsHighLiveResourceCachePriority() { return true; } | 53 virtual bool requestsHighLiveResourceCachePriority() OVERRIDE { return true;
} |
| 54 | 54 |
| 55 // ImageBitmaps constructed from HTMLImageElements hold a reference to the H
TMLImageElement until | 55 // ImageBitmaps constructed from HTMLImageElements hold a reference to the H
TMLImageElement until |
| 56 // the image source changes. | 56 // the image source changes. |
| 57 RefPtr<HTMLImageElement> m_imageElement; | 57 RefPtr<HTMLImageElement> m_imageElement; |
| 58 RefPtr<Image> m_bitmap; | 58 RefPtr<Image> m_bitmap; |
| 59 | 59 |
| 60 IntRect m_bitmapRect; // The rect where the underlying Image should be place
d in reference to the ImageBitmap. | 60 IntRect m_bitmapRect; // The rect where the underlying Image should be place
d in reference to the ImageBitmap. |
| 61 IntRect m_cropRect; | 61 IntRect m_cropRect; |
| 62 | 62 |
| 63 // The offset by which the desired Image is stored internally. | 63 // The offset by which the desired Image is stored internally. |
| 64 // ImageBitmaps constructed from HTMLImageElements reference the entire Imag
eResource and may have a non-zero bitmap offset. | 64 // ImageBitmaps constructed from HTMLImageElements reference the entire Imag
eResource and may have a non-zero bitmap offset. |
| 65 // ImageBitmaps not constructed from HTMLImageElements always pre-crop and s
tore the image at (0, 0). | 65 // ImageBitmaps not constructed from HTMLImageElements always pre-crop and s
tore the image at (0, 0). |
| 66 IntPoint m_bitmapOffset; | 66 IntPoint m_bitmapOffset; |
| 67 | 67 |
| 68 }; | 68 }; |
| 69 | 69 |
| 70 } // namespace WebCore | 70 } // namespace WebCore |
| 71 | 71 |
| 72 #endif // ImageBitmap_h | 72 #endif // ImageBitmap_h |
| OLD | NEW |