Chromium Code Reviews| 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 "heap/Handle.h" | |
| 10 #include "platform/geometry/IntRect.h" | 11 #include "platform/geometry/IntRect.h" |
| 11 #include "platform/graphics/Image.h" | 12 #include "platform/graphics/Image.h" |
| 12 #include "wtf/PassRefPtr.h" | 13 #include "wtf/PassRefPtr.h" |
| 13 #include "wtf/RefCounted.h" | 14 #include "wtf/RefCounted.h" |
| 14 | 15 |
| 15 namespace WebCore { | 16 namespace WebCore { |
| 16 | 17 |
| 17 class HTMLCanvasElement; | 18 class HTMLCanvasElement; |
| 18 class HTMLVideoElement; | 19 class HTMLVideoElement; |
| 19 class ImageData; | 20 class ImageData; |
| 20 | 21 |
| 21 class ImageBitmap FINAL : public RefCounted<ImageBitmap>, public ScriptWrappable , public ImageLoaderClient { | 22 class ImageBitmap FINAL : public RefCountedWillBeGarbageCollectedFinalized<Image Bitmap>, public ScriptWrappable, public ImageLoaderClient { |
| 22 | 23 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(ImageBitmap); |
| 23 public: | 24 public: |
| 24 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&); | 25 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLImageElement*, const I ntRect&); |
| 25 static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, const IntRect&); | 26 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLVideoElement*, const I ntRect&); |
| 26 static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); | 27 static PassRefPtrWillBeRawPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); |
| 27 static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&); | 28 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageData*, const IntRect& ); |
| 28 static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&); | 29 static PassRefPtrWillBeRawPtr<ImageBitmap> create(ImageBitmap*, const IntRec t&); |
| 29 static PassRefPtr<ImageBitmap> create(Image*, const IntRect&); | 30 static PassRefPtrWillBeRawPtr<ImageBitmap> create(Image*, const IntRect&); |
| 30 | 31 |
| 31 PassRefPtr<Image> bitmapImage() const; | 32 PassRefPtr<Image> bitmapImage() const; |
| 32 PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; } | 33 PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; } |
| 33 | 34 |
| 34 IntRect bitmapRect() const { return m_bitmapRect; } | 35 IntRect bitmapRect() const { return m_bitmapRect; } |
| 35 IntPoint bitmapOffset() const { return m_bitmapOffset; } | 36 IntPoint bitmapOffset() const { return m_bitmapOffset; } |
| 36 | 37 |
| 37 int width() const { return m_cropRect.width(); } | 38 int width() const { return m_cropRect.width(); } |
| 38 int height() const { return m_cropRect.height(); } | 39 int height() const { return m_cropRect.height(); } |
| 39 IntSize size() const { return m_cropRect.size(); } | 40 IntSize size() const { return m_cropRect.size(); } |
| 40 | 41 |
| 41 virtual ~ImageBitmap(); | 42 virtual ~ImageBitmap(); |
| 42 | 43 |
| 44 void detach(); | |
|
haraken
2014/03/10 15:25:03
detach => dispose.
attach/detach is normally used
sof
2014/03/10 21:07:21
Done.
| |
| 45 | |
| 46 virtual void trace(Visitor*); | |
|
haraken
2014/03/10 15:25:03
Add OVERRIDE.
sof
2014/03/10 15:55:57
It's not overriding any other trace().
| |
| 47 | |
| 43 private: | 48 private: |
| 44 ImageBitmap(HTMLImageElement*, const IntRect&); | 49 ImageBitmap(HTMLImageElement*, const IntRect&); |
| 45 ImageBitmap(HTMLVideoElement*, const IntRect&); | 50 ImageBitmap(HTMLVideoElement*, const IntRect&); |
| 46 ImageBitmap(HTMLCanvasElement*, const IntRect&); | 51 ImageBitmap(HTMLCanvasElement*, const IntRect&); |
| 47 ImageBitmap(ImageData*, const IntRect&); | 52 ImageBitmap(ImageData*, const IntRect&); |
| 48 ImageBitmap(ImageBitmap*, const IntRect&); | 53 ImageBitmap(ImageBitmap*, const IntRect&); |
| 49 ImageBitmap(Image*, const IntRect&); | 54 ImageBitmap(Image*, const IntRect&); |
| 50 | 55 |
| 51 // ImageLoaderClient | 56 // ImageLoaderClient |
| 52 virtual void notifyImageSourceChanged() OVERRIDE; | 57 virtual void notifyImageSourceChanged() OVERRIDE; |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 63 // The offset by which the desired Image is stored internally. | 68 // 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. | 69 // 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). | 70 // ImageBitmaps not constructed from HTMLImageElements always pre-crop and s tore the image at (0, 0). |
| 66 IntPoint m_bitmapOffset; | 71 IntPoint m_bitmapOffset; |
| 67 | 72 |
| 68 }; | 73 }; |
| 69 | 74 |
| 70 } // namespace WebCore | 75 } // namespace WebCore |
| 71 | 76 |
| 72 #endif // ImageBitmap_h | 77 #endif // ImageBitmap_h |
| OLD | NEW |