| 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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| 11 #include "base/debug/trace_event_argument.h" | 11 #include "base/debug/trace_event_argument.h" |
| 12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
| 13 #include "cc/debug/debug_colors.h" | 13 #include "cc/debug/debug_colors.h" |
| 14 #include "cc/debug/frame_rate_counter.h" | 14 #include "cc/debug/frame_rate_counter.h" |
| 15 #include "cc/debug/paint_time_counter.h" | 15 #include "cc/debug/paint_time_counter.h" |
| 16 #include "cc/output/begin_frame_args.h" |
| 16 #include "cc/output/renderer.h" | 17 #include "cc/output/renderer.h" |
| 17 #include "cc/quads/texture_draw_quad.h" | 18 #include "cc/quads/texture_draw_quad.h" |
| 18 #include "cc/resources/memory_history.h" | 19 #include "cc/resources/memory_history.h" |
| 19 #include "cc/trees/layer_tree_impl.h" | 20 #include "cc/trees/layer_tree_impl.h" |
| 20 #include "skia/ext/platform_canvas.h" | 21 #include "skia/ext/platform_canvas.h" |
| 21 #include "third_party/khronos/GLES2/gl2.h" | 22 #include "third_party/khronos/GLES2/gl2.h" |
| 22 #include "third_party/khronos/GLES2/gl2ext.h" | 23 #include "third_party/khronos/GLES2/gl2ext.h" |
| 23 #include "third_party/skia/include/core/SkBitmap.h" | 24 #include "third_party/skia/include/core/SkBitmap.h" |
| 24 #include "third_party/skia/include/core/SkPaint.h" | 25 #include "third_party/skia/include/core/SkPaint.h" |
| 25 #include "third_party/skia/include/core/SkTypeface.h" | 26 #include "third_party/skia/include/core/SkTypeface.h" |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 content_rect, | 186 content_rect, |
| 186 gfx::Vector2d()); | 187 gfx::Vector2d()); |
| 187 } | 188 } |
| 188 | 189 |
| 189 void HeadsUpDisplayLayerImpl::ReleaseResources() { hud_resource_.reset(); } | 190 void HeadsUpDisplayLayerImpl::ReleaseResources() { hud_resource_.reset(); } |
| 190 | 191 |
| 191 void HeadsUpDisplayLayerImpl::UpdateHudContents() { | 192 void HeadsUpDisplayLayerImpl::UpdateHudContents() { |
| 192 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); | 193 const LayerTreeDebugState& debug_state = layer_tree_impl()->debug_state(); |
| 193 | 194 |
| 194 // Don't update numbers every frame so text is readable. | 195 // Don't update numbers every frame so text is readable. |
| 195 base::TimeTicks now = layer_tree_impl()->CurrentFrameTimeTicks(); | 196 base::TimeTicks now = layer_tree_impl()->CurrentBeginFrameArgs().frame_time; |
| 196 if (base::TimeDelta(now - time_of_last_graph_update_).InSecondsF() > 0.25f) { | 197 if (base::TimeDelta(now - time_of_last_graph_update_).InSecondsF() > 0.25f) { |
| 197 time_of_last_graph_update_ = now; | 198 time_of_last_graph_update_ = now; |
| 198 | 199 |
| 199 if (debug_state.show_fps_counter) { | 200 if (debug_state.show_fps_counter) { |
| 200 FrameRateCounter* fps_counter = layer_tree_impl()->frame_rate_counter(); | 201 FrameRateCounter* fps_counter = layer_tree_impl()->frame_rate_counter(); |
| 201 fps_graph_.value = fps_counter->GetAverageFPS(); | 202 fps_graph_.value = fps_counter->GetAverageFPS(); |
| 202 fps_counter->GetMinAndMaxFPS(&fps_graph_.min, &fps_graph_.max); | 203 fps_counter->GetMinAndMaxFPS(&fps_graph_.min, &fps_graph_.max); |
| 203 } | 204 } |
| 204 | 205 |
| 205 if (debug_state.continuous_painting) { | 206 if (debug_state.continuous_painting) { |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 762 return "cc::HeadsUpDisplayLayerImpl"; | 763 return "cc::HeadsUpDisplayLayerImpl"; |
| 763 } | 764 } |
| 764 | 765 |
| 765 void HeadsUpDisplayLayerImpl::AsValueInto( | 766 void HeadsUpDisplayLayerImpl::AsValueInto( |
| 766 base::debug::TracedValue* dict) const { | 767 base::debug::TracedValue* dict) const { |
| 767 LayerImpl::AsValueInto(dict); | 768 LayerImpl::AsValueInto(dict); |
| 768 dict->SetString("layer_name", "Heads Up Display Layer"); | 769 dict->SetString("layer_name", "Heads Up Display Layer"); |
| 769 } | 770 } |
| 770 | 771 |
| 771 } // namespace cc | 772 } // namespace cc |
| OLD | NEW |