Chromium Code Reviews| Index: cc/resources/picture.h |
| diff --git a/cc/resources/picture.h b/cc/resources/picture.h |
| index a29d5afaa6438177def4ca4af6c58e7c629d0c8a..7e4a4019678b8bfc383f136d2d77e40f805104c1 100644 |
| --- a/cc/resources/picture.h |
| +++ b/cc/resources/picture.h |
| @@ -7,11 +7,14 @@ |
| #include <list> |
| #include <string> |
| +#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" |
| @@ -30,6 +33,11 @@ struct RenderingStats; |
| class CC_EXPORT Picture |
| : public base::RefCountedThreadSafe<Picture> { |
| public: |
| + typedef std::pair<int, int> PixelRefMapKey; |
| + typedef base::hash_map< |
| + PixelRefMapKey, |
| + std::list<skia::LazyPixelRef*> > PixelRefMap; |
| + |
| static scoped_refptr<Picture> Create(gfx::Rect layer_rect); |
| static scoped_refptr<Picture> CreateFromBase64String( |
| const std::string& encoded_string); |
| @@ -58,12 +66,31 @@ 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); |
| - |
| void AsBase64String(std::string* output) const; |
| + class CC_EXPORT LazyPixelRefIterator { |
|
reveman
2013/04/23 14:33:24
Seem to be some inconsistency in when the term "la
vmpstr
2013/04/23 20:02:23
Agreed. I renamed it.
|
| + public: |
| + LazyPixelRefIterator(); |
| + LazyPixelRefIterator(gfx::Rect layer_rect, const Picture* picture); |
| + ~LazyPixelRefIterator(); |
| + |
| + skia::LazyPixelRef* operator->() const { return current_pixel_ref_; } |
| + skia::LazyPixelRef* operator*() const { return current_pixel_ref_; } |
| + LazyPixelRefIterator& operator++(); |
| + operator bool() const { return !!current_pixel_ref_; } |
| + |
| + private: |
| + const Picture* picture_; |
| + const std::list<skia::LazyPixelRef*>* current_list_; |
| + std::list<skia::LazyPixelRef*>::const_iterator current_list_iterator_; |
| + 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); |
| Picture(const std::string& encoded_string, bool* success); |
| @@ -71,9 +98,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 PixelRefMap& lazy_pixel_refs); |
| ~Picture(); |
| + void GatherPixelRefsFromSkia( |
| + const gfx::Rect& query_rect, |
| + std::list<skia::LazyPixelRef*>& pixel_ref_list); |
| + void GatherAllPixelRefs(); |
| + |
| gfx::Rect layer_rect_; |
| gfx::Rect opaque_rect_; |
| skia::RefPtr<SkPicture> picture_; |
| @@ -81,7 +114,13 @@ class CC_EXPORT Picture |
| typedef std::vector<scoped_refptr<Picture> > PictureVector; |
| PictureVector clones_; |
| + PixelRefMap lazy_pixel_refs_; |
| + gfx::Point min_lazy_pixel_cell_; |
| + gfx::Point max_lazy_pixel_cell_; |
| + gfx::Size cell_size_; |
| + |
| friend class base::RefCountedThreadSafe<Picture>; |
| + friend class LazyPixelRefIterator; |
| DISALLOW_COPY_AND_ASSIGN(Picture); |
| }; |