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

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

Issue 1841083004: cc: Indicate that we've updated a tiling if we invalidated it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/tiles/picture_layer_tiling.h ('k') | cc/tiles/picture_layer_tiling_unittest.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 #include "cc/tiles/picture_layer_tiling.h" 5 #include "cc/tiles/picture_layer_tiling.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <cmath> 10 #include <cmath>
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 raster_source_(raster_source), 67 raster_source_(raster_source),
68 resolution_(NON_IDEAL_RESOLUTION), 68 resolution_(NON_IDEAL_RESOLUTION),
69 may_contain_low_resolution_tiles_(false), 69 may_contain_low_resolution_tiles_(false),
70 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels), 70 tiling_data_(gfx::Size(), gfx::Size(), kBorderTexels),
71 can_require_tiles_for_activation_(false), 71 can_require_tiles_for_activation_(false),
72 current_content_to_screen_scale_(0.f), 72 current_content_to_screen_scale_(0.f),
73 has_visible_rect_tiles_(false), 73 has_visible_rect_tiles_(false),
74 has_skewport_rect_tiles_(false), 74 has_skewport_rect_tiles_(false),
75 has_soon_border_rect_tiles_(false), 75 has_soon_border_rect_tiles_(false),
76 has_eventually_rect_tiles_(false), 76 has_eventually_rect_tiles_(false),
77 all_tiles_done_(true) { 77 all_tiles_done_(true),
78 invalidated_since_last_compute_priority_rects_(false) {
78 DCHECK(!raster_source->IsSolidColor()); 79 DCHECK(!raster_source->IsSolidColor());
79 gfx::Size content_bounds = 80 gfx::Size content_bounds =
80 gfx::ScaleToCeiledSize(raster_source_->GetSize(), contents_scale); 81 gfx::ScaleToCeiledSize(raster_source_->GetSize(), contents_scale);
81 gfx::Size tile_size = client_->CalculateTileSize(content_bounds); 82 gfx::Size tile_size = client_->CalculateTileSize(content_bounds);
82 83
83 DCHECK(!gfx::ScaleToFlooredSize(raster_source_->GetSize(), contents_scale) 84 DCHECK(!gfx::ScaleToFlooredSize(raster_source_->GetSize(), contents_scale)
84 .IsEmpty()) 85 .IsEmpty())
85 << "Tiling created with scale too small as contents become empty." 86 << "Tiling created with scale too small as contents become empty."
86 << " Layer bounds: " << raster_source_->GetSize().ToString() 87 << " Layer bounds: " << raster_source_->GetSize().ToString()
87 << " Contents scale: " << contents_scale; 88 << " Contents scale: " << contents_scale;
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 for (int i = before_left; i <= before_right; ++i) { 281 for (int i = before_left; i <= before_right; ++i) {
281 Tile::CreateInfo info = CreateInfoForTile(i, after_bottom); 282 Tile::CreateInfo info = CreateInfoForTile(i, after_bottom);
282 if (ShouldCreateTileAt(info)) 283 if (ShouldCreateTileAt(info))
283 CreateTile(info); 284 CreateTile(info);
284 } 285 }
285 } 286 }
286 } 287 }
287 288
288 void PictureLayerTiling::Invalidate(const Region& layer_invalidation) { 289 void PictureLayerTiling::Invalidate(const Region& layer_invalidation) {
289 DCHECK(tree_ != ACTIVE_TREE || !client_->GetPendingOrActiveTwinTiling(this)); 290 DCHECK(tree_ != ACTIVE_TREE || !client_->GetPendingOrActiveTwinTiling(this));
291 invalidated_since_last_compute_priority_rects_ = true;
290 RemoveTilesInRegion(layer_invalidation, true /* recreate tiles */); 292 RemoveTilesInRegion(layer_invalidation, true /* recreate tiles */);
291 } 293 }
292 294
293 void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_invalidation, 295 void PictureLayerTiling::RemoveTilesInRegion(const Region& layer_invalidation,
294 bool recreate_tiles) { 296 bool recreate_tiles) {
295 // We only invalidate the active tiling when it's orphaned: it has no pending 297 // We only invalidate the active tiling when it's orphaned: it has no pending
296 // twin, so it's slated for removal in the future. 298 // twin, so it's slated for removal in the future.
297 if (live_tiles_rect_.IsEmpty()) 299 if (live_tiles_rect_.IsEmpty())
298 return; 300 return;
299 // Pick 16 for the size of the SmallMap before it promotes to a unordered_map. 301 // Pick 16 for the size of the SmallMap before it promotes to a unordered_map.
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 float ideal_contents_scale, 633 float ideal_contents_scale,
632 double current_frame_time_in_seconds, 634 double current_frame_time_in_seconds,
633 const Occlusion& occlusion_in_layer_space) { 635 const Occlusion& occlusion_in_layer_space) {
634 // If we have, or had occlusions, mark the tiles as 'not done' to ensure that 636 // If we have, or had occlusions, mark the tiles as 'not done' to ensure that
635 // we reiterate the tiles for rasterization. 637 // we reiterate the tiles for rasterization.
636 if (occlusion_in_layer_space.HasOcclusion() || 638 if (occlusion_in_layer_space.HasOcclusion() ||
637 current_occlusion_in_layer_space_.HasOcclusion()) { 639 current_occlusion_in_layer_space_.HasOcclusion()) {
638 set_all_tiles_done(false); 640 set_all_tiles_done(false);
639 } 641 }
640 642
643 bool invalidated = invalidated_since_last_compute_priority_rects_;
644 invalidated_since_last_compute_priority_rects_ = false;
641 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds, 645 if (!NeedsUpdateForFrameAtTimeAndViewport(current_frame_time_in_seconds,
642 viewport_in_layer_space)) { 646 viewport_in_layer_space)) {
643 // This should never be zero for the purposes of has_ever_been_updated(). 647 // This should never be zero for the purposes of has_ever_been_updated().
644 DCHECK_NE(current_frame_time_in_seconds, 0.0); 648 DCHECK_NE(current_frame_time_in_seconds, 0.0);
645 return false; 649 return invalidated;
646 } 650 }
647 651
648 const float content_to_screen_scale = ideal_contents_scale / contents_scale_; 652 const float content_to_screen_scale = ideal_contents_scale / contents_scale_;
649 653
650 // We want to compute the visible rect and eventually rect from it in the 654 // We want to compute the visible rect and eventually rect from it in the
651 // space of the tiling. But the visible rect (viewport) can be arbitrarily 655 // space of the tiling. But the visible rect (viewport) can be arbitrarily
652 // positioned, so be careful when scaling it since we can exceed integer 656 // positioned, so be careful when scaling it since we can exceed integer
653 // bounds. 657 // bounds.
654 gfx::Rect eventually_rect; 658 gfx::Rect eventually_rect;
655 gfx::Rect visible_rect_in_content_space; 659 gfx::Rect visible_rect_in_content_space;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
1029 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const { 1033 size_t PictureLayerTiling::GPUMemoryUsageInBytes() const {
1030 size_t amount = 0; 1034 size_t amount = 0;
1031 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) { 1035 for (TileMap::const_iterator it = tiles_.begin(); it != tiles_.end(); ++it) {
1032 const Tile* tile = it->second.get(); 1036 const Tile* tile = it->second.get();
1033 amount += tile->GPUMemoryUsageInBytes(); 1037 amount += tile->GPUMemoryUsageInBytes();
1034 } 1038 }
1035 return amount; 1039 return amount;
1036 } 1040 }
1037 1041
1038 } // namespace cc 1042 } // namespace cc
OLDNEW
« no previous file with comments | « cc/tiles/picture_layer_tiling.h ('k') | cc/tiles/picture_layer_tiling_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698