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" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 int right_; | 79 int right_; |
80 int bottom_; | 80 int bottom_; |
81 | 81 |
82 friend class PictureLayerTiling; | 82 friend class PictureLayerTiling; |
83 }; | 83 }; |
84 | 84 |
85 Region OpaqueRegionInContentRect(const gfx::Rect&) const; | 85 Region OpaqueRegionInContentRect(const gfx::Rect&) const; |
86 | 86 |
87 void Reset() { return tiles_.clear(); } | 87 void Reset() { return tiles_.clear(); } |
88 | 88 |
| 89 void UpdateTilePriorities(const gfx::Size& view_port, |
| 90 float layer_content_scale, |
| 91 const gfx::Transform& last_transform, |
| 92 const gfx::Transform& current_transform, |
| 93 double time_delta); |
| 94 |
89 protected: | 95 protected: |
| 96 // TODO(qinmin): modify ui/range/Range.h to support template so that we |
| 97 // don't need to define this. |
| 98 struct Range { |
| 99 Range(double start, double end) : start_(start), end_(end) {} |
| 100 Range Intersects(const Range& other); |
| 101 bool IsEmpty(); |
| 102 double start_; |
| 103 double end_; |
| 104 }; |
| 105 |
90 typedef std::pair<int, int> TileMapKey; | 106 typedef std::pair<int, int> TileMapKey; |
91 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; | 107 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; |
92 | 108 |
93 PictureLayerTiling(float contents_scale, gfx::Size tileSize); | 109 PictureLayerTiling(float contents_scale, gfx::Size tileSize); |
94 Tile* TileAt(int, int) const; | 110 Tile* TileAt(int, int) const; |
95 void CreateTile(int i, int j); | 111 void CreateTile(int i, int j); |
96 | 112 |
| 113 // Calculate the time for the |current_bounds| to intersect with the |
| 114 // |target_bounds| given its previous location and time delta. |
| 115 // This function should work for both scaling and scrolling case. |
| 116 double TimeForBoundsToIntersect(gfx::Rect previous_bounds, |
| 117 gfx::Rect current_bounds, |
| 118 double time_delta, |
| 119 gfx::Rect target_bounds); |
| 120 |
| 121 // Calculate a time range that |value| will be larger than |threshold| |
| 122 // given the velocity of its change. |
| 123 Range TimeRangeValueLargerThanThreshold(int value, |
| 124 int threshold, |
| 125 double velocity); |
| 126 |
97 PictureLayerTilingClient* client_; | 127 PictureLayerTilingClient* client_; |
98 float contents_scale_; | 128 float contents_scale_; |
99 gfx::Size layer_bounds_; | 129 gfx::Size layer_bounds_; |
100 TileMap tiles_; | 130 TileMap tiles_; |
101 TilingData tiling_data_; | 131 TilingData tiling_data_; |
102 | 132 |
103 friend class Iterator; | 133 friend class Iterator; |
| 134 friend class PictureLayerTilingTest; |
104 }; | 135 }; |
105 | 136 |
106 } // namespace cc | 137 } // namespace cc |
107 | 138 |
108 #endif // CC_PICTURE_LAYER_TILING_H_ | 139 #endif // CC_PICTURE_LAYER_TILING_H_ |
OLD | NEW |