| 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 #ifndef CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 6 #define CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 | 25 |
| 26 class FrameRateCounter; | 26 class FrameRateCounter; |
| 27 class PaintTimeCounter; | 27 class PaintTimeCounter; |
| 28 | 28 |
| 29 class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { | 29 class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { |
| 30 public: | 30 public: |
| 31 static scoped_ptr<HeadsUpDisplayLayerImpl> Create(LayerTreeImpl* tree_impl, | 31 static scoped_ptr<HeadsUpDisplayLayerImpl> Create(LayerTreeImpl* tree_impl, |
| 32 int id) { | 32 int id) { |
| 33 return make_scoped_ptr(new HeadsUpDisplayLayerImpl(tree_impl, id)); | 33 return make_scoped_ptr(new HeadsUpDisplayLayerImpl(tree_impl, id)); |
| 34 } | 34 } |
| 35 virtual ~HeadsUpDisplayLayerImpl(); | 35 ~HeadsUpDisplayLayerImpl() override; |
| 36 | 36 |
| 37 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 37 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 38 override; | |
| 39 | 38 |
| 40 virtual bool WillDraw(DrawMode draw_mode, | 39 bool WillDraw(DrawMode draw_mode, |
| 41 ResourceProvider* resource_provider) override; | 40 ResourceProvider* resource_provider) override; |
| 42 virtual void AppendQuads(RenderPass* render_pass, | 41 void AppendQuads(RenderPass* render_pass, |
| 43 const Occlusion& occlusion_in_content_space, | 42 const Occlusion& occlusion_in_content_space, |
| 44 AppendQuadsData* append_quads_data) override; | 43 AppendQuadsData* append_quads_data) override; |
| 45 void UpdateHudTexture(DrawMode draw_mode, | 44 void UpdateHudTexture(DrawMode draw_mode, |
| 46 ResourceProvider* resource_provider); | 45 ResourceProvider* resource_provider); |
| 47 | 46 |
| 48 virtual void ReleaseResources() override; | 47 void ReleaseResources() override; |
| 49 | 48 |
| 50 bool IsAnimatingHUDContents() const { return fade_step_ > 0; } | 49 bool IsAnimatingHUDContents() const { return fade_step_ > 0; } |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 class Graph { | 52 class Graph { |
| 54 public: | 53 public: |
| 55 Graph(double indicator_value, double start_upper_bound); | 54 Graph(double indicator_value, double start_upper_bound); |
| 56 | 55 |
| 57 // Eases the upper bound, which limits what is currently visible in the | 56 // Eases the upper bound, which limits what is currently visible in the |
| 58 // graph, so that the graph always scales to either it's max or | 57 // graph, so that the graph always scales to either it's max or |
| 59 // default_upper_bound. | 58 // default_upper_bound. |
| 60 double UpdateUpperBound(); | 59 double UpdateUpperBound(); |
| 61 | 60 |
| 62 double value; | 61 double value; |
| 63 double min; | 62 double min; |
| 64 double max; | 63 double max; |
| 65 | 64 |
| 66 double current_upper_bound; | 65 double current_upper_bound; |
| 67 const double default_upper_bound; | 66 const double default_upper_bound; |
| 68 const double indicator; | 67 const double indicator; |
| 69 }; | 68 }; |
| 70 | 69 |
| 71 HeadsUpDisplayLayerImpl(LayerTreeImpl* tree_impl, int id); | 70 HeadsUpDisplayLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 72 | 71 |
| 73 virtual const char* LayerTypeAsString() const override; | 72 const char* LayerTypeAsString() const override; |
| 74 | 73 |
| 75 virtual void AsValueInto(base::debug::TracedValue* dict) const override; | 74 void AsValueInto(base::debug::TracedValue* dict) const override; |
| 76 | 75 |
| 77 void UpdateHudContents(); | 76 void UpdateHudContents(); |
| 78 void DrawHudContents(SkCanvas* canvas); | 77 void DrawHudContents(SkCanvas* canvas); |
| 79 | 78 |
| 80 void DrawText(SkCanvas* canvas, | 79 void DrawText(SkCanvas* canvas, |
| 81 SkPaint* paint, | 80 SkPaint* paint, |
| 82 const std::string& text, | 81 const std::string& text, |
| 83 SkPaint::Align align, | 82 SkPaint::Align align, |
| 84 int size, | 83 int size, |
| 85 int x, | 84 int x, |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 std::vector<DebugRect> paint_rects_; | 133 std::vector<DebugRect> paint_rects_; |
| 135 | 134 |
| 136 base::TimeTicks time_of_last_graph_update_; | 135 base::TimeTicks time_of_last_graph_update_; |
| 137 | 136 |
| 138 DISALLOW_COPY_AND_ASSIGN(HeadsUpDisplayLayerImpl); | 137 DISALLOW_COPY_AND_ASSIGN(HeadsUpDisplayLayerImpl); |
| 139 }; | 138 }; |
| 140 | 139 |
| 141 } // namespace cc | 140 } // namespace cc |
| 142 | 141 |
| 143 #endif // CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 142 #endif // CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| OLD | NEW |