| OLD | NEW |
| 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 CC_PICTURE_PILE_BASE_H_ | 5 #ifndef CC_PICTURE_PILE_BASE_H_ |
| 6 #define CC_PICTURE_PILE_BASE_H_ | 6 #define CC_PICTURE_PILE_BASE_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/hash_tables.h" | 10 #include "base/hash_tables.h" |
| 11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
| 12 #include "cc/cc_export.h" | 12 #include "cc/cc_export.h" |
| 13 #include "cc/hash_pair.h" | 13 #include "cc/hash_pair.h" |
| 14 #include "cc/picture.h" | 14 #include "cc/picture.h" |
| 15 #include "cc/region.h" | 15 #include "cc/region.h" |
| 16 #include "cc/tiling_data.h" | 16 #include "cc/tiling_data.h" |
| 17 #include "ui/gfx/size.h" | 17 #include "ui/gfx/size.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { | 21 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { |
| 22 public: | 22 public: |
| 23 PicturePileBase(); | 23 PicturePileBase(); |
| 24 | 24 |
| 25 void Resize(gfx::Size size); | 25 void Resize(gfx::Size size); |
| 26 gfx::Size size() const { return tiling_.total_size(); } | 26 gfx::Size size() const { return tiling_.total_size(); } |
| 27 void SetMinContentsScale(float min_contents_scale); | 27 void SetMinContentsScale(float min_contents_scale); |
| 28 void SetTileGridSize(gfx::Size tile_size, int borderPixels); |
| 28 | 29 |
| 29 void PushPropertiesTo(PicturePileBase* other); | 30 void PushPropertiesTo(PicturePileBase* other); |
| 30 | 31 |
| 31 void UpdateRecordedRegion(); | 32 void UpdateRecordedRegion(); |
| 32 const Region& recorded_region() const { return recorded_region_; } | 33 const Region& recorded_region() const { return recorded_region_; } |
| 33 | 34 |
| 34 int num_tiles_x() const { return tiling_.num_tiles_x(); } | 35 int num_tiles_x() const { return tiling_.num_tiles_x(); } |
| 35 int num_tiles_y() const { return tiling_.num_tiles_y(); } | 36 int num_tiles_y() const { return tiling_.num_tiles_y(); } |
| 36 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } | 37 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } |
| 37 bool HasRecordingAt(int x, int y); | 38 bool HasRecordingAt(int x, int y); |
| 38 | 39 |
| 39 protected: | 40 protected: |
| 40 virtual ~PicturePileBase(); | 41 virtual ~PicturePileBase(); |
| 41 | 42 |
| 42 int buffer_pixels() const { return tiling_.border_texels(); } | 43 int buffer_pixels() const { return tiling_.border_texels(); } |
| 43 void Clear(); | 44 void Clear(); |
| 44 | 45 |
| 45 typedef std::pair<int, int> PictureListMapKey; | 46 typedef std::pair<int, int> PictureListMapKey; |
| 46 typedef std::list<scoped_refptr<Picture> > PictureList; | 47 typedef std::list<scoped_refptr<Picture> > PictureList; |
| 47 typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap; | 48 typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap; |
| 48 | 49 |
| 49 // A picture pile is a tiled set of picture lists. The picture list map | 50 // A picture pile is a tiled set of picture lists. The picture list map |
| 50 // is a map of tile indices to picture lists. | 51 // is a map of tile indices to picture lists. |
| 51 PictureListMap picture_list_map_; | 52 PictureListMap picture_list_map_; |
| 52 TilingData tiling_; | 53 TilingData tiling_; |
| 53 Region recorded_region_; | 54 Region recorded_region_; |
| 54 float min_contents_scale_; | 55 float min_contents_scale_; |
| 56 SkTileGridPicture::TileGridInfo tile_grid_info_; |
| 55 | 57 |
| 56 private: | 58 private: |
| 57 void SetBufferPixels(int buffer_pixels); | 59 void SetBufferPixels(int buffer_pixels); |
| 58 | 60 |
| 59 friend class base::RefCounted<PicturePileBase>; | 61 friend class base::RefCounted<PicturePileBase>; |
| 60 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); | 62 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 } // namespace cc | 65 } // namespace cc |
| 64 | 66 |
| 65 #endif // CC_PICTURE_PILE_H_ | 67 #endif // CC_PICTURE_PILE_H_ |
| OLD | NEW |