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/dom/ScriptExecutionContext.h" | |
| 10 #include "core/platform/graphics/BitmapImage.h" | 9 #include "core/platform/graphics/BitmapImage.h" |
| 11 #include "core/platform/graphics/ImageBuffer.h" | 10 #include "core/platform/graphics/ImageBuffer.h" |
| 12 #include "core/platform/graphics/IntRect.h" | 11 #include "core/platform/graphics/IntRect.h" |
| 13 #include "wtf/PassRefPtr.h" | 12 #include "wtf/PassRefPtr.h" |
| 14 #include "wtf/RefCounted.h" | 13 #include "wtf/RefCounted.h" |
| 15 | 14 |
| 16 namespace WebCore { | 15 namespace WebCore { |
| 17 | 16 |
| 18 class HTMLCanvasElement; | 17 class HTMLCanvasElement; |
| 19 class HTMLImageElement; | 18 class HTMLImageElement; |
| 20 class HTMLVideoElement; | 19 class HTMLVideoElement; |
| 21 class ImageData; | 20 class ImageData; |
| 22 class ImageBitmapCallback; | |
| 23 | 21 |
| 24 class ImageBitmap : public RefCounted<ImageBitmap>, public ScriptWrappable { | 22 class ImageBitmap : public RefCounted<ImageBitmap>, public ScriptWrappable { |
| 25 | 23 |
| 26 public: | 24 public: |
| 27 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, IntRect); | 25 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&); |
| 28 static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, IntRect); | 26 static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, const IntRect&); |
| 29 static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, IntRect); | 27 static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); |
| 30 static PassRefPtr<ImageBitmap> create(ImageData*, IntRect); | 28 static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&); |
| 31 static PassRefPtr<ImageBitmap> create(ImageBitmap*, IntRect); | 29 static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&); |
| 32 | 30 |
| 33 BitmapImage* bitmapImage() const { return m_bitmap.get(); } | 31 PassRefPtr<Image> bitmapImage(); |
| 34 | 32 |
| 35 int bitmapWidth() const { return m_bitmap->width(); } | 33 int bitmapWidth() const { return m_bitmapSize.width(); } |
| 36 int bitmapHeight() const { return m_bitmap->height(); } | 34 int bitmapHeight() const { return m_bitmapSize.height(); } |
| 37 IntSize bitmapSize() const { return m_bitmap->size(); } | 35 IntSize bitmapSize() const { return m_bitmapSize; } |
| 36 | |
| 38 IntPoint bitmapOffset() const { return m_bitmapOffset; } | 37 IntPoint bitmapOffset() const { return m_bitmapOffset; } |
| 39 | 38 |
| 40 int width() const { return m_size.width(); } | 39 int width() const { return m_cropRect.width(); } |
| 41 int height() const { return m_size.height(); } | 40 int height() const { return m_cropRect.height(); } |
| 42 IntSize size() const { return m_size; } | 41 IntSize size() const { return m_cropRect.size(); } |
| 43 | 42 |
| 44 ~ImageBitmap() { }; | 43 ~ImageBitmap() { }; |
| 45 | 44 |
| 46 private: | 45 private: |
| 47 ImageBitmap(HTMLImageElement*, IntRect); | 46 ImageBitmap(HTMLImageElement*, const IntRect&); |
| 48 ImageBitmap(HTMLVideoElement*, IntRect); | 47 ImageBitmap(HTMLVideoElement*, const IntRect&); |
| 49 ImageBitmap(HTMLCanvasElement*, IntRect); | 48 ImageBitmap(HTMLCanvasElement*, const IntRect&); |
| 50 ImageBitmap(ImageData*, IntRect); | 49 ImageBitmap(ImageData*, const IntRect&); |
| 51 ImageBitmap(ImageBitmap*, IntRect); | 50 ImageBitmap(ImageBitmap*, const IntRect&); |
| 52 | 51 |
| 53 RefPtr<BitmapImage> m_bitmap; | 52 RefPtr<Image> m_bitmap; |
|
Justin Novosad
2013/07/16 23:05:53
Need a comment to explain that m_bitmap is not use
| |
| 54 OwnPtr<ImageBuffer> m_buffer; | 53 OwnPtr<ImageBuffer> m_buffer; |
| 54 HTMLImageElement* m_imageElement; | |
| 55 | 55 |
| 56 IntPoint m_bitmapOffset; // offset applied to the image when it is drawn to the context | 56 IntPoint m_bitmapOffset; // offset applied to the image when it is drawn to the context |
| 57 IntSize m_size; // user defined size of the ImageBitmap | 57 IntSize m_bitmapSize; // actual size of the BitmapImage |
| 58 IntRect m_cropRect; | |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 } // namespace WebCore | 61 } // namespace WebCore |
| 61 | 62 |
| 62 #endif // ImageBitmap_h | 63 #endif // ImageBitmap_h |
| OLD | NEW |