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/debug/layer_tree_debug_state.h" | 5 #include "cc/debug/layer_tree_debug_state.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace cc { | 9 namespace cc { |
10 | 10 |
11 // IMPORTANT: new fields must be added to Equal() and Unite() | 11 // IMPORTANT: new fields must be added to Equal() and Unite() |
12 LayerTreeDebugState::LayerTreeDebugState() | 12 LayerTreeDebugState::LayerTreeDebugState() |
13 : show_fps_counter(false), | 13 : show_fps_counter(false), |
14 show_debug_borders(false), | 14 show_debug_borders(false), |
15 continuous_painting(false), | |
16 show_paint_rects(false), | 15 show_paint_rects(false), |
17 show_property_changed_rects(false), | 16 show_property_changed_rects(false), |
18 show_surface_damage_rects(false), | 17 show_surface_damage_rects(false), |
19 show_screen_space_rects(false), | 18 show_screen_space_rects(false), |
20 show_replica_screen_space_rects(false), | 19 show_replica_screen_space_rects(false), |
21 show_touch_event_handler_rects(false), | 20 show_touch_event_handler_rects(false), |
22 show_wheel_event_handler_rects(false), | 21 show_wheel_event_handler_rects(false), |
23 show_scroll_event_handler_rects(false), | 22 show_scroll_event_handler_rects(false), |
24 show_non_fast_scrollable_rects(false), | 23 show_non_fast_scrollable_rects(false), |
25 show_layer_animation_bounds_rects(false), | 24 show_layer_animation_bounds_rects(false), |
26 slow_down_raster_scale_factor(0), | 25 slow_down_raster_scale_factor(0), |
27 rasterize_only_visible_content(false), | 26 rasterize_only_visible_content(false), |
28 show_picture_borders(false), | 27 show_picture_borders(false), |
29 record_rendering_stats_(false) {} | 28 record_rendering_stats_(false) {} |
30 | 29 |
31 LayerTreeDebugState::~LayerTreeDebugState() {} | 30 LayerTreeDebugState::~LayerTreeDebugState() {} |
32 | 31 |
33 void LayerTreeDebugState::SetRecordRenderingStats(bool enabled) { | 32 void LayerTreeDebugState::SetRecordRenderingStats(bool enabled) { |
34 record_rendering_stats_ = enabled; | 33 record_rendering_stats_ = enabled; |
35 } | 34 } |
36 | 35 |
37 bool LayerTreeDebugState::RecordRenderingStats() const { | 36 bool LayerTreeDebugState::RecordRenderingStats() const { |
38 return record_rendering_stats_ || continuous_painting; | 37 return record_rendering_stats_; |
39 } | 38 } |
40 | 39 |
41 bool LayerTreeDebugState::ShowHudInfo() const { | 40 bool LayerTreeDebugState::ShowHudInfo() const { |
42 return show_fps_counter || continuous_painting || | 41 return show_fps_counter || ShowHudRects(); |
43 ShowHudRects(); | |
44 } | 42 } |
45 | 43 |
46 bool LayerTreeDebugState::ShowHudRects() const { | 44 bool LayerTreeDebugState::ShowHudRects() const { |
47 return show_paint_rects || show_property_changed_rects || | 45 return show_paint_rects || show_property_changed_rects || |
48 show_surface_damage_rects || show_screen_space_rects || | 46 show_surface_damage_rects || show_screen_space_rects || |
49 show_replica_screen_space_rects || show_touch_event_handler_rects || | 47 show_replica_screen_space_rects || show_touch_event_handler_rects || |
50 show_wheel_event_handler_rects || show_scroll_event_handler_rects || | 48 show_wheel_event_handler_rects || show_scroll_event_handler_rects || |
51 show_non_fast_scrollable_rects || show_layer_animation_bounds_rects; | 49 show_non_fast_scrollable_rects || show_layer_animation_bounds_rects; |
52 } | 50 } |
53 | 51 |
54 bool LayerTreeDebugState::ShowMemoryStats() const { | 52 bool LayerTreeDebugState::ShowMemoryStats() const { |
55 return show_fps_counter || continuous_painting; | 53 return show_fps_counter; |
56 } | 54 } |
57 | 55 |
58 bool LayerTreeDebugState::Equal(const LayerTreeDebugState& a, | 56 bool LayerTreeDebugState::Equal(const LayerTreeDebugState& a, |
59 const LayerTreeDebugState& b) { | 57 const LayerTreeDebugState& b) { |
60 return ( | 58 return ( |
61 a.show_fps_counter == b.show_fps_counter && | 59 a.show_fps_counter == b.show_fps_counter && |
62 a.show_debug_borders == b.show_debug_borders && | 60 a.show_debug_borders == b.show_debug_borders && |
63 a.continuous_painting == b.continuous_painting && | |
64 a.show_paint_rects == b.show_paint_rects && | 61 a.show_paint_rects == b.show_paint_rects && |
65 a.show_property_changed_rects == b.show_property_changed_rects && | 62 a.show_property_changed_rects == b.show_property_changed_rects && |
66 a.show_surface_damage_rects == b.show_surface_damage_rects && | 63 a.show_surface_damage_rects == b.show_surface_damage_rects && |
67 a.show_screen_space_rects == b.show_screen_space_rects && | 64 a.show_screen_space_rects == b.show_screen_space_rects && |
68 a.show_replica_screen_space_rects == b.show_replica_screen_space_rects && | 65 a.show_replica_screen_space_rects == b.show_replica_screen_space_rects && |
69 a.show_touch_event_handler_rects == b.show_touch_event_handler_rects && | 66 a.show_touch_event_handler_rects == b.show_touch_event_handler_rects && |
70 a.show_wheel_event_handler_rects == b.show_wheel_event_handler_rects && | 67 a.show_wheel_event_handler_rects == b.show_wheel_event_handler_rects && |
71 a.show_scroll_event_handler_rects == b.show_scroll_event_handler_rects && | 68 a.show_scroll_event_handler_rects == b.show_scroll_event_handler_rects && |
72 a.show_non_fast_scrollable_rects == b.show_non_fast_scrollable_rects && | 69 a.show_non_fast_scrollable_rects == b.show_non_fast_scrollable_rects && |
73 a.show_layer_animation_bounds_rects == | 70 a.show_layer_animation_bounds_rects == |
74 b.show_layer_animation_bounds_rects && | 71 b.show_layer_animation_bounds_rects && |
75 a.slow_down_raster_scale_factor == b.slow_down_raster_scale_factor && | 72 a.slow_down_raster_scale_factor == b.slow_down_raster_scale_factor && |
76 a.rasterize_only_visible_content == b.rasterize_only_visible_content && | 73 a.rasterize_only_visible_content == b.rasterize_only_visible_content && |
77 a.show_picture_borders == b.show_picture_borders && | 74 a.show_picture_borders == b.show_picture_borders && |
78 a.record_rendering_stats_ == b.record_rendering_stats_); | 75 a.record_rendering_stats_ == b.record_rendering_stats_); |
79 } | 76 } |
80 | 77 |
81 LayerTreeDebugState LayerTreeDebugState::Unite(const LayerTreeDebugState& a, | 78 LayerTreeDebugState LayerTreeDebugState::Unite(const LayerTreeDebugState& a, |
82 const LayerTreeDebugState& b) { | 79 const LayerTreeDebugState& b) { |
83 LayerTreeDebugState r(a); | 80 LayerTreeDebugState r(a); |
84 | 81 |
85 r.show_fps_counter |= b.show_fps_counter; | 82 r.show_fps_counter |= b.show_fps_counter; |
86 r.show_debug_borders |= b.show_debug_borders; | 83 r.show_debug_borders |= b.show_debug_borders; |
87 r.continuous_painting |= b.continuous_painting; | |
88 | 84 |
89 r.show_paint_rects |= b.show_paint_rects; | 85 r.show_paint_rects |= b.show_paint_rects; |
90 r.show_property_changed_rects |= b.show_property_changed_rects; | 86 r.show_property_changed_rects |= b.show_property_changed_rects; |
91 r.show_surface_damage_rects |= b.show_surface_damage_rects; | 87 r.show_surface_damage_rects |= b.show_surface_damage_rects; |
92 r.show_screen_space_rects |= b.show_screen_space_rects; | 88 r.show_screen_space_rects |= b.show_screen_space_rects; |
93 r.show_replica_screen_space_rects |= b.show_replica_screen_space_rects; | 89 r.show_replica_screen_space_rects |= b.show_replica_screen_space_rects; |
94 r.show_touch_event_handler_rects |= b.show_touch_event_handler_rects; | 90 r.show_touch_event_handler_rects |= b.show_touch_event_handler_rects; |
95 r.show_wheel_event_handler_rects |= b.show_wheel_event_handler_rects; | 91 r.show_wheel_event_handler_rects |= b.show_wheel_event_handler_rects; |
96 r.show_scroll_event_handler_rects |= b.show_scroll_event_handler_rects; | 92 r.show_scroll_event_handler_rects |= b.show_scroll_event_handler_rects; |
97 r.show_non_fast_scrollable_rects |= b.show_non_fast_scrollable_rects; | 93 r.show_non_fast_scrollable_rects |= b.show_non_fast_scrollable_rects; |
98 r.show_layer_animation_bounds_rects |= b.show_layer_animation_bounds_rects; | 94 r.show_layer_animation_bounds_rects |= b.show_layer_animation_bounds_rects; |
99 | 95 |
100 if (b.slow_down_raster_scale_factor) | 96 if (b.slow_down_raster_scale_factor) |
101 r.slow_down_raster_scale_factor = b.slow_down_raster_scale_factor; | 97 r.slow_down_raster_scale_factor = b.slow_down_raster_scale_factor; |
102 r.rasterize_only_visible_content |= b.rasterize_only_visible_content; | 98 r.rasterize_only_visible_content |= b.rasterize_only_visible_content; |
103 r.show_picture_borders |= b.show_picture_borders; | 99 r.show_picture_borders |= b.show_picture_borders; |
104 | 100 |
105 r.record_rendering_stats_ |= b.record_rendering_stats_; | 101 r.record_rendering_stats_ |= b.record_rendering_stats_; |
106 | 102 |
107 return r; | 103 return r; |
108 } | 104 } |
109 | 105 |
110 } // namespace cc | 106 } // namespace cc |
OLD | NEW |