Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(638)

Unified Diff: Source/core/frame/ImageBitmap.h

Issue 181693006: Refactoring source image usage in CanvasRenderingContext2D (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/ImageBitmap.h
diff --git a/Source/core/frame/ImageBitmap.h b/Source/core/frame/ImageBitmap.h
index 7f62bdaee9948f3105ad84c6f1f62e3ebe3ed015..6b5abfcec7d8899618dd62f016ad7a213ddeabda 100644
--- a/Source/core/frame/ImageBitmap.h
+++ b/Source/core/frame/ImageBitmap.h
@@ -7,6 +7,7 @@
#include "bindings/v8/ScriptWrappable.h"
#include "core/html/HTMLImageElement.h"
+#include "core/html/canvas/CanvasImageSource.h"
#include "platform/geometry/IntRect.h"
#include "platform/graphics/Image.h"
#include "wtf/PassRefPtr.h"
@@ -18,7 +19,7 @@ class HTMLCanvasElement;
class HTMLVideoElement;
class ImageData;
-class ImageBitmap FINAL : public RefCounted<ImageBitmap>, public ScriptWrappable, public ImageLoaderClient {
+class ImageBitmap FINAL : public RefCounted<ImageBitmap>, public ScriptWrappable, public ImageLoaderClient, public CanvasImageSource {
public:
static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&);
@@ -32,7 +33,7 @@ public:
PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; }
IntRect bitmapRect() const { return m_bitmapRect; }
- IntPoint bitmapOffset() const { return m_bitmapOffset; }
+ virtual IntPoint bitmapOffset() const { return m_bitmapOffset; }
int width() const { return m_cropRect.width(); }
int height() const { return m_cropRect.height(); }
@@ -40,6 +41,12 @@ public:
virtual ~ImageBitmap();
+ // CanvasImageSource implementation
+ virtual PassRefPtr<Image> getSourceImageForCanvas(HTMLCanvasElement*, ExceptionState&, CanvasImageSourceUsage, bool* isVolatile) const OVERRIDE;
+ virtual bool wouldTaintOrigin(CanvasRenderingContext*) const OVERRIDE { return false; };
+ virtual void adjustDrawRects(FloatRect* srcRect, FloatRect* dstRect) const OVERRIDE;
+ virtual FloatSize sourceSize() const OVERRIDE;
+
private:
ImageBitmap(HTMLImageElement*, const IntRect&);
ImageBitmap(HTMLVideoElement*, const IntRect&);

Powered by Google App Engine
This is Rietveld 408576698