Index: cc/resources/picture.h |
diff --git a/cc/resources/picture.h b/cc/resources/picture.h |
index 8598fbf62b3c0a7ce983c9acd10737ef19e71d4a..a79a664f3f06aad7123d9afc3b39c6dbfb42982d 100644 |
--- a/cc/resources/picture.h |
+++ b/cc/resources/picture.h |
@@ -6,11 +6,14 @@ |
#define CC_RESOURCES_PICTURE_H_ |
#include <list> |
+#include <utility> |
#include <vector> |
#include "base/basictypes.h" |
+#include "base/hash_tables.h" |
#include "base/memory/ref_counted.h" |
#include "cc/base/cc_export.h" |
+#include "cc/base/hash_pair.h" |
#include "skia/ext/lazy_pixel_ref.h" |
#include "skia/ext/refptr.h" |
#include "third_party/skia/include/core/SkPixelRef.h" |
@@ -29,6 +32,10 @@ struct RenderingStats; |
class CC_EXPORT Picture |
: public base::RefCountedThreadSafe<Picture> { |
public: |
+ typedef base::hash_map< |
+ std::pair<int, int>, |
+ std::list<skia::LazyPixelRef*> > PixelRefsMap; |
+ |
static scoped_refptr<Picture> Create(gfx::Rect layer_rect); |
const gfx::Rect& LayerRect() const { return layer_rect_; } |
@@ -55,9 +62,27 @@ class CC_EXPORT Picture |
float contents_scale, |
bool enable_lcd_text); |
- void GatherPixelRefs( |
- const gfx::Rect& layer_rect, |
- std::list<skia::LazyPixelRef*>& pixel_ref_list); |
+ class CC_EXPORT LazyPixelRefsIterator { |
+ public: |
+ LazyPixelRefsIterator(); |
+ LazyPixelRefsIterator(gfx::Rect layer_rect, const Picture* picture); |
+ ~LazyPixelRefsIterator(); |
+ |
+ skia::LazyPixelRef* operator->() const { return current_pixel_ref_; } |
+ skia::LazyPixelRef* operator*() const { return current_pixel_ref_; } |
+ LazyPixelRefsIterator& operator++(); |
+ operator bool() const { return !!current_pixel_ref_; } |
+ |
+ private: |
+ const Picture* picture_; |
+ std::list<skia::LazyPixelRef*> current_list_; |
+ skia::LazyPixelRef* current_pixel_ref_; |
+ |
+ gfx::Point min_point_; |
+ gfx::Point max_point_; |
+ int current_x_; |
+ int current_y_; |
+ }; |
private: |
explicit Picture(gfx::Rect layer_rect); |
@@ -65,9 +90,15 @@ class CC_EXPORT Picture |
// ownership to this picture. |
Picture(const skia::RefPtr<SkPicture>&, |
gfx::Rect layer_rect, |
- gfx::Rect opaque_rect); |
+ gfx::Rect opaque_rect, |
+ const PixelRefsMap& lazy_pixel_refs); |
~Picture(); |
+ void GatherPixelRefsFromSkia( |
+ const gfx::Rect& layer_rect, |
+ std::list<skia::LazyPixelRef*>& pixel_ref_list); |
+ void GatherAllPixelRefs(); |
+ |
gfx::Rect layer_rect_; |
gfx::Rect opaque_rect_; |
skia::RefPtr<SkPicture> picture_; |
@@ -75,7 +106,10 @@ class CC_EXPORT Picture |
typedef std::vector<scoped_refptr<Picture> > PictureVector; |
PictureVector clones_; |
+ PixelRefsMap lazy_pixel_refs_; |
+ |
friend class base::RefCountedThreadSafe<Picture>; |
+ friend class LazyPixelRefsIterator; |
DISALLOW_COPY_AND_ASSIGN(Picture); |
}; |