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

Unified Diff: Source/platform/graphics/StaticBitmapImage.h

Issue 358893002: Use newImageSnapshot() to get an image from a Canvas (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created ImagePattern and StaticBitmapImage Created 6 years, 6 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/platform/graphics/StaticBitmapImage.h
diff --git a/Source/platform/graphics/ImageObserver.h b/Source/platform/graphics/StaticBitmapImage.h
similarity index 63%
copy from Source/platform/graphics/ImageObserver.h
copy to Source/platform/graphics/StaticBitmapImage.h
index a01e0b641f0e05c253c062aaa252f79b1bf00dfb..e8daa16bf07ea07b8a7161da9c58a012c30a5789 100644
--- a/Source/platform/graphics/ImageObserver.h
+++ b/Source/platform/graphics/StaticBitmapImage.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc. All rights reserved.
+ * Copyright (C) 2008 Apple Computer, Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,29 +23,31 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef ImageObserver_h
-#define ImageObserver_h
+#ifndef StaticBitmapImage_h
+#define StaticBitmapImage_h
-#include "platform/PlatformExport.h"
+#include "SkImage.h"
-namespace WebCore {
+#include "platform/graphics/Image.h"
-class Image;
-class IntRect;
+namespace WebCore {
-// Interface for notification about changes to an image, including decoding,
-// drawing, and animating.
-class PLATFORM_EXPORT ImageObserver {
-protected:
- virtual ~ImageObserver();
+class PLATFORM_EXPORT StaticBitmapImage : public Image {
public:
- virtual void decodedSizeChanged(const Image*, int delta) = 0;
- virtual void didDraw(const Image*) = 0;
- virtual bool shouldPauseAnimation(const Image*) = 0;
- virtual void animationAdvanced(const Image*) = 0;
+ static PassRefPtr<Image> create(PassRefPtr<SkImage>);
+ virtual void destroyDecodedData(bool destroyAll) { }
+ virtual bool currentFrameKnownToBeOpaque() { return false; }
+ virtual IntSize size() const { return IntSize(m_image->height(), m_image->width()); }
+ virtual void draw(GraphicsContext*, const FloatRect& dstRect, const FloatRect& srcRect, CompositeOperator, blink::WebBlendMode);
+
+
+ PassRefPtr<SkImage> image() OVERRIDE { return m_image; }
+
+protected:
+ StaticBitmapImage(PassRefPtr<SkImage>);
- virtual void changedInRect(const Image*, const IntRect&) = 0;
+ RefPtr<SkImage> m_image;
};
}

Powered by Google App Engine
This is Rietveld 408576698