OLD | NEW |
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/debug/trace_event_argument.h" | |
9 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
10 #include "cc/base/math_util.h" | 9 #include "cc/base/math_util.h" |
11 #include "cc/debug/debug_colors.h" | 10 #include "cc/debug/debug_colors.h" |
12 #include "cc/layers/append_quads_data.h" | 11 #include "cc/layers/append_quads_data.h" |
13 #include "cc/quads/checkerboard_draw_quad.h" | 12 #include "cc/quads/checkerboard_draw_quad.h" |
14 #include "cc/quads/debug_border_draw_quad.h" | 13 #include "cc/quads/debug_border_draw_quad.h" |
15 #include "cc/quads/solid_color_draw_quad.h" | 14 #include "cc/quads/solid_color_draw_quad.h" |
16 #include "cc/quads/tile_draw_quad.h" | 15 #include "cc/quads/tile_draw_quad.h" |
17 #include "cc/resources/layer_tiling_data.h" | 16 #include "cc/resources/layer_tiling_data.h" |
18 #include "cc/trees/occlusion_tracker.h" | 17 #include "cc/trees/occlusion_tracker.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 float* width) const { | 92 float* width) const { |
94 *color = DebugColors::TiledContentLayerBorderColor(); | 93 *color = DebugColors::TiledContentLayerBorderColor(); |
95 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); | 94 *width = DebugColors::TiledContentLayerBorderWidth(layer_tree_impl()); |
96 } | 95 } |
97 | 96 |
98 scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl( | 97 scoped_ptr<LayerImpl> TiledLayerImpl::CreateLayerImpl( |
99 LayerTreeImpl* tree_impl) { | 98 LayerTreeImpl* tree_impl) { |
100 return TiledLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 99 return TiledLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
101 } | 100 } |
102 | 101 |
103 void TiledLayerImpl::AsValueInto(base::debug::TracedValue* state) const { | 102 void TiledLayerImpl::AsValueInto(base::DictionaryValue* state) const { |
104 LayerImpl::AsValueInto(state); | 103 LayerImpl::AsValueInto(state); |
105 state->BeginArray("invalidation"); | 104 state->Set("invalidation", MathUtil::AsValue(update_rect()).release()); |
106 MathUtil::AddToTracedValue(update_rect(), state); | |
107 state->EndArray(); | |
108 } | 105 } |
109 | 106 |
110 size_t TiledLayerImpl::GPUMemoryUsageInBytes() const { | 107 size_t TiledLayerImpl::GPUMemoryUsageInBytes() const { |
111 size_t amount = 0; | 108 size_t amount = 0; |
112 const size_t kMemoryUsagePerTileInBytes = | 109 const size_t kMemoryUsagePerTileInBytes = |
113 4 * tiler_->tile_size().width() * tiler_->tile_size().height(); | 110 4 * tiler_->tile_size().width() * tiler_->tile_size().height(); |
114 for (LayerTilingData::TileMap::const_iterator iter = tiler_->tiles().begin(); | 111 for (LayerTilingData::TileMap::const_iterator iter = tiler_->tiles().begin(); |
115 iter != tiler_->tiles().end(); | 112 iter != tiler_->tiles().end(); |
116 ++iter) { | 113 ++iter) { |
117 const DrawableTile* tile = static_cast<DrawableTile*>(iter->second); | 114 const DrawableTile* tile = static_cast<DrawableTile*>(iter->second); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 | 308 |
312 void TiledLayerImpl::ReleaseResources() { | 309 void TiledLayerImpl::ReleaseResources() { |
313 tiler_->reset(); | 310 tiler_->reset(); |
314 } | 311 } |
315 | 312 |
316 const char* TiledLayerImpl::LayerTypeAsString() const { | 313 const char* TiledLayerImpl::LayerTypeAsString() const { |
317 return "cc::TiledLayerImpl"; | 314 return "cc::TiledLayerImpl"; |
318 } | 315 } |
319 | 316 |
320 } // namespace cc | 317 } // namespace cc |
OLD | NEW |