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 LayerTreeHost; | |
22 class LayerTreeHostImpl; | |
23 class LayerTreeSettings; | |
24 | |
21 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { | 25 class CC_EXPORT PicturePileBase : public base::RefCounted<PicturePileBase> { |
22 public: | 26 public: |
23 PicturePileBase(); | 27 PicturePileBase(); |
24 | 28 |
25 void Resize(gfx::Size size); | 29 void Resize(gfx::Size size); |
26 gfx::Size size() const { return tiling_.total_size(); } | 30 gfx::Size size() const { return tiling_.total_size(); } |
27 void SetMinContentsScale(float min_contents_scale); | 31 void SetMinContentsScale(float min_contents_scale); |
28 | 32 |
29 void PushPropertiesTo(PicturePileBase* other); | 33 void PushPropertiesTo(PicturePileBase* other); |
30 | 34 |
31 void UpdateRecordedRegion(); | 35 void UpdateRecordedRegion(); |
32 const Region& recorded_region() const { return recorded_region_; } | 36 const Region& recorded_region() const { return recorded_region_; } |
33 | 37 |
34 int num_tiles_x() const { return tiling_.num_tiles_x(); } | 38 int num_tiles_x() const { return tiling_.num_tiles_x(); } |
35 int num_tiles_y() const { return tiling_.num_tiles_y(); } | 39 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); } | 40 gfx::Rect tile_bounds(int x, int y) const { return tiling_.TileBounds(x, y); } |
37 bool HasRecordingAt(int x, int y); | 41 bool HasRecordingAt(int x, int y); |
38 | 42 |
43 void ApplyLayerTreeSettings(LayerTreeHost* host); | |
44 void ApplyLayerTreeSettings(LayerTreeHostImpl* host_impl); // for testing | |
enne (OOO)
2013/02/25 23:59:15
Could you just directly pass in the values you nee
| |
45 | |
39 protected: | 46 protected: |
40 virtual ~PicturePileBase(); | 47 virtual ~PicturePileBase(); |
41 | 48 |
42 int buffer_pixels() const { return tiling_.border_texels(); } | 49 int buffer_pixels() const { return tiling_.border_texels(); } |
43 void Clear(); | 50 void Clear(); |
44 | 51 |
45 typedef std::pair<int, int> PictureListMapKey; | 52 typedef std::pair<int, int> PictureListMapKey; |
46 typedef std::list<scoped_refptr<Picture> > PictureList; | 53 typedef std::list<scoped_refptr<Picture> > PictureList; |
47 typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap; | 54 typedef base::hash_map<PictureListMapKey, PictureList> PictureListMap; |
48 | 55 |
49 // A picture pile is a tiled set of picture lists. The picture list map | 56 // A picture pile is a tiled set of picture lists. The picture list map |
50 // is a map of tile indices to picture lists. | 57 // is a map of tile indices to picture lists. |
51 PictureListMap picture_list_map_; | 58 PictureListMap picture_list_map_; |
52 TilingData tiling_; | 59 TilingData tiling_; |
53 Region recorded_region_; | 60 Region recorded_region_; |
54 float min_contents_scale_; | 61 float min_contents_scale_; |
62 SkTileGridPicture::TileGridInfo tile_grid_info_; | |
55 | 63 |
56 private: | 64 private: |
65 void ApplyLayerTreeSettings(const LayerTreeSettings& settings, float scale); | |
57 void SetBufferPixels(int buffer_pixels); | 66 void SetBufferPixels(int buffer_pixels); |
58 | 67 |
59 friend class base::RefCounted<PicturePileBase>; | 68 friend class base::RefCounted<PicturePileBase>; |
60 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); | 69 DISALLOW_COPY_AND_ASSIGN(PicturePileBase); |
61 }; | 70 }; |
62 | 71 |
63 } // namespace cc | 72 } // namespace cc |
64 | 73 |
65 #endif // CC_PICTURE_PILE_H_ | 74 #endif // CC_PICTURE_PILE_H_ |
OLD | NEW |