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

Side by Side Diff: cc/layers/tiled_layer.cc

Issue 373113003: Keeping track of descendants that draw content instead of recalcualting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 5 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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/layers/tiled_layer.h" 5 #include "cc/layers/tiled_layer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 return; 148 return;
149 tiler_->SetTilingRect(new_tiling_rect); 149 tiler_->SetTilingRect(new_tiling_rect);
150 150
151 // Invalidate any areas that the new bounds exposes. 151 // Invalidate any areas that the new bounds exposes.
152 Region old_region = old_tiling_rect; 152 Region old_region = old_tiling_rect;
153 Region new_region = new_tiling_rect; 153 Region new_region = new_tiling_rect;
154 new_tiling_rect.Subtract(old_tiling_rect); 154 new_tiling_rect.Subtract(old_tiling_rect);
155 for (Region::Iterator new_rects(new_tiling_rect); new_rects.has_rect(); 155 for (Region::Iterator new_rects(new_tiling_rect); new_rects.has_rect();
156 new_rects.next()) 156 new_rects.next())
157 InvalidateContentRect(new_rects.rect()); 157 InvalidateContentRect(new_rects.rect());
158 UpdateDrawsContent();
158 } 159 }
159 160
160 void TiledLayer::SetTileSize(const gfx::Size& size) { 161 void TiledLayer::SetTileSize(const gfx::Size& size) {
161 tiler_->SetTileSize(size); 162 tiler_->SetTileSize(size);
163 UpdateDrawsContent();
162 } 164 }
163 165
164 void TiledLayer::SetBorderTexelOption( 166 void TiledLayer::SetBorderTexelOption(
165 LayerTilingData::BorderTexelOption border_texel_option) { 167 LayerTilingData::BorderTexelOption border_texel_option) {
166 tiler_->SetBorderTexelOption(border_texel_option); 168 tiler_->SetBorderTexelOption(border_texel_option);
169 UpdateDrawsContent();
167 } 170 }
168 171
169 bool TiledLayer::DrawsContent() const { 172 bool TiledLayer::HasDrawableContent() const {
170 if (!ContentsScalingLayer::DrawsContent()) 173 bool has_more_than_one_tile =
171 return false; 174 (tiler_->num_tiles_x() > 1) || (tiler_->num_tiles_y() > 1);
172 175
173 bool has_more_than_one_tile = 176 return !(tiling_option_ == NEVER_TILE && has_more_than_one_tile) &&
174 tiler_->num_tiles_x() > 1 || tiler_->num_tiles_y() > 1; 177 ContentsScalingLayer::HasDrawableContent();
175 if (tiling_option_ == NEVER_TILE && has_more_than_one_tile)
176 return false;
177
178 return true;
179 } 178 }
180 179
181 void TiledLayer::ReduceMemoryUsage() { 180 void TiledLayer::ReduceMemoryUsage() {
182 if (Updater()) 181 if (Updater())
183 Updater()->ReduceMemoryUsage(); 182 Updater()->ReduceMemoryUsage();
184 } 183 }
185 184
186 void TiledLayer::SetIsMask(bool is_mask) { 185 void TiledLayer::SetIsMask(bool is_mask) {
187 set_tiling_option(is_mask ? NEVER_TILE : AUTO_TILE); 186 set_tiling_option(is_mask ? NEVER_TILE : AUTO_TILE);
188 } 187 }
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after
893 gfx::Rect prepaint_rect = visible_content_rect(); 892 gfx::Rect prepaint_rect = visible_content_rect();
894 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns, 893 prepaint_rect.Inset(-tiler_->tile_size().width() * kPrepaintColumns,
895 -tiler_->tile_size().height() * kPrepaintRows); 894 -tiler_->tile_size().height() * kPrepaintRows);
896 gfx::Rect content_rect(content_bounds()); 895 gfx::Rect content_rect(content_bounds());
897 prepaint_rect.Intersect(content_rect); 896 prepaint_rect.Intersect(content_rect);
898 897
899 return prepaint_rect; 898 return prepaint_rect;
900 } 899 }
901 900
902 } // namespace cc 901 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698