Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(27)

Side by Side Diff: cc/tiles/picture_layer_tiling.h

Issue 1405883002: cc: Remove the base RasterSource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge more Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/test/fake_picture_layer_tiling_client.h ('k') | cc/tiles/picture_layer_tiling.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 10 matching lines...) Expand all
21 #include "ui/gfx/geometry/rect.h" 21 #include "ui/gfx/geometry/rect.h"
22 22
23 namespace base { 23 namespace base {
24 namespace trace_event { 24 namespace trace_event {
25 class TracedValue; 25 class TracedValue;
26 } 26 }
27 } 27 }
28 28
29 namespace cc { 29 namespace cc {
30 30
31 class DisplayListRasterSource;
31 class PictureLayerTiling; 32 class PictureLayerTiling;
32 class PrioritizedTile; 33 class PrioritizedTile;
33 class RasterSource;
34 34
35 class CC_EXPORT PictureLayerTilingClient { 35 class CC_EXPORT PictureLayerTilingClient {
36 public: 36 public:
37 // Create a tile at the given content_rect (in the contents scale of the 37 // Create a tile at the given content_rect (in the contents scale of the
38 // tiling) This might return null if the client cannot create such a tile. 38 // tiling) This might return null if the client cannot create such a tile.
39 virtual ScopedTilePtr CreateTile(const Tile::CreateInfo& info) = 0; 39 virtual ScopedTilePtr CreateTile(const Tile::CreateInfo& info) = 0;
40 virtual gfx::Size CalculateTileSize( 40 virtual gfx::Size CalculateTileSize(
41 const gfx::Size& content_bounds) const = 0; 41 const gfx::Size& content_bounds) const = 0;
42 // This invalidation region defines the area (if any, it can by null) that 42 // This invalidation region defines the area (if any, it can by null) that
43 // tiles can not be shared between pending and active trees. 43 // tiles can not be shared between pending and active trees.
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 ~PictureLayerTiling(); 88 ~PictureLayerTiling();
89 89
90 static float CalculateSoonBorderDistance( 90 static float CalculateSoonBorderDistance(
91 const gfx::Rect& visible_rect_in_content_space, 91 const gfx::Rect& visible_rect_in_content_space,
92 float content_to_screen_scale); 92 float content_to_screen_scale);
93 93
94 // Create a tiling with no tiles. CreateTile() must be called to add some. 94 // Create a tiling with no tiles. CreateTile() must be called to add some.
95 static scoped_ptr<PictureLayerTiling> Create( 95 static scoped_ptr<PictureLayerTiling> Create(
96 WhichTree tree, 96 WhichTree tree,
97 float contents_scale, 97 float contents_scale,
98 scoped_refptr<RasterSource> raster_source, 98 scoped_refptr<DisplayListRasterSource> raster_source,
99 PictureLayerTilingClient* client, 99 PictureLayerTilingClient* client,
100 size_t tiling_interest_area_padding, 100 size_t tiling_interest_area_padding,
101 float skewport_target_time_in_seconds, 101 float skewport_target_time_in_seconds,
102 int skewport_extrapolation_limit_in_content_pixels); 102 int skewport_extrapolation_limit_in_content_pixels);
103 103
104 void SetRasterSourceAndResize(scoped_refptr<RasterSource> raster_source); 104 void SetRasterSourceAndResize(
105 scoped_refptr<DisplayListRasterSource> raster_source);
105 void Invalidate(const Region& layer_invalidation); 106 void Invalidate(const Region& layer_invalidation);
106 void CreateMissingTilesInLiveTilesRect(); 107 void CreateMissingTilesInLiveTilesRect();
107 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin, 108 void TakeTilesAndPropertiesFrom(PictureLayerTiling* pending_twin,
108 const Region& layer_invalidation); 109 const Region& layer_invalidation);
109 110
110 bool IsTileRequiredForActivation(const Tile* tile) const; 111 bool IsTileRequiredForActivation(const Tile* tile) const;
111 bool IsTileRequiredForDraw(const Tile* tile) const; 112 bool IsTileRequiredForDraw(const Tile* tile) const;
112 113
113 void set_resolution(TileResolution resolution) { 114 void set_resolution(TileResolution resolution) {
114 resolution_ = resolution; 115 resolution_ = resolution;
115 may_contain_low_resolution_tiles_ |= resolution == LOW_RESOLUTION; 116 may_contain_low_resolution_tiles_ |= resolution == LOW_RESOLUTION;
116 } 117 }
117 TileResolution resolution() const { return resolution_; } 118 TileResolution resolution() const { return resolution_; }
118 bool may_contain_low_resolution_tiles() const { 119 bool may_contain_low_resolution_tiles() const {
119 return may_contain_low_resolution_tiles_; 120 return may_contain_low_resolution_tiles_;
120 } 121 }
121 void reset_may_contain_low_resolution_tiles() { 122 void reset_may_contain_low_resolution_tiles() {
122 may_contain_low_resolution_tiles_ = false; 123 may_contain_low_resolution_tiles_ = false;
123 } 124 }
124 void set_can_require_tiles_for_activation(bool can_require_tiles) { 125 void set_can_require_tiles_for_activation(bool can_require_tiles) {
125 can_require_tiles_for_activation_ = can_require_tiles; 126 can_require_tiles_for_activation_ = can_require_tiles;
126 } 127 }
127 128
128 RasterSource* raster_source() const { return raster_source_.get(); } 129 DisplayListRasterSource* raster_source() const {
130 return raster_source_.get();
131 }
129 gfx::Size tiling_size() const { return tiling_data_.tiling_size(); } 132 gfx::Size tiling_size() const { return tiling_data_.tiling_size(); }
130 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; } 133 gfx::Rect live_tiles_rect() const { return live_tiles_rect_; }
131 gfx::Size tile_size() const { return tiling_data_.max_texture_size(); } 134 gfx::Size tile_size() const { return tiling_data_.max_texture_size(); }
132 float contents_scale() const { return contents_scale_; } 135 float contents_scale() const { return contents_scale_; }
133 const TilingData* tiling_data() const { return &tiling_data_; } 136 const TilingData* tiling_data() const { return &tiling_data_; }
134 137
135 Tile* TileAt(int i, int j) const { 138 Tile* TileAt(int i, int j) const {
136 TileMap::const_iterator iter = tiles_.find(TileMapKey(i, j)); 139 TileMap::const_iterator iter = tiles_.find(TileMapKey(i, j));
137 return iter == tiles_.end() ? nullptr : iter->second; 140 return iter == tiles_.end() ? nullptr : iter->second;
138 } 141 }
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 273
271 using TileMap = base::ScopedPtrHashMap<TileMapKey, ScopedTilePtr>; 274 using TileMap = base::ScopedPtrHashMap<TileMapKey, ScopedTilePtr>;
272 275
273 struct FrameVisibleRect { 276 struct FrameVisibleRect {
274 gfx::Rect visible_rect_in_content_space; 277 gfx::Rect visible_rect_in_content_space;
275 double frame_time_in_seconds = 0.0; 278 double frame_time_in_seconds = 0.0;
276 }; 279 };
277 280
278 PictureLayerTiling(WhichTree tree, 281 PictureLayerTiling(WhichTree tree,
279 float contents_scale, 282 float contents_scale,
280 scoped_refptr<RasterSource> raster_source, 283 scoped_refptr<DisplayListRasterSource> raster_source,
281 PictureLayerTilingClient* client, 284 PictureLayerTilingClient* client,
282 size_t tiling_interest_area_padding, 285 size_t tiling_interest_area_padding,
283 float skewport_target_time_in_seconds, 286 float skewport_target_time_in_seconds,
284 int skewport_extrapolation_limit_in_content_pixels); 287 int skewport_extrapolation_limit_in_content_pixels);
285 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect); 288 void SetLiveTilesRect(const gfx::Rect& live_tiles_rect);
286 void VerifyLiveTilesRect(bool is_on_recycle_tree) const; 289 void VerifyLiveTilesRect(bool is_on_recycle_tree) const;
287 Tile* CreateTile(const Tile::CreateInfo& info); 290 Tile* CreateTile(const Tile::CreateInfo& info);
288 ScopedTilePtr TakeTileAt(int i, int j); 291 ScopedTilePtr TakeTileAt(int i, int j);
289 // Returns true if the Tile existed and was removed from the tiling. 292 // Returns true if the Tile existed and was removed from the tiling.
290 bool RemoveTileAt(int i, int j); 293 bool RemoveTileAt(int i, int j);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles); 372 void RemoveTilesInRegion(const Region& layer_region, bool recreate_tiles);
370 373
371 const size_t tiling_interest_area_padding_; 374 const size_t tiling_interest_area_padding_;
372 const float skewport_target_time_in_seconds_; 375 const float skewport_target_time_in_seconds_;
373 const int skewport_extrapolation_limit_in_content_pixels_; 376 const int skewport_extrapolation_limit_in_content_pixels_;
374 377
375 // Given properties. 378 // Given properties.
376 const float contents_scale_; 379 const float contents_scale_;
377 PictureLayerTilingClient* const client_; 380 PictureLayerTilingClient* const client_;
378 const WhichTree tree_; 381 const WhichTree tree_;
379 scoped_refptr<RasterSource> raster_source_; 382 scoped_refptr<DisplayListRasterSource> raster_source_;
380 TileResolution resolution_; 383 TileResolution resolution_;
381 bool may_contain_low_resolution_tiles_; 384 bool may_contain_low_resolution_tiles_;
382 385
383 // Internal data. 386 // Internal data.
384 TilingData tiling_data_; 387 TilingData tiling_data_;
385 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map. 388 TileMap tiles_; // It is not legal to have a NULL tile in the tiles_ map.
386 gfx::Rect live_tiles_rect_; 389 gfx::Rect live_tiles_rect_;
387 390
388 gfx::Rect last_viewport_in_layer_space_; 391 gfx::Rect last_viewport_in_layer_space_;
389 // State saved for computing velocities based upon finite differences. 392 // State saved for computing velocities based upon finite differences.
(...skipping 16 matching lines...) Expand all
406 bool has_eventually_rect_tiles_; 409 bool has_eventually_rect_tiles_;
407 bool all_tiles_done_; 410 bool all_tiles_done_;
408 411
409 private: 412 private:
410 DISALLOW_ASSIGN(PictureLayerTiling); 413 DISALLOW_ASSIGN(PictureLayerTiling);
411 }; 414 };
412 415
413 } // namespace cc 416 } // namespace cc
414 417
415 #endif // CC_TILES_PICTURE_LAYER_TILING_H_ 418 #endif // CC_TILES_PICTURE_LAYER_TILING_H_
OLDNEW
« no previous file with comments | « cc/test/fake_picture_layer_tiling_client.h ('k') | cc/tiles/picture_layer_tiling.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698