| 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 const gfx::Transform& current_screen_transform, | 137 const gfx::Transform& current_screen_transform, |
| 138 int current_source_frame_number, | 138 int current_source_frame_number, |
| 139 double current_frame_time, | 139 double current_frame_time, |
| 140 bool store_screen_space_quads_on_tiles); | 140 bool store_screen_space_quads_on_tiles); |
| 141 | 141 |
| 142 // Copies the src_tree priority into the dst_tree priority for all tiles. | 142 // Copies the src_tree priority into the dst_tree priority for all tiles. |
| 143 // The src_tree priority is reset to the lowest priority possible. This | 143 // The src_tree priority is reset to the lowest priority possible. This |
| 144 // also updates the pile on each tile to be the current client's pile. | 144 // also updates the pile on each tile to be the current client's pile. |
| 145 void DidBecomeActive(); | 145 void DidBecomeActive(); |
| 146 | 146 |
| 147 bool needs_update_tile_priorities(int current_source_frame_number, |
| 148 double current_frame_time) const { |
| 149 // In pending tree, UpdateTilePriorities is always called with |
| 150 // calcDrawProperties. We want to update tile priorities: |
| 151 // - Immediately after a commit (first_update_in_new_source_frame). |
| 152 // - On animation ticks after the first frame in the tree |
| 153 // (first_update_in_new_impl_frame). |
| 154 // In active tree, UpdateTilePriorities is only called during draw. We |
| 155 // want to update priorities: |
| 156 // - Only if properties were not already computed by the pending tree |
| 157 // and activated for the frame (first_update_in_new_impl_frame). |
| 158 return current_source_frame_number != last_source_frame_number_ || |
| 159 current_frame_time != last_impl_frame_time_; |
| 160 } |
| 161 |
| 147 protected: | 162 protected: |
| 148 typedef std::pair<int, int> TileMapKey; | 163 typedef std::pair<int, int> TileMapKey; |
| 149 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; | 164 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; |
| 150 | 165 |
| 151 PictureLayerTiling(float contents_scale); | 166 PictureLayerTiling(float contents_scale); |
| 152 Tile* TileAt(int, int) const; | 167 Tile* TileAt(int, int) const; |
| 153 void CreateTilesFromContentRect(gfx::Rect layer_rect); | 168 void CreateTilesFromContentRect(gfx::Rect layer_rect); |
| 154 void CreateTile(int i, int j); | 169 void CreateTile(int i, int j); |
| 155 | 170 |
| 156 PictureLayerTilingClient* client_; | 171 PictureLayerTilingClient* client_; |
| 157 float contents_scale_; | 172 float contents_scale_; |
| 158 gfx::Size layer_bounds_; | 173 gfx::Size layer_bounds_; |
| 159 gfx::Rect last_prioritized_rect_; | 174 gfx::Rect last_prioritized_rect_; |
| 160 // It is not legal to have a NULL tile in the tiles_ map. | 175 // It is not legal to have a NULL tile in the tiles_ map. |
| 161 TileMap tiles_; | 176 TileMap tiles_; |
| 162 TilingData tiling_data_; | 177 TilingData tiling_data_; |
| 163 TileResolution resolution_; | 178 TileResolution resolution_; |
| 164 int last_source_frame_number_; | 179 int last_source_frame_number_; |
| 165 double last_impl_frame_time_; | 180 double last_impl_frame_time_; |
| 166 | 181 |
| 167 friend class Iterator; | 182 friend class Iterator; |
| 168 }; | 183 }; |
| 169 | 184 |
| 170 } // namespace cc | 185 } // namespace cc |
| 171 | 186 |
| 172 #endif // CC_PICTURE_LAYER_TILING_H_ | 187 #endif // CC_PICTURE_LAYER_TILING_H_ |
| OLD | NEW |