| 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/tile_priority.h" |
| 16 #include "cc/tiling_data.h" | 16 #include "cc/tiling_data.h" |
| 17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
| 18 | 18 |
| 19 namespace cc { | 19 namespace cc { |
| 20 | 20 |
| 21 class PictureLayerTiling; | 21 class PictureLayerTiling; |
| 22 | 22 |
| 23 class PictureLayerTilingClient { | 23 class PictureLayerTilingClient { |
| 24 public: | 24 public: |
| 25 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0; | 25 virtual scoped_refptr<Tile> CreateTile(PictureLayerTiling*, gfx::Rect) = 0; |
| 26 virtual void UpdatePile(Tile* tile) = 0; |
| 26 }; | 27 }; |
| 27 | 28 |
| 28 class CC_EXPORT PictureLayerTiling { | 29 class CC_EXPORT PictureLayerTiling { |
| 29 public: | 30 public: |
| 30 ~PictureLayerTiling(); | 31 ~PictureLayerTiling(); |
| 31 | 32 |
| 32 static scoped_ptr<PictureLayerTiling> Create(float contents_scale, | 33 static scoped_ptr<PictureLayerTiling> Create(float contents_scale, |
| 33 gfx::Size tile_size); | 34 gfx::Size tile_size); |
| 34 scoped_ptr<PictureLayerTiling> Clone() const; | 35 scoped_ptr<PictureLayerTiling> Clone() const; |
| 35 | 36 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 | 95 |
| 95 void UpdateTilePriorities( | 96 void UpdateTilePriorities( |
| 96 WhichTree tree, | 97 WhichTree tree, |
| 97 const gfx::Size& device_viewport, | 98 const gfx::Size& device_viewport, |
| 98 float last_contents_scale, | 99 float last_contents_scale, |
| 99 float current_contents_scale, | 100 float current_contents_scale, |
| 100 const gfx::Transform& last_screen_transform, | 101 const gfx::Transform& last_screen_transform, |
| 101 const gfx::Transform& current_screen_transform, | 102 const gfx::Transform& current_screen_transform, |
| 102 double time_delta); | 103 double time_delta); |
| 103 | 104 |
| 104 void MoveTilePriorities(WhichTree src_tree, WhichTree dst_tree); | 105 // Copies the src_tree priority into the dst_tree priority for all tiles. |
| 106 // The src_tree priority is reset to the lowest priority possible. This |
| 107 // also updates the pile on each tile to be the current client's pile. |
| 108 void DidBecomeActive(); |
| 105 | 109 |
| 106 protected: | 110 protected: |
| 107 typedef std::pair<int, int> TileMapKey; | 111 typedef std::pair<int, int> TileMapKey; |
| 108 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; | 112 typedef base::hash_map<TileMapKey, scoped_refptr<Tile> > TileMap; |
| 109 | 113 |
| 110 PictureLayerTiling(float contents_scale, gfx::Size tileSize); | 114 PictureLayerTiling(float contents_scale, gfx::Size tileSize); |
| 111 Tile* TileAt(int, int) const; | 115 Tile* TileAt(int, int) const; |
| 112 void CreateTile(int i, int j); | 116 void CreateTile(int i, int j); |
| 113 | 117 |
| 114 PictureLayerTilingClient* client_; | 118 PictureLayerTilingClient* client_; |
| 115 float contents_scale_; | 119 float contents_scale_; |
| 116 gfx::Size layer_bounds_; | 120 gfx::Size layer_bounds_; |
| 117 TileMap tiles_; | 121 TileMap tiles_; |
| 118 TilingData tiling_data_; | 122 TilingData tiling_data_; |
| 119 TileResolution resolution_; | 123 TileResolution resolution_; |
| 120 | 124 |
| 121 friend class Iterator; | 125 friend class Iterator; |
| 122 }; | 126 }; |
| 123 | 127 |
| 124 } // namespace cc | 128 } // namespace cc |
| 125 | 129 |
| 126 #endif // CC_PICTURE_LAYER_TILING_H_ | 130 #endif // CC_PICTURE_LAYER_TILING_H_ |
| OLD | NEW |