| 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" |
| 11 #include "cc/animation/scrollbar_animation_controller.h" | 11 #include "cc/animation/scrollbar_animation_controller.h" |
| 12 #include "cc/base/math_util.h" | 12 #include "cc/base/math_util.h" |
| 13 #include "cc/debug/debug_colors.h" | 13 #include "cc/debug/debug_colors.h" |
| 14 #include "cc/debug/layer_tree_debug_state.h" | 14 #include "cc/debug/layer_tree_debug_state.h" |
| 15 #include "cc/debug/micro_benchmark_impl.h" | 15 #include "cc/debug/micro_benchmark_impl.h" |
| 16 #include "cc/debug/traced_value.h" | 16 #include "cc/debug/traced_value.h" |
| 17 #include "cc/input/layer_scroll_offset_delegate.h" | 17 #include "cc/input/layer_scroll_offset_delegate.h" |
| 18 #include "cc/layers/layer_utils.h" | 18 #include "cc/layers/layer_utils.h" |
| 19 #include "cc/layers/painted_scrollbar_layer_impl.h" | 19 #include "cc/layers/painted_scrollbar_layer_impl.h" |
| 20 #include "cc/layers/quad_sink.h" | |
| 21 #include "cc/output/copy_output_request.h" | 20 #include "cc/output/copy_output_request.h" |
| 22 #include "cc/quads/debug_border_draw_quad.h" | 21 #include "cc/quads/debug_border_draw_quad.h" |
| 23 #include "cc/trees/layer_tree_host_common.h" | 22 #include "cc/trees/layer_tree_host_common.h" |
| 24 #include "cc/trees/layer_tree_impl.h" | 23 #include "cc/trees/layer_tree_impl.h" |
| 25 #include "cc/trees/layer_tree_settings.h" | 24 #include "cc/trees/layer_tree_settings.h" |
| 26 #include "cc/trees/proxy.h" | 25 #include "cc/trees/proxy.h" |
| 27 #include "ui/gfx/box_f.h" | 26 #include "ui/gfx/box_f.h" |
| 28 #include "ui/gfx/geometry/vector2d_conversions.h" | 27 #include "ui/gfx/geometry/vector2d_conversions.h" |
| 29 #include "ui/gfx/point_conversions.h" | 28 #include "ui/gfx/point_conversions.h" |
| 30 #include "ui/gfx/quad_f.h" | 29 #include "ui/gfx/quad_f.h" |
| (...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 *color = DebugColors::MaskingLayerBorderColor(); | 281 *color = DebugColors::MaskingLayerBorderColor(); |
| 283 *width = DebugColors::MaskingLayerBorderWidth(layer_tree_impl()); | 282 *width = DebugColors::MaskingLayerBorderWidth(layer_tree_impl()); |
| 284 return; | 283 return; |
| 285 } | 284 } |
| 286 | 285 |
| 287 *color = DebugColors::ContainerLayerBorderColor(); | 286 *color = DebugColors::ContainerLayerBorderColor(); |
| 288 *width = DebugColors::ContainerLayerBorderWidth(layer_tree_impl()); | 287 *width = DebugColors::ContainerLayerBorderWidth(layer_tree_impl()); |
| 289 } | 288 } |
| 290 | 289 |
| 291 void LayerImpl::AppendDebugBorderQuad( | 290 void LayerImpl::AppendDebugBorderQuad( |
| 292 QuadSink* quad_sink, | 291 RenderPass* render_pass, |
| 293 const SharedQuadState* shared_quad_state, | 292 const SharedQuadState* shared_quad_state, |
| 294 AppendQuadsData* append_quads_data) const { | 293 AppendQuadsData* append_quads_data) const { |
| 295 SkColor color; | 294 SkColor color; |
| 296 float width; | 295 float width; |
| 297 GetDebugBorderProperties(&color, &width); | 296 GetDebugBorderProperties(&color, &width); |
| 298 AppendDebugBorderQuad( | 297 AppendDebugBorderQuad( |
| 299 quad_sink, shared_quad_state, append_quads_data, color, width); | 298 render_pass, shared_quad_state, append_quads_data, color, width); |
| 300 } | 299 } |
| 301 | 300 |
| 302 void LayerImpl::AppendDebugBorderQuad(QuadSink* quad_sink, | 301 void LayerImpl::AppendDebugBorderQuad(RenderPass* render_pass, |
| 303 const SharedQuadState* shared_quad_state, | 302 const SharedQuadState* shared_quad_state, |
| 304 AppendQuadsData* append_quads_data, | 303 AppendQuadsData* append_quads_data, |
| 305 SkColor color, | 304 SkColor color, |
| 306 float width) const { | 305 float width) const { |
| 307 if (!ShowDebugBorders()) | 306 if (!ShowDebugBorders()) |
| 308 return; | 307 return; |
| 309 | 308 |
| 310 gfx::Rect quad_rect(content_bounds()); | 309 gfx::Rect quad_rect(content_bounds()); |
| 311 gfx::Rect visible_quad_rect(quad_rect); | 310 gfx::Rect visible_quad_rect(quad_rect); |
| 312 scoped_ptr<DebugBorderDrawQuad> debug_border_quad = | 311 scoped_ptr<DebugBorderDrawQuad> debug_border_quad = |
| 313 DebugBorderDrawQuad::Create(); | 312 DebugBorderDrawQuad::Create(); |
| 314 debug_border_quad->SetNew( | 313 debug_border_quad->SetNew( |
| 315 shared_quad_state, quad_rect, visible_quad_rect, color, width); | 314 shared_quad_state, quad_rect, visible_quad_rect, color, width); |
| 316 quad_sink->Append(debug_border_quad.PassAs<DrawQuad>()); | 315 render_pass->AppendDrawQuad(debug_border_quad.PassAs<DrawQuad>()); |
| 317 } | 316 } |
| 318 | 317 |
| 319 bool LayerImpl::HasDelegatedContent() const { | 318 bool LayerImpl::HasDelegatedContent() const { |
| 320 return false; | 319 return false; |
| 321 } | 320 } |
| 322 | 321 |
| 323 bool LayerImpl::HasContributingDelegatedRenderPasses() const { | 322 bool LayerImpl::HasContributingDelegatedRenderPasses() const { |
| 324 return false; | 323 return false; |
| 325 } | 324 } |
| 326 | 325 |
| (...skipping 1183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1510 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1509 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
| 1511 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1510 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 1512 AsValueInto(state.get()); | 1511 AsValueInto(state.get()); |
| 1513 return state.PassAs<base::Value>(); | 1512 return state.PassAs<base::Value>(); |
| 1514 } | 1513 } |
| 1515 | 1514 |
| 1516 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1515 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1517 benchmark->RunOnLayer(this); | 1516 benchmark->RunOnLayer(this); |
| 1518 } | 1517 } |
| 1519 } // namespace cc | 1518 } // namespace cc |
| OLD | NEW |