| 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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 *color = DebugColors::MaskingLayerBorderColor(); | 280 *color = DebugColors::MaskingLayerBorderColor(); |
| 282 *width = DebugColors::MaskingLayerBorderWidth(layer_tree_impl()); | 281 *width = DebugColors::MaskingLayerBorderWidth(layer_tree_impl()); |
| 283 return; | 282 return; |
| 284 } | 283 } |
| 285 | 284 |
| 286 *color = DebugColors::ContainerLayerBorderColor(); | 285 *color = DebugColors::ContainerLayerBorderColor(); |
| 287 *width = DebugColors::ContainerLayerBorderWidth(layer_tree_impl()); | 286 *width = DebugColors::ContainerLayerBorderWidth(layer_tree_impl()); |
| 288 } | 287 } |
| 289 | 288 |
| 290 void LayerImpl::AppendDebugBorderQuad( | 289 void LayerImpl::AppendDebugBorderQuad( |
| 291 QuadSink* quad_sink, | 290 RenderPass* render_pass, |
| 292 const gfx::Size& content_bounds, | 291 const gfx::Size& content_bounds, |
| 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(quad_sink, | 297 AppendDebugBorderQuad(render_pass, |
| 299 content_bounds, | 298 content_bounds, |
| 300 shared_quad_state, | 299 shared_quad_state, |
| 301 append_quads_data, | 300 append_quads_data, |
| 302 color, | 301 color, |
| 303 width); | 302 width); |
| 304 } | 303 } |
| 305 | 304 |
| 306 void LayerImpl::AppendDebugBorderQuad(QuadSink* quad_sink, | 305 void LayerImpl::AppendDebugBorderQuad(RenderPass* render_pass, |
| 307 const gfx::Size& content_bounds, | 306 const gfx::Size& content_bounds, |
| 308 const SharedQuadState* shared_quad_state, | 307 const SharedQuadState* shared_quad_state, |
| 309 AppendQuadsData* append_quads_data, | 308 AppendQuadsData* append_quads_data, |
| 310 SkColor color, | 309 SkColor color, |
| 311 float width) const { | 310 float width) const { |
| 312 if (!ShowDebugBorders()) | 311 if (!ShowDebugBorders()) |
| 313 return; | 312 return; |
| 314 | 313 |
| 315 gfx::Rect quad_rect(content_bounds); | 314 gfx::Rect quad_rect(content_bounds); |
| 316 gfx::Rect visible_quad_rect(quad_rect); | 315 gfx::Rect visible_quad_rect(quad_rect); |
| 317 scoped_ptr<DebugBorderDrawQuad> debug_border_quad = | 316 scoped_ptr<DebugBorderDrawQuad> debug_border_quad = |
| 318 DebugBorderDrawQuad::Create(); | 317 DebugBorderDrawQuad::Create(); |
| 319 debug_border_quad->SetNew( | 318 debug_border_quad->SetNew( |
| 320 shared_quad_state, quad_rect, visible_quad_rect, color, width); | 319 shared_quad_state, quad_rect, visible_quad_rect, color, width); |
| 321 quad_sink->Append(debug_border_quad.PassAs<DrawQuad>()); | 320 render_pass->AppendDrawQuad(debug_border_quad.PassAs<DrawQuad>()); |
| 322 } | 321 } |
| 323 | 322 |
| 324 bool LayerImpl::HasDelegatedContent() const { | 323 bool LayerImpl::HasDelegatedContent() const { |
| 325 return false; | 324 return false; |
| 326 } | 325 } |
| 327 | 326 |
| 328 bool LayerImpl::HasContributingDelegatedRenderPasses() const { | 327 bool LayerImpl::HasContributingDelegatedRenderPasses() const { |
| 329 return false; | 328 return false; |
| 330 } | 329 } |
| 331 | 330 |
| (...skipping 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1487 scoped_ptr<base::Value> LayerImpl::AsValue() const { | 1486 scoped_ptr<base::Value> LayerImpl::AsValue() const { |
| 1488 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); | 1487 scoped_ptr<base::DictionaryValue> state(new base::DictionaryValue()); |
| 1489 AsValueInto(state.get()); | 1488 AsValueInto(state.get()); |
| 1490 return state.PassAs<base::Value>(); | 1489 return state.PassAs<base::Value>(); |
| 1491 } | 1490 } |
| 1492 | 1491 |
| 1493 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { | 1492 void LayerImpl::RunMicroBenchmark(MicroBenchmarkImpl* benchmark) { |
| 1494 benchmark->RunOnLayer(this); | 1493 benchmark->RunOnLayer(this); |
| 1495 } | 1494 } |
| 1496 } // namespace cc | 1495 } // namespace cc |
| OLD | NEW |