OLD | NEW |
---|---|
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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_LAYER_TILING_H_ | 5 #ifndef CC_PICTURE_LAYER_TILING_H_ |
6 #define CC_PICTURE_LAYER_TILING_H_ | 6 #define CC_PICTURE_LAYER_TILING_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/hash_tables.h" | 9 #include "base/hash_tables.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "cc/cc_export.h" | 11 #include "cc/cc_export.h" |
12 #include "cc/hash_pair.h" | 12 #include "cc/hash_pair.h" |
13 #include "cc/region.h" | 13 #include "cc/region.h" |
14 #include "cc/tile.h" | 14 #include "cc/tile.h" |
15 #include "cc/tile_priority.h" | |
15 #include "cc/tiling_data.h" | 16 #include "cc/tiling_data.h" |
16 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
17 | 18 |
18 namespace cc { | 19 namespace cc { |
19 | 20 |
20 class PictureLayerTiling; | 21 class PictureLayerTiling; |
21 | 22 |
22 class PictureLayerTilingClient { | 23 class PictureLayerTilingClient { |
23 public: | 24 public: |
24 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0; | 25 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0; |
25 }; | 26 }; |
26 | 27 |
27 class CC_EXPORT PictureLayerTiling { | 28 class CC_EXPORT PictureLayerTiling { |
28 public: | 29 public: |
29 ~PictureLayerTiling(); | 30 ~PictureLayerTiling(); |
30 | 31 |
31 static scoped_ptr<PictureLayerTiling> Create(float contents_scale, | 32 static scoped_ptr<PictureLayerTiling> Create(float contents_scale, |
32 gfx::Size tile_size); | 33 gfx::Size tile_size); |
33 scoped_ptr<PictureLayerTiling> Clone() const; | 34 scoped_ptr<PictureLayerTiling> Clone() const; |
34 | 35 |
35 const PictureLayerTiling& operator=(const PictureLayerTiling&); | 36 const PictureLayerTiling& operator=(const PictureLayerTiling&); |
36 | 37 |
37 void SetLayerBounds(gfx::Size layer_bounds); | 38 void SetLayerBounds(gfx::Size layer_bounds); |
38 void Invalidate(const Region& layer_invalidation); | 39 void Invalidate(const Region& layer_invalidation); |
39 | 40 |
40 void SetClient(PictureLayerTilingClient* client); | 41 void SetClient(PictureLayerTilingClient* client); |
42 void set_resolution(TileResolution resolution) { resolution_ = resolution; } | |
43 TileResolution resolution() const { return resolution_; } | |
41 | 44 |
42 gfx::Rect ContentRect() const; | 45 gfx::Rect ContentRect() const; |
43 float contents_scale() const { return contents_scale_; } | 46 float contents_scale() const { return contents_scale_; } |
44 | 47 |
45 // Iterate over all tiles to fill content_rect. Even if tiles are invalid | 48 // Iterate over all tiles to fill content_rect. Even if tiles are invalid |
46 // (i.e. no valid resource) this tiling should still iterate over them. | 49 // (i.e. no valid resource) this tiling should still iterate over them. |
47 // The union of all geometry_rect calls for each element iterated over should | 50 // The union of all geometry_rect calls for each element iterated over should |
48 // exactly equal content_rect and no two geometry_rects should intersect. | 51 // exactly equal content_rect and no two geometry_rects should intersect. |
49 class CC_EXPORT Iterator { | 52 class CC_EXPORT Iterator { |
50 public: | 53 public: |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 friend class PictureLayerTiling; | 85 friend class PictureLayerTiling; |
83 }; | 86 }; |
84 | 87 |
85 Region OpaqueRegionInContentRect(const gfx::Rect&) const; | 88 Region OpaqueRegionInContentRect(const gfx::Rect&) const; |
86 | 89 |
87 void Reset() { return tiles_.clear(); } | 90 void Reset() { return tiles_.clear(); } |
88 | 91 |
89 void UpdateTilePriorities( | 92 void UpdateTilePriorities( |
90 WhichTree tree, | 93 WhichTree tree, |
91 const gfx::Size& device_viewport, | 94 const gfx::Size& device_viewport, |
92 float layer_content_scale_x, | 95 float last_contents_scale, |
danakj
2013/01/09 00:22:49
last_layer_...
| |
93 float layer_content_scale_y, | 96 float current_contents_scale, |
danakj
2013/01/09 00:22:49
current_layer_... (match the .cc)
| |
94 const gfx::Transform& last_screen_transform, | 97 const gfx::Transform& last_screen_transform, |
95 const gfx::Transform& current_screen_transform, | 98 const gfx::Transform& current_screen_transform, |
96 double time_delta); | 99 double time_delta); |
97 | 100 |
98 protected: | 101 protected: |
99 typedef std::pair<int, int> TileMapKey; | 102 typedef std::pair<int, int> TileMapKey; |
100 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; | 103 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; |
101 | 104 |
102 PictureLayerTiling(float contents_scale, gfx::Size tileSize); | 105 PictureLayerTiling(float contents_scale, gfx::Size tileSize); |
103 Tile* TileAt(int, int) const; | 106 Tile* TileAt(int, int) const; |
104 void CreateTile(int i, int j); | 107 void CreateTile(int i, int j); |
105 | 108 |
106 PictureLayerTilingClient* client_; | 109 PictureLayerTilingClient* client_; |
107 float contents_scale_; | 110 float contents_scale_; |
108 gfx::Size layer_bounds_; | 111 gfx::Size layer_bounds_; |
109 TileMap tiles_; | 112 TileMap tiles_; |
110 TilingData tiling_data_; | 113 TilingData tiling_data_; |
114 TileResolution resolution_; | |
111 | 115 |
112 friend class Iterator; | 116 friend class Iterator; |
113 }; | 117 }; |
114 | 118 |
115 } // namespace cc | 119 } // namespace cc |
116 | 120 |
117 #endif // CC_PICTURE_LAYER_TILING_H_ | 121 #endif // CC_PICTURE_LAYER_TILING_H_ |
OLD | NEW |