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/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/numerics/safe_conversions.h" |
8 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
9 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
10 #include "base/trace_event/trace_event_argument.h" | 11 #include "base/trace_event/trace_event_argument.h" |
11 #include "cc/animation/animation_registrar.h" | 12 #include "cc/animation/animation_registrar.h" |
12 #include "cc/animation/scrollbar_animation_controller.h" | 13 #include "cc/animation/scrollbar_animation_controller.h" |
13 #include "cc/base/math_util.h" | 14 #include "cc/base/math_util.h" |
14 #include "cc/base/simple_enclosed_region.h" | 15 #include "cc/base/simple_enclosed_region.h" |
15 #include "cc/debug/debug_colors.h" | 16 #include "cc/debug/debug_colors.h" |
16 #include "cc/debug/layer_tree_debug_state.h" | 17 #include "cc/debug/layer_tree_debug_state.h" |
17 #include "cc/debug/micro_benchmark_impl.h" | 18 #include "cc/debug/micro_benchmark_impl.h" |
(...skipping 1497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1515 LayerTypeAsString(), | 1516 LayerTypeAsString(), |
1516 this); | 1517 this); |
1517 state->SetInteger("layer_id", id()); | 1518 state->SetInteger("layer_id", id()); |
1518 MathUtil::AddToTracedValue("bounds", bounds_, state); | 1519 MathUtil::AddToTracedValue("bounds", bounds_, state); |
1519 | 1520 |
1520 state->SetDouble("opacity", opacity()); | 1521 state->SetDouble("opacity", opacity()); |
1521 | 1522 |
1522 MathUtil::AddToTracedValue("position", position_, state); | 1523 MathUtil::AddToTracedValue("position", position_, state); |
1523 | 1524 |
1524 state->SetInteger("draws_content", DrawsContent()); | 1525 state->SetInteger("draws_content", DrawsContent()); |
1525 state->SetInteger("gpu_memory_usage", GPUMemoryUsageInBytes()); | 1526 state->SetInteger("gpu_memory_usage", |
| 1527 base::saturated_cast<int>(GPUMemoryUsageInBytes())); |
1526 | 1528 |
1527 MathUtil::AddToTracedValue( | 1529 MathUtil::AddToTracedValue( |
1528 "scroll_offset", scroll_offset_ ? scroll_offset_->Current(IsActive()) | 1530 "scroll_offset", scroll_offset_ ? scroll_offset_->Current(IsActive()) |
1529 : gfx::ScrollOffset(), | 1531 : gfx::ScrollOffset(), |
1530 state); | 1532 state); |
1531 | 1533 |
1532 MathUtil::AddToTracedValue("transform_origin", transform_origin_, state); | 1534 MathUtil::AddToTracedValue("transform_origin", transform_origin_, state); |
1533 | 1535 |
1534 bool clipped; | 1536 bool clipped; |
1535 gfx::QuadF layer_quad = MathUtil::MapQuad( | 1537 gfx::QuadF layer_quad = MathUtil::MapQuad( |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1682 gfx::Transform scaled_draw_transform = | 1684 gfx::Transform scaled_draw_transform = |
1683 draw_properties_.target_space_transform; | 1685 draw_properties_.target_space_transform; |
1684 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); | 1686 scaled_draw_transform.Scale(SK_MScalar1 / scale, SK_MScalar1 / scale); |
1685 gfx::Size scaled_content_bounds = | 1687 gfx::Size scaled_content_bounds = |
1686 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); | 1688 gfx::ToCeiledSize(gfx::ScaleSize(content_bounds(), scale)); |
1687 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, | 1689 return MathUtil::MapEnclosingClippedRect(scaled_draw_transform, |
1688 gfx::Rect(scaled_content_bounds)); | 1690 gfx::Rect(scaled_content_bounds)); |
1689 } | 1691 } |
1690 | 1692 |
1691 } // namespace cc | 1693 } // namespace cc |
OLD | NEW |