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

Side by Side Diff: Source/core/page/ImageBitmap.h

Issue 22613002: Allow ImageBitmaps derived from HTMLImageElements to be evicted from RAM. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Make destructor virtual. Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | Source/core/page/ImageBitmap.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "core/platform/graphics/Image.h" 10 #include "core/platform/graphics/Image.h"
(...skipping 14 matching lines...) Expand all
25 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&); 25 static PassRefPtr<ImageBitmap> create(HTMLImageElement*, const IntRect&);
26 static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, const IntRect&); 26 static PassRefPtr<ImageBitmap> create(HTMLVideoElement*, const IntRect&);
27 static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&); 27 static PassRefPtr<ImageBitmap> create(HTMLCanvasElement*, const IntRect&);
28 static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&); 28 static PassRefPtr<ImageBitmap> create(ImageData*, const IntRect&);
29 static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&); 29 static PassRefPtr<ImageBitmap> create(ImageBitmap*, const IntRect&);
30 30
31 PassRefPtr<Image> bitmapImage() const; 31 PassRefPtr<Image> bitmapImage() const;
32 PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; } 32 PassRefPtr<HTMLImageElement> imageElement() const { return m_imageElement; }
33 33
34 IntRect bitmapRect() const { return m_bitmapRect; } 34 IntRect bitmapRect() const { return m_bitmapRect; }
35 IntPoint bitmapOffset() const { return m_bitmapOffset; }
35 36
36 int width() const { return m_cropRect.width(); } 37 int width() const { return m_cropRect.width(); }
37 int height() const { return m_cropRect.height(); } 38 int height() const { return m_cropRect.height(); }
38 IntSize size() const { return m_cropRect.size(); } 39 IntSize size() const { return m_cropRect.size(); }
39 40
40 ~ImageBitmap(); 41 virtual ~ImageBitmap();
41 42
42 private: 43 private:
43 ImageBitmap(HTMLImageElement*, const IntRect&); 44 ImageBitmap(HTMLImageElement*, const IntRect&);
44 ImageBitmap(HTMLVideoElement*, const IntRect&); 45 ImageBitmap(HTMLVideoElement*, const IntRect&);
45 ImageBitmap(HTMLCanvasElement*, const IntRect&); 46 ImageBitmap(HTMLCanvasElement*, const IntRect&);
46 ImageBitmap(ImageData*, const IntRect&); 47 ImageBitmap(ImageData*, const IntRect&);
47 ImageBitmap(ImageBitmap*, const IntRect&); 48 ImageBitmap(ImageBitmap*, const IntRect&);
48 49
49 // ImageLoaderClient 50 // ImageLoaderClient
50 virtual void notifyImageSourceChanged(); 51 virtual void notifyImageSourceChanged();
51 virtual bool requestsHighLiveResourceCachePriority() { return true; } 52 virtual bool requestsHighLiveResourceCachePriority() { return true; }
52 53
53 // ImageBitmaps constructed from HTMLImageElements hold a reference to the H TMLImageElement until 54 // ImageBitmaps constructed from HTMLImageElements hold a reference to the H TMLImageElement until
54 // the image source changes. 55 // the image source changes.
55 RefPtr<HTMLImageElement> m_imageElement; 56 RefPtr<HTMLImageElement> m_imageElement;
56 RefPtr<Image> m_bitmap; 57 RefPtr<Image> m_bitmap;
57 OwnPtr<ImageBuffer> m_buffer; 58 OwnPtr<ImageBuffer> m_buffer;
58 59
59 IntRect m_bitmapRect; // The rect where the underlying Image should be place d in reference to the ImageBitmap. 60 IntRect m_bitmapRect; // The rect where the underlying Image should be place d in reference to the ImageBitmap.
60 IntRect m_cropRect; 61 IntRect m_cropRect;
62
63 // The offset by which the desired Image is stored internally.
64 // ImageBitmaps constructed from HTMLImageElements reference the entire Cach edImage 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).
66 IntPoint m_bitmapOffset;
67
61 }; 68 };
62 69
63 } // namespace WebCore 70 } // namespace WebCore
64 71
65 #endif // ImageBitmap_h 72 #endif // ImageBitmap_h
OLDNEW
« no previous file with comments | « Source/core/html/canvas/CanvasRenderingContext2D.cpp ('k') | Source/core/page/ImageBitmap.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698