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

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

Issue 1381163002: Add a flag to disable partial raster in renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove "--enable-persistent-gpu-memory-buffer" 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
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 #include "cc/tiles/picture_layer_tiling.h" 5 #include "cc/tiles/picture_layer_tiling.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <cmath> 8 #include <cmath>
9 #include <limits> 9 #include <limits>
10 #include <set> 10 #include <set>
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 if (find != tiles_.end()) 134 if (find != tiles_.end())
135 continue; 135 continue;
136 136
137 Tile::CreateInfo info = CreateInfoForTile(key.index_x, key.index_y); 137 Tile::CreateInfo info = CreateInfoForTile(key.index_x, key.index_y);
138 if (ShouldCreateTileAt(info)) { 138 if (ShouldCreateTileAt(info)) {
139 Tile* tile = CreateTile(info); 139 Tile* tile = CreateTile(info);
140 140
141 // If this is the pending tree, then the active twin tiling may contain 141 // If this is the pending tree, then the active twin tiling may contain
142 // the previous content ID of these tiles. In that case, we need only 142 // the previous content ID of these tiles. In that case, we need only
143 // partially raster the tile content. 143 // partially raster the tile content.
144 if (tile && invalidation && TilingMatchesTileIndices(active_twin)) { 144 if (client_->IsPartialRasterEnabled() && tile && invalidation &&
danakj 2015/10/08 15:18:43 can you move this virtual call outside of the loop
ericrk 2015/10/13 23:03:45 this code has been removed.
145 TilingMatchesTileIndices(active_twin)) {
145 if (const Tile* old_tile = 146 if (const Tile* old_tile =
146 active_twin->TileAt(key.index_x, key.index_y)) { 147 active_twin->TileAt(key.index_x, key.index_y)) {
147 gfx::Rect tile_rect = tile->content_rect(); 148 gfx::Rect tile_rect = tile->content_rect();
148 gfx::Rect invalidated; 149 gfx::Rect invalidated;
149 for (Region::Iterator iter(*invalidation); iter.has_rect(); 150 for (Region::Iterator iter(*invalidation); iter.has_rect();
150 iter.next()) { 151 iter.next()) {
151 gfx::Rect invalid_content_rect = 152 gfx::Rect invalid_content_rect =
152 gfx::ScaleToEnclosingRect(iter.rect(), contents_scale_); 153 gfx::ScaleToEnclosingRect(iter.rect(), contents_scale_);
153 invalid_content_rect.Intersect(tile_rect); 154 invalid_content_rect.Intersect(tile_rect);
154 invalidated.Union(invalid_content_rect); 155 invalidated.Union(invalid_content_rect);
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 332
332 for (const auto& pair : remove_tiles) { 333 for (const auto& pair : remove_tiles) {
333 const TileMapKey& key = pair.first; 334 const TileMapKey& key = pair.first;
334 const gfx::Rect& invalid_content_rect = pair.second; 335 const gfx::Rect& invalid_content_rect = pair.second;
335 // TODO(danakj): This old_tile will not exist if we are committing to a 336 // TODO(danakj): This old_tile will not exist if we are committing to a
336 // pending tree since there is no tile there to remove, which prevents 337 // pending tree since there is no tile there to remove, which prevents
337 // tiles from knowing the invalidation rect and content id. crbug.com/490847 338 // tiles from knowing the invalidation rect and content id. crbug.com/490847
338 ScopedTilePtr old_tile = TakeTileAt(key.index_x, key.index_y); 339 ScopedTilePtr old_tile = TakeTileAt(key.index_x, key.index_y);
339 if (recreate_tiles && old_tile) { 340 if (recreate_tiles && old_tile) {
340 Tile::CreateInfo info = CreateInfoForTile(key.index_x, key.index_y); 341 Tile::CreateInfo info = CreateInfoForTile(key.index_x, key.index_y);
341 if (Tile* tile = CreateTile(info)) 342 Tile* tile = CreateTile(info);
343 if (client_->IsPartialRasterEnabled() && tile)
danakj 2015/10/08 15:18:43 ditto
ericrk 2015/10/13 23:03:45 this code has been removed.
342 tile->SetInvalidated(invalid_content_rect, old_tile->id()); 344 tile->SetInvalidated(invalid_content_rect, old_tile->id());
343 } 345 }
344 } 346 }
345 } 347 }
346 348
347 Tile::CreateInfo PictureLayerTiling::CreateInfoForTile(int i, int j) const { 349 Tile::CreateInfo PictureLayerTiling::CreateInfoForTile(int i, int j) const {
348 gfx::Rect tile_rect = tiling_data_.TileBoundsWithBorder(i, j); 350 gfx::Rect tile_rect = tiling_data_.TileBoundsWithBorder(i, j);
349 tile_rect.set_size(tiling_data_.max_texture_size()); 351 tile_rect.set_size(tiling_data_.max_texture_size());
350 gfx::Rect enclosing_layer_rect = 352 gfx::Rect enclosing_layer_rect =
351 gfx::ScaleToEnclosingRect(tile_rect, 1.f / contents_scale_); 353 gfx::ScaleToEnclosingRect(tile_rect, 1.f / contents_scale_);
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { 1007 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const {
1006 size_t amount = 0; 1008 size_t amount = 0;
1007 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 1009 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
1008 const Tile* tile = it->second; 1010 const Tile* tile = it->second;
1009 amount += tile->GPUMemoryUsageInBytes(); 1011 amount += tile->GPUMemoryUsageInBytes();
1010 } 1012 }
1011 return amount; 1013 return amount;
1012 } 1014 }
1013 1015
1014 } // namespace cc 1016 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698