| 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/heads_up_display_layer_impl.h" | 5 #include "cc/layers/heads_up_display_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 } | 181 } |
| 182 | 182 |
| 183 void HeadsUpDisplayLayerImpl::DidLoseOutputSurface() { hud_resource_.reset(); } | 183 void HeadsUpDisplayLayerImpl::DidLoseOutputSurface() { hud_resource_.reset(); } |
| 184 | 184 |
| 185 bool HeadsUpDisplayLayerImpl::LayerIsAlwaysDamaged() const { return true; } | 185 bool HeadsUpDisplayLayerImpl::LayerIsAlwaysDamaged() const { return true; } |
| 186 | 186 |
| 187 void HeadsUpDisplayLayerImpl::UpdateHudContents() { | 187 void HeadsUpDisplayLayerImpl::UpdateHudContents() { |
| 188 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); | 188 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); |
| 189 | 189 |
| 190 // Don't update numbers every frame so text is readable. | 190 // Don't update numbers every frame so text is readable. |
| 191 base::TimeTicks now = layer_tree_impl()->CurrentFrameTimeTicks(); | 191 gfx::FrameTime frame_time = layer_tree_impl()->CurrentFrameTimeTicks(); |
| 192 if (base::TimeDelta(now - time_of_last_graph_update_).InSecondsF() > 0.25f) { | 192 if ((frame_time - time_of_last_graph_update_).InSecondsF() > 0.25f) { |
| 193 time_of_last_graph_update_ = now; | 193 time_of_last_graph_update_ = frame_time; |
| 194 | 194 |
| 195 if (debug_state.show_fps_counter) { | 195 if (debug_state.show_fps_counter) { |
| 196 FrameRateCounter* fps_counter = layer_tree_impl()->frame_rate_counter(); | 196 FrameRateCounter* fps_counter = layer_tree_impl()->frame_rate_counter(); |
| 197 fps_graph_.value = fps_counter->GetAverageFPS(); | 197 fps_graph_.value = fps_counter->GetAverageFPS(); |
| 198 fps_counter->GetMinAndMaxFPS(&fps_graph_.min, &fps_graph_.max); | 198 fps_counter->GetMinAndMaxFPS(&fps_graph_.min, &fps_graph_.max); |
| 199 } | 199 } |
| 200 | 200 |
| 201 if (debug_state.continuous_painting) { | 201 if (debug_state.continuous_painting) { |
| 202 PaintTimeCounter* paint_time_counter = | 202 PaintTimeCounter* paint_time_counter = |
| 203 layer_tree_impl()->paint_time_counter(); | 203 layer_tree_impl()->paint_time_counter(); |
| (...skipping 493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 canvas->restore(); | 697 canvas->restore(); |
| 698 } | 698 } |
| 699 } | 699 } |
| 700 } | 700 } |
| 701 | 701 |
| 702 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { | 702 const char* HeadsUpDisplayLayerImpl::LayerTypeAsString() const { |
| 703 return "cc::HeadsUpDisplayLayerImpl"; | 703 return "cc::HeadsUpDisplayLayerImpl"; |
| 704 } | 704 } |
| 705 | 705 |
| 706 } // namespace cc | 706 } // namespace cc |
| OLD | NEW |