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

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

Issue 935333002: Update from https://crrev.com/316786 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/layers/tiled_layer_impl.h ('k') | cc/layers/tiled_layer_impl_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 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_impl.h" 5 #include "cc/layers/tiled_layer_impl.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/trace_event_argument.h" 9 #include "base/trace_event/trace_event_argument.h"
10 #include "cc/base/math_util.h" 10 #include "cc/base/math_util.h"
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
106 float* width) const { 106 float* width) const {
107 *color = DebugColors::TiledContentLayerBorderColor(); 107 *color = DebugColors::TiledContentLayerBorderColor();
108 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); 108 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl());
109 } 109 }
110 110
111 scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl( 111 scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl(
112 LayerTreeImpl* tree_impl) { 112 LayerTreeImpl* tree_impl) {
113 return TiledLayerImpl::Create(tree_impl, id(), synced_scroll_offset()); 113 return TiledLayerImpl::Create(tree_impl, id(), synced_scroll_offset());
114 } 114 }
115 115
116 void TiledLayerImpl::AsValueInto(base::debug::TracedValue* state) const { 116 void TiledLayerImpl::AsValueInto(base::trace_event::TracedValue* state) const {
117 LayerImpl::AsValueInto(state); 117 LayerImpl::AsValueInto(state);
118 MathUtil::AddToTracedValue("invalidation", update_rect(), state); 118 MathUtil::AddToTracedValue("invalidation", update_rect(), state);
119 } 119 }
120 120
121 size_t TiledLayerImpl::GPUMemoryUsageInBytes() const { 121 size_t TiledLayerImpl::GPUMemoryUsageInBytes() const {
122 size_t amount = 0; 122 size_t amount = 0;
123 const size_t kMemoryUsagePerTileInBytes = 123 const size_t kMemoryUsagePerTileInBytes =
124 4 * tiler_->tile_size().width() * tiler_->tile_size().height(); 124 4 * tiler_->tile_size().width() * tiler_->tile_size().height();
125 for (LayerTilingData::TileMap::const_iterator iter = tiler_->tiles().begin(); 125 for (LayerTilingData::TileMap::const_iterator iter = tiler_->tiles().begin();
126 iter != tiler_->tiles().end(); 126 iter != tiler_->tiles().end();
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 bool TiledLayerImpl::WillDraw(DrawMode draw_mode, 159 bool TiledLayerImpl::WillDraw(DrawMode draw_mode,
160 ResourceProvider* resource_provider) { 160 ResourceProvider* resource_provider) {
161 if (!tiler_ || tiler_->has_empty_bounds() || 161 if (!tiler_ || tiler_->has_empty_bounds() ||
162 visible_content_rect().IsEmpty() || 162 visible_content_rect().IsEmpty() ||
163 draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE) 163 draw_mode == DRAW_MODE_RESOURCELESS_SOFTWARE)
164 return false; 164 return false;
165 return LayerImpl::WillDraw(draw_mode, resource_provider); 165 return LayerImpl::WillDraw(draw_mode, resource_provider);
166 } 166 }
167 167
168 void TiledLayerImpl::AppendQuads(RenderPass* render_pass, 168 void TiledLayerImpl::AppendQuads(RenderPass* render_pass,
169 const Occlusion& occlusion_in_content_space,
170 AppendQuadsData* append_quads_data) { 169 AppendQuadsData* append_quads_data) {
171 DCHECK(tiler_); 170 DCHECK(tiler_);
172 DCHECK(!tiler_->has_empty_bounds()); 171 DCHECK(!tiler_->has_empty_bounds());
173 DCHECK(!visible_content_rect().IsEmpty()); 172 DCHECK(!visible_content_rect().IsEmpty());
174 173
175 gfx::Rect content_rect = visible_content_rect(); 174 gfx::Rect content_rect = visible_content_rect();
176 SharedQuadState* shared_quad_state = 175 SharedQuadState* shared_quad_state =
177 render_pass->CreateAndAppendSharedQuadState(); 176 render_pass->CreateAndAppendSharedQuadState();
178 PopulateSharedQuadState(shared_quad_state); 177 PopulateSharedQuadState(shared_quad_state);
179 178
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 DrawableTile* tile = TileAt(i, j); 217 DrawableTile* tile = TileAt(i, j);
219 gfx::Rect tile_rect = tiler_->tile_bounds(i, j); 218 gfx::Rect tile_rect = tiler_->tile_bounds(i, j);
220 gfx::Rect display_rect = tile_rect; 219 gfx::Rect display_rect = tile_rect;
221 tile_rect.Intersect(content_rect); 220 tile_rect.Intersect(content_rect);
222 221
223 // Skip empty tiles. 222 // Skip empty tiles.
224 if (tile_rect.IsEmpty()) 223 if (tile_rect.IsEmpty())
225 continue; 224 continue;
226 225
227 gfx::Rect visible_tile_rect = 226 gfx::Rect visible_tile_rect =
228 occlusion_in_content_space.GetUnoccludedContentRect(tile_rect); 227 draw_properties().occlusion_in_content_space.GetUnoccludedContentRect(
228 tile_rect);
229 if (visible_tile_rect.IsEmpty()) 229 if (visible_tile_rect.IsEmpty())
230 continue; 230 continue;
231 231
232 if (!tile || !tile->resource_id()) { 232 if (!tile || !tile->resource_id()) {
233 SkColor checker_color; 233 SkColor checker_color;
234 if (ShowDebugBorders()) { 234 if (ShowDebugBorders()) {
235 checker_color = 235 checker_color =
236 tile ? DebugColors::InvalidatedTileCheckerboardColor() 236 tile ? DebugColors::InvalidatedTileCheckerboardColor()
237 : DebugColors::EvictedTileCheckerboardColor(); 237 : DebugColors::EvictedTileCheckerboardColor();
238 } else { 238 } else {
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 314
315 void TiledLayerImpl::ReleaseResources() { 315 void TiledLayerImpl::ReleaseResources() {
316 tiler_->reset(); 316 tiler_->reset();
317 } 317 }
318 318
319 const char* TiledLayerImpl::LayerTypeAsString() const { 319 const char* TiledLayerImpl::LayerTypeAsString() const {
320 return "cc::TiledLayerImpl"; 320 return "cc::TiledLayerImpl";
321 } 321 }
322 322
323 } // namespace cc 323 } // namespace cc
OLDNEW
« no previous file with comments | « cc/layers/tiled_layer_impl.h ('k') | cc/layers/tiled_layer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698