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

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

Issue 20748002: Blob creation methods for ImageBitmap. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 5 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/page/ImageBitmap.h
diff --git a/Source/core/page/ImageBitmap.h b/Source/core/page/ImageBitmap.h
index 8b8c01c740152758474622c112de18a4dcdc193b..34d5801e80c922d668176eb0d492290e152690d5 100644
--- a/Source/core/page/ImageBitmap.h
+++ b/Source/core/page/ImageBitmap.h
@@ -6,7 +6,13 @@
#define ImageBitmap_h
#include "bindings/v8/ScriptWrappable.h"
-#include "core/dom/ScriptExecutionContext.h"
+#include "core/fileapi/FileReaderLoader.h"
+#include "core/fileapi/FileReaderLoaderClient.h"
+#include "core/loader/cache/CachedImage.h"
+#include "core/loader/cache/CachedImageClient.h"
+#include "core/loader/cache/CachedResourceHandle.h"
+#include "core/page/DOMWindow.h"
+#include "core/page/ImageBitmapCallback.h"
#include "core/platform/graphics/BitmapImage.h"
#include "core/platform/graphics/ImageBuffer.h"
#include "core/platform/graphics/IntRect.h"
@@ -15,46 +21,63 @@
namespace WebCore {
+class Blob;
+class FileError;
class HTMLCanvasElement;
class HTMLImageElement;
class HTMLVideoElement;
class ImageData;
class ImageBitmapCallback;
-class ImageBitmap : public RefCounted<ImageBitmap>, public ScriptWrappable {
+class ImageBitmap : public RefCounted<ImageBitmap>, public FileReaderLoaderClient, public CachedImageClient, public ScriptWrappable {
public:
static PassRefPtr<ImageBitmap> create(HTMLImageElement*, IntRect);
static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, IntRect);
static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, IntRect);
static PassRefPtr<ImageBitmap> create(ImageData*, IntRect);
+ static PassRefPtr<ImageBitmap> create(DOMWindow*, PassRefPtr<ImageBitmapCallback>, Blob*, IntRect);
static PassRefPtr<ImageBitmap> create(ImageBitmap*, IntRect);
- BitmapImage* bitmapImage() const { return m_bitmap.get(); }
+ ~ImageBitmap();
+
+ Image* bitmapImage() const { return m_bitmap.get(); }
int bitmapWidth() const { return m_bitmap->width(); }
int bitmapHeight() const { return m_bitmap->height(); }
IntSize bitmapSize() const { return m_bitmap->size(); }
IntPoint bitmapOffset() const { return m_bitmapOffset; }
- int width() const { return m_size.width(); }
- int height() const { return m_size.height(); }
- IntSize size() const { return m_size; }
+ int width() const { return m_cropRect.width(); }
+ int height() const { return m_cropRect.height(); }
+ IntSize size() const { return m_cropRect.size(); }
- ~ImageBitmap() { };
private:
ImageBitmap(HTMLImageElement*, IntRect);
ImageBitmap(HTMLVideoElement*, IntRect);
ImageBitmap(HTMLCanvasElement*, IntRect);
+ ImageBitmap(DOMWindow*, PassRefPtr<ImageBitmapCallback>, Blob*, IntRect);
ImageBitmap(ImageData*, IntRect);
ImageBitmap(ImageBitmap*, IntRect);
- RefPtr<BitmapImage> m_bitmap;
- OwnPtr<ImageBuffer> m_buffer;
+ // FileReaderLoaderClient
+ virtual void didStartLoading() { }
+ virtual void didReceiveData() { }
+ virtual void didFinishLoading();
+ virtual void didFail(FileError::ErrorCode);
+ // CachedImageClient
+ virtual void notifyFinished(CachedResource*);
+
+ CachedResourceHandle<CachedImage> m_pendingCachedImage;
+ RefPtr<Image> m_bitmap;
+ OwnPtr<ImageBuffer> m_buffer;
+ OwnPtr<FileReaderLoader> m_loader;
+ RefPtr<ImageBitmapCallback> m_callback;
+ DOMWindow* m_window;
IntPoint m_bitmapOffset; // offset applied to the image when it is drawn to the context
- IntSize m_size; // user defined size of the ImageBitmap
+ IntRect m_cropRect;
};
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698