| 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_TILES_PICTURE_LAYER_TILING_H_ | 5 #ifndef CC_TILES_PICTURE_LAYER_TILING_H_ |
| 6 #define CC_TILES_PICTURE_LAYER_TILING_H_ | 6 #define CC_TILES_PICTURE_LAYER_TILING_H_ |
| 7 | 7 |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 return (value1_32 << 16) | value2; | 75 return (value1_32 << 16) | value2; |
| 76 } | 76 } |
| 77 }; | 77 }; |
| 78 | 78 |
| 79 class CC_EXPORT PictureLayerTiling { | 79 class CC_EXPORT PictureLayerTiling { |
| 80 public: | 80 public: |
| 81 static const int kBorderTexels = 1; | 81 static const int kBorderTexels = 1; |
| 82 | 82 |
| 83 PictureLayerTiling(WhichTree tree, | 83 PictureLayerTiling(WhichTree tree, |
| 84 float contents_scale, | 84 float contents_scale, |
| 85 const gfx::Vector2dF& contents_translation, |
| 85 scoped_refptr<RasterSource> raster_source, | 86 scoped_refptr<RasterSource> raster_source, |
| 86 PictureLayerTilingClient* client); | 87 PictureLayerTilingClient* client); |
| 87 ~PictureLayerTiling(); | 88 ~PictureLayerTiling(); |
| 88 | 89 |
| 89 PictureLayerTilingClient* client() const { return client_; } | 90 PictureLayerTilingClient* client() const { return client_; } |
| 90 | 91 |
| 91 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); | 92 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); |
| 92 void Invalidate(const Region& layer_invalidation); | 93 void Invalidate(const Region& layer_invalidation); |
| 93 void CreateMissingTilesInLiveTilesRect(); | 94 void CreateMissingTilesInLiveTilesRect(); |
| 94 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, | 95 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, |
| (...skipping 17 matching lines...) Expand all Loading... |
| 112 can_require_tiles_for_activation_ = can_require_tiles; | 113 can_require_tiles_for_activation_ = can_require_tiles; |
| 113 } | 114 } |
| 114 | 115 |
| 115 const scoped_refptr<RasterSource>& raster_source() const { | 116 const scoped_refptr<RasterSource>& raster_source() const { |
| 116 return raster_source_; | 117 return raster_source_; |
| 117 } | 118 } |
| 118 gfx::Size tiling_size() const { return tiling_data_.tiling_size(); } | 119 gfx::Size tiling_size() const { return tiling_data_.tiling_size(); } |
| 119 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } | 120 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } |
| 120 gfx::Size tile_size() const { return tiling_data_.max_texture_size(); } | 121 gfx::Size tile_size() const { return tiling_data_.max_texture_size(); } |
| 121 float contents_scale() const { return contents_scale_; } | 122 float contents_scale() const { return contents_scale_; } |
| 123 const gfx::Vector2dF& contents_translation() const { |
| 124 return contents_translation_; |
| 125 } |
| 122 const TilingData* tiling_data() const { return &tiling_data_; } | 126 const TilingData* tiling_data() const { return &tiling_data_; } |
| 123 | 127 |
| 124 Tile* TileAt(int i, int j) const { | 128 Tile* TileAt(int i, int j) const { |
| 125 TileMap::const_iterator iter = tiles_.find(TileMapKey(i, j)); | 129 TileMap::const_iterator iter = tiles_.find(TileMapKey(i, j)); |
| 126 return iter == tiles_.end() ? nullptr : iter->second.get(); | 130 return iter == tiles_.end() ? nullptr : iter->second.get(); |
| 127 } | 131 } |
| 128 | 132 |
| 129 bool has_tiles() const { return !tiles_.empty(); } | 133 bool has_tiles() const { return !tiles_.empty(); } |
| 130 // all_tiles_done() can return false negatives. | 134 // all_tiles_done() can return false negatives. |
| 131 bool all_tiles_done() const { return all_tiles_done_; } | 135 bool all_tiles_done() const { return all_tiles_done_; } |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 return current_skewport_rect_; | 316 return current_skewport_rect_; |
| 313 } | 317 } |
| 314 const gfx::Rect& current_soon_border_rect() const { | 318 const gfx::Rect& current_soon_border_rect() const { |
| 315 return current_soon_border_rect_; | 319 return current_soon_border_rect_; |
| 316 } | 320 } |
| 317 const gfx::Rect& current_eventually_rect() const { | 321 const gfx::Rect& current_eventually_rect() const { |
| 318 return current_eventually_rect_; | 322 return current_eventually_rect_; |
| 319 } | 323 } |
| 320 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); | 324 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); |
| 321 | 325 |
| 326 gfx::Rect EnclosingContentsRectFromLayerRect( |
| 327 const gfx::Rect& layer_rect) const; |
| 328 gfx::Rect EnclosingLayerRectFromContentsRect( |
| 329 const gfx::Rect& contents_rect) const; |
| 330 |
| 322 // Given properties. | 331 // Given properties. |
| 323 const float contents_scale_; | 332 const float contents_scale_; |
| 333 const gfx::Vector2dF contents_translation_; |
| 324 PictureLayerTilingClient* const client_; | 334 PictureLayerTilingClient* const client_; |
| 325 const WhichTree tree_; | 335 const WhichTree tree_; |
| 326 scoped_refptr<RasterSource> raster_source_; | 336 scoped_refptr<RasterSource> raster_source_; |
| 327 TileResolution resolution_; | 337 TileResolution resolution_; |
| 328 bool may_contain_low_resolution_tiles_; | 338 bool may_contain_low_resolution_tiles_; |
| 329 | 339 |
| 330 // Internal data. | 340 // Internal data. |
| 331 TilingData tiling_data_; | 341 TilingData tiling_data_; |
| 332 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. | 342 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. |
| 333 gfx::Rect live_tiles_rect_; | 343 gfx::Rect live_tiles_rect_; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 349 bool has_eventually_rect_tiles_; | 359 bool has_eventually_rect_tiles_; |
| 350 bool all_tiles_done_; | 360 bool all_tiles_done_; |
| 351 | 361 |
| 352 private: | 362 private: |
| 353 DISALLOW_COPY_AND_ASSIGN(PictureLayerTiling); | 363 DISALLOW_COPY_AND_ASSIGN(PictureLayerTiling); |
| 354 }; | 364 }; |
| 355 | 365 |
| 356 } // namespace cc | 366 } // namespace cc |
| 357 | 367 |
| 358 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ | 368 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ |
| OLD | NEW |