| Index: cc/resources/picture.h
|
| diff --git a/cc/resources/picture.h b/cc/resources/picture.h
|
| index a56156b575373e34612d9baa74d08dbbf44a10b7..86e256d3ae9fbcc6a548ca6b00201263ad4e2a86 100644
|
| --- a/cc/resources/picture.h
|
| +++ b/cc/resources/picture.h
|
| @@ -5,13 +5,17 @@
|
| #ifndef CC_RESOURCES_PICTURE_H_
|
| #define CC_RESOURCES_PICTURE_H_
|
|
|
| -#include <list>
|
| #include <string>
|
| +#include <utility>
|
| #include <vector>
|
|
|
| #include "base/basictypes.h"
|
| +#include "base/hash_tables.h"
|
| +#include "base/lazy_instance.h"
|
| +#include "base/logging.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 +34,10 @@ struct RenderingStats;
|
| class CC_EXPORT Picture
|
| : public base::RefCountedThreadSafe<Picture> {
|
| public:
|
| + typedef std::pair<int, int> PixelRefMapKey;
|
| + typedef std::vector<skia::LazyPixelRef*> PixelRefs;
|
| + typedef base::hash_map<PixelRefMapKey, PixelRefs> PixelRefMap;
|
| +
|
| static scoped_refptr<Picture> Create(gfx::Rect layer_rect);
|
| static scoped_refptr<Picture> CreateFromBase64String(
|
| const std::string& encoded_string);
|
| @@ -58,12 +66,41 @@ class CC_EXPORT Picture
|
| float contents_scale,
|
| bool enable_lcd_text);
|
|
|
| - void GatherPixelRefs(
|
| - gfx::Rect layer_rect,
|
| - std::list<skia::LazyPixelRef*>& pixel_ref_list);
|
| -
|
| void AsBase64String(std::string* output) const;
|
|
|
| + class CC_EXPORT PixelRefIterator {
|
| + public:
|
| + PixelRefIterator();
|
| + PixelRefIterator(gfx::Rect layer_rect, const Picture* picture);
|
| + ~PixelRefIterator();
|
| +
|
| + skia::LazyPixelRef* operator->() const {
|
| + DCHECK_LT(current_index_, current_pixel_refs_->size());
|
| + return (*current_pixel_refs_)[current_index_];
|
| + }
|
| +
|
| + skia::LazyPixelRef* operator*() const {
|
| + DCHECK_LT(current_index_, current_pixel_refs_->size());
|
| + return (*current_pixel_refs_)[current_index_];
|
| + }
|
| +
|
| + PixelRefIterator& operator++();
|
| + operator bool() const {
|
| + return current_index_ < current_pixel_refs_->size();
|
| + }
|
| +
|
| + private:
|
| + static base::LazyInstance<PixelRefs> empty_pixel_refs_;
|
| + const Picture* picture_;
|
| + const PixelRefs* current_pixel_refs_;
|
| + unsigned current_index_;
|
| +
|
| + 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 +108,13 @@ 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& pixel_refs);
|
| ~Picture();
|
|
|
| + void GatherPixelRefsFromSkia(gfx::Rect query_rect, PixelRefs* pixel_refs);
|
| + void GatherAllPixelRefs();
|
| +
|
| gfx::Rect layer_rect_;
|
| gfx::Rect opaque_rect_;
|
| skia::RefPtr<SkPicture> picture_;
|
| @@ -81,7 +122,13 @@ class CC_EXPORT Picture
|
| typedef std::vector<scoped_refptr<Picture> > PictureVector;
|
| PictureVector clones_;
|
|
|
| + PixelRefMap pixel_refs_;
|
| + gfx::Point min_pixel_cell_;
|
| + gfx::Point max_pixel_cell_;
|
| + gfx::Size cell_size_;
|
| +
|
| friend class base::RefCountedThreadSafe<Picture>;
|
| + friend class PixelRefIterator;
|
| DISALLOW_COPY_AND_ASSIGN(Picture);
|
| };
|
|
|
|
|