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 <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ptr_util.h" | 13 #include "base/memory/ptr_util.h" |
14 #include "base/time/time.h" | 14 #include "base/time/time.h" |
15 #include "cc/base/cc_export.h" | 15 #include "cc/base/cc_export.h" |
16 #include "cc/debug/debug_rect_history.h" | 16 #include "cc/debug/debug_rect_history.h" |
17 #include "cc/layers/layer_impl.h" | 17 #include "cc/layers/layer_impl.h" |
18 #include "cc/resources/memory_history.h" | 18 #include "cc/resources/memory_history.h" |
19 #include "cc/resources/scoped_resource.h" | 19 #include "cc/resources/scoped_resource.h" |
| 20 #include "third_party/skia/include/core/SkRefCnt.h" |
20 | 21 |
21 class SkCanvas; | 22 class SkCanvas; |
22 class SkPaint; | 23 class SkPaint; |
23 class SkTypeface; | 24 class SkTypeface; |
24 struct SkRect; | 25 struct SkRect; |
25 | 26 |
26 namespace cc { | 27 namespace cc { |
27 | 28 |
28 class FrameRateCounter; | 29 class FrameRateCounter; |
29 class PaintTimeCounter; | 30 class PaintTimeCounter; |
(...skipping 15 matching lines...) Expand all Loading... |
45 AppendQuadsData* append_quads_data) override; | 46 AppendQuadsData* append_quads_data) override; |
46 void UpdateHudTexture(DrawMode draw_mode, | 47 void UpdateHudTexture(DrawMode draw_mode, |
47 ResourceProvider* resource_provider); | 48 ResourceProvider* resource_provider); |
48 | 49 |
49 void ReleaseResources() override; | 50 void ReleaseResources() override; |
50 | 51 |
51 gfx::Rect GetEnclosingRectInTargetSpace() const override; | 52 gfx::Rect GetEnclosingRectInTargetSpace() const override; |
52 | 53 |
53 bool IsAnimatingHUDContents() const { return fade_step_ > 0; } | 54 bool IsAnimatingHUDContents() const { return fade_step_ > 0; } |
54 | 55 |
55 void SetHUDTypeface(const skia::RefPtr<SkTypeface>& typeface); | 56 void SetHUDTypeface(sk_sp<SkTypeface> typeface); |
56 | 57 |
57 // LayerImpl overrides. | 58 // LayerImpl overrides. |
58 void PushPropertiesTo(LayerImpl* layer) override; | 59 void PushPropertiesTo(LayerImpl* layer) override; |
59 | 60 |
60 private: | 61 private: |
61 class Graph { | 62 class Graph { |
62 public: | 63 public: |
63 Graph(double indicator_value, double start_upper_bound); | 64 Graph(double indicator_value, double start_upper_bound); |
64 | 65 |
65 // Eases the upper bound, which limits what is currently visible in the | 66 // Eases the upper bound, which limits what is currently visible in the |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 float stroke_width, | 128 float stroke_width, |
128 const std::string& label_text) const; | 129 const std::string& label_text) const; |
129 void DrawDebugRects(SkCanvas* canvas, DebugRectHistory* debug_rect_history); | 130 void DrawDebugRects(SkCanvas* canvas, DebugRectHistory* debug_rect_history); |
130 | 131 |
131 void AcquireResource(ResourceProvider* resource_provider); | 132 void AcquireResource(ResourceProvider* resource_provider); |
132 void ReleaseUnmatchedSizeResources(ResourceProvider* resource_provider); | 133 void ReleaseUnmatchedSizeResources(ResourceProvider* resource_provider); |
133 | 134 |
134 std::vector<std::unique_ptr<ScopedResource>> resources_; | 135 std::vector<std::unique_ptr<ScopedResource>> resources_; |
135 sk_sp<SkSurface> hud_surface_; | 136 sk_sp<SkSurface> hud_surface_; |
136 | 137 |
137 skia::RefPtr<SkTypeface> typeface_; | 138 sk_sp<SkTypeface> typeface_; |
138 | 139 |
139 float internal_contents_scale_; | 140 float internal_contents_scale_; |
140 gfx::Size internal_content_bounds_; | 141 gfx::Size internal_content_bounds_; |
141 | 142 |
142 Graph fps_graph_; | 143 Graph fps_graph_; |
143 Graph paint_time_graph_; | 144 Graph paint_time_graph_; |
144 MemoryHistory::Entry memory_entry_; | 145 MemoryHistory::Entry memory_entry_; |
145 int fade_step_; | 146 int fade_step_; |
146 std::vector<DebugRect> paint_rects_; | 147 std::vector<DebugRect> paint_rects_; |
147 | 148 |
148 base::TimeTicks time_of_last_graph_update_; | 149 base::TimeTicks time_of_last_graph_update_; |
149 | 150 |
150 DISALLOW_COPY_AND_ASSIGN(HeadsUpDisplayLayerImpl); | 151 DISALLOW_COPY_AND_ASSIGN(HeadsUpDisplayLayerImpl); |
151 }; | 152 }; |
152 | 153 |
153 } // namespace cc | 154 } // namespace cc |
154 | 155 |
155 #endif // CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 156 #endif // CC_LAYERS_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
OLD | NEW |