OLD | NEW |
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/layers/layer_impl.h" | 5 #include "cc/layers/layer_impl.h" |
6 | 6 |
7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "base/json/json_reader.h" | 8 #include "base/json/json_reader.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "cc/animation/animation_registrar.h" | 10 #include "cc/animation/animation_registrar.h" |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 return LayerImpl::Create(tree_impl, layer_id_); | 496 return LayerImpl::Create(tree_impl, layer_id_); |
497 } | 497 } |
498 | 498 |
499 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { | 499 void LayerImpl::PushPropertiesTo(LayerImpl* layer) { |
500 layer->SetAnchorPoint(anchor_point_); | 500 layer->SetAnchorPoint(anchor_point_); |
501 layer->SetAnchorPointZ(anchor_point_z_); | 501 layer->SetAnchorPointZ(anchor_point_z_); |
502 layer->SetBackgroundColor(background_color_); | 502 layer->SetBackgroundColor(background_color_); |
503 layer->SetBounds(bounds_); | 503 layer->SetBounds(bounds_); |
504 layer->SetContentBounds(content_bounds()); | 504 layer->SetContentBounds(content_bounds()); |
505 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); | 505 layer->SetContentsScale(contents_scale_x(), contents_scale_y()); |
506 layer->SetDebugName(debug_name_); | |
507 layer->SetDoubleSided(double_sided_); | 506 layer->SetDoubleSided(double_sided_); |
508 layer->SetDrawCheckerboardForMissingTiles( | 507 layer->SetDrawCheckerboardForMissingTiles( |
509 draw_checkerboard_for_missing_tiles_); | 508 draw_checkerboard_for_missing_tiles_); |
510 layer->SetForceRenderSurface(force_render_surface_); | 509 layer->SetForceRenderSurface(force_render_surface_); |
511 layer->SetDrawsContent(DrawsContent()); | 510 layer->SetDrawsContent(DrawsContent()); |
512 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); | 511 layer->SetHideLayerAndSubtree(hide_layer_and_subtree_); |
513 layer->SetFilters(filters()); | 512 layer->SetFilters(filters()); |
514 layer->SetBackgroundFilters(background_filters()); | 513 layer->SetBackgroundFilters(background_filters()); |
515 layer->SetMasksToBounds(masks_to_bounds_); | 514 layer->SetMasksToBounds(masks_to_bounds_); |
516 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); | 515 layer->SetShouldScrollOnMainThread(should_scroll_on_main_thread_); |
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1187 void LayerImpl::SetVerticalScrollbarLayer( | 1186 void LayerImpl::SetVerticalScrollbarLayer( |
1188 ScrollbarLayerImplBase* scrollbar_layer) { | 1187 ScrollbarLayerImplBase* scrollbar_layer) { |
1189 vertical_scrollbar_layer_ = scrollbar_layer; | 1188 vertical_scrollbar_layer_ = scrollbar_layer; |
1190 if (vertical_scrollbar_layer_) | 1189 if (vertical_scrollbar_layer_) |
1191 vertical_scrollbar_layer_->set_scroll_layer_id(id()); | 1190 vertical_scrollbar_layer_->set_scroll_layer_id(id()); |
1192 } | 1191 } |
1193 | 1192 |
1194 void LayerImpl::AsValueInto(base::DictionaryValue* state) const { | 1193 void LayerImpl::AsValueInto(base::DictionaryValue* state) const { |
1195 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this); | 1194 TracedValue::MakeDictIntoImplicitSnapshot(state, LayerTypeAsString(), this); |
1196 state->SetInteger("layer_id", id()); | 1195 state->SetInteger("layer_id", id()); |
1197 state->SetString("layer_name", debug_name()); | |
1198 state->Set("bounds", MathUtil::AsValue(bounds()).release()); | 1196 state->Set("bounds", MathUtil::AsValue(bounds()).release()); |
1199 state->SetInteger("draws_content", DrawsContent()); | 1197 state->SetInteger("draws_content", DrawsContent()); |
1200 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 1198 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); |
1201 | 1199 |
1202 bool clipped; | 1200 bool clipped; |
1203 gfx::QuadF layer_quad = MathUtil::MapQuad( | 1201 gfx::QuadF layer_quad = MathUtil::MapQuad( |
1204 screen_space_transform(), | 1202 screen_space_transform(), |
1205 gfx::QuadF(gfx::Rect(content_bounds())), | 1203 gfx::QuadF(gfx::Rect(content_bounds())), |
1206 &clipped); | 1204 &clipped); |
1207 state->Set("layer_quad", MathUtil::AsValue(layer_quad).release()); | 1205 state->Set("layer_quad", MathUtil::AsValue(layer_quad).release()); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1269 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
1272 AsValueInto(state.get()); | 1270 AsValueInto(state.get()); |
1273 return state.PassAs<base::Value>(); | 1271 return state.PassAs<base::Value>(); |
1274 } | 1272 } |
1275 | 1273 |
1276 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1274 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
1277 benchmark->RunOnLayer(this); | 1275 benchmark->RunOnLayer(this); |
1278 } | 1276 } |
1279 | 1277 |
1280 } // namespace cc | 1278 } // namespace cc |
OLD | NEW |