| 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_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 5 #ifndef CC_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| 6 #define CC_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 6 #define CC_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "cc/cc_export.h" | 10 #include "cc/cc_export.h" |
| 11 #include "cc/layer_impl.h" | 11 #include "cc/layer_impl.h" |
| 12 #include "cc/memory_history.h" | 12 #include "cc/memory_history.h" |
| 13 #include "cc/scoped_resource.h" | 13 #include "cc/scoped_resource.h" |
| 14 | 14 |
| 15 class SkCanvas; | 15 class SkCanvas; |
| 16 class SkPaint; | 16 class SkPaint; |
| 17 class SkTypeface; | 17 class SkTypeface; |
| 18 struct SkRect; | 18 struct SkRect; |
| 19 | 19 |
| 20 namespace cc { | 20 namespace cc { |
| 21 | 21 |
| 22 class DebugRectHistory; | 22 class DebugRectHistory; |
| 23 class FrameRateCounter; | 23 class FrameRateCounter; |
| 24 class PaintTimeCounter; | 24 class PaintTimeCounter; |
| 25 | 25 |
| 26 class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { | 26 class CC_EXPORT HeadsUpDisplayLayerImpl : public LayerImpl { |
| 27 public: | 27 public: |
| 28 static scoped_ptr<HeadsUpDisplayLayerImpl> create(LayerTreeImpl* treeImpl, i
nt id) | 28 static scoped_ptr<HeadsUpDisplayLayerImpl> Create(LayerTreeImpl* treeImpl, i
nt id) |
| 29 { | 29 { |
| 30 return make_scoped_ptr(new HeadsUpDisplayLayerImpl(treeImpl, id)); | 30 return make_scoped_ptr(new HeadsUpDisplayLayerImpl(treeImpl, id)); |
| 31 } | 31 } |
| 32 virtual ~HeadsUpDisplayLayerImpl(); | 32 virtual ~HeadsUpDisplayLayerImpl(); |
| 33 | 33 |
| 34 virtual scoped_ptr<LayerImpl> createLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; | 34 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* treeImpl) OVERR
IDE; |
| 35 | 35 |
| 36 virtual void willDraw(ResourceProvider*) OVERRIDE; | 36 virtual void WillDraw(ResourceProvider*) OVERRIDE; |
| 37 virtual void appendQuads(QuadSink&, AppendQuadsData&) OVERRIDE; | 37 virtual void AppendQuads(QuadSink* quad_sink, |
| 38 void updateHudTexture(ResourceProvider*); | 38 AppendQuadsData* append_quads_data) OVERRIDE; |
| 39 virtual void didDraw(ResourceProvider*) OVERRIDE; | 39 void updateHudTexture(ResourceProvider* resource_provider); |
| 40 virtual void DidDraw(ResourceProvider* resource_provider) OVERRIDE; |
| 40 | 41 |
| 41 virtual void didLoseOutputSurface() OVERRIDE; | 42 virtual void DidLoseOutputSurface() OVERRIDE; |
| 42 | 43 |
| 43 virtual bool layerIsAlwaysDamaged() const OVERRIDE; | 44 virtual bool LayerIsAlwaysDamaged() const OVERRIDE; |
| 44 | 45 |
| 45 private: | 46 private: |
| 46 class Graph { | 47 class Graph { |
| 47 public: | 48 public: |
| 48 Graph(double indicatorValue, double startUpperBound); | 49 Graph(double indicatorValue, double startUpperBound); |
| 49 | 50 |
| 50 // Eases the upper bound, which limits what is currently visible in the
graph, | 51 // Eases the upper bound, which limits what is currently visible in the
graph, |
| 51 // so that the graph always scales to either it's max or defaultUpperBou
nd. | 52 // so that the graph always scales to either it's max or defaultUpperBou
nd. |
| 52 double updateUpperBound(); | 53 double updateUpperBound(); |
| 53 | 54 |
| 54 double value; | 55 double value; |
| 55 double min; | 56 double min; |
| 56 double max; | 57 double max; |
| 57 | 58 |
| 58 double currentUpperBound; | 59 double currentUpperBound; |
| 59 const double defaultUpperBound; | 60 const double defaultUpperBound; |
| 60 const double indicator; | 61 const double indicator; |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 HeadsUpDisplayLayerImpl(LayerTreeImpl* treeImpl, int id); | 64 HeadsUpDisplayLayerImpl(LayerTreeImpl* treeImpl, int id); |
| 64 | 65 |
| 65 virtual const char* layerTypeAsString() const OVERRIDE; | 66 virtual const char* LayerTypeAsString() const OVERRIDE; |
| 66 | 67 |
| 67 void updateHudContents(); | 68 void updateHudContents(); |
| 68 void drawHudContents(SkCanvas* canvas) const; | 69 void drawHudContents(SkCanvas* canvas) const; |
| 69 | 70 |
| 70 void drawText(SkCanvas* canvas, SkPaint* paint, const std::string& text, SkP
aint::Align align, int size, int x, int y) const; | 71 void drawText(SkCanvas* canvas, SkPaint* paint, const std::string& text, SkP
aint::Align align, int size, int x, int y) const; |
| 71 void drawText(SkCanvas* canvas, SkPaint* paint, const std::string& text, SkP
aint::Align align, int size, const SkPoint& pos) const; | 72 void drawText(SkCanvas* canvas, SkPaint* paint, const std::string& text, SkP
aint::Align align, int size, const SkPoint& pos) const; |
| 72 void drawGraphBackground(SkCanvas* canvas, SkPaint* paint, const SkRect& bou
nds) const; | 73 void drawGraphBackground(SkCanvas* canvas, SkPaint* paint, const SkRect& bou
nds) const; |
| 73 void drawGraphLines(SkCanvas* canvas, SkPaint* paint, const SkRect& bounds,
const Graph& graph) const; | 74 void drawGraphLines(SkCanvas* canvas, SkPaint* paint, const SkRect& bounds,
const Graph& graph) const; |
| 74 | 75 |
| 75 void drawPlatformLayerTree(SkCanvas* canvas) const; | 76 void drawPlatformLayerTree(SkCanvas* canvas) const; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 86 Graph m_fpsGraph; | 87 Graph m_fpsGraph; |
| 87 Graph m_paintTimeGraph; | 88 Graph m_paintTimeGraph; |
| 88 MemoryHistory::Entry m_memoryEntry; | 89 MemoryHistory::Entry m_memoryEntry; |
| 89 | 90 |
| 90 base::TimeTicks m_timeOfLastGraphUpdate; | 91 base::TimeTicks m_timeOfLastGraphUpdate; |
| 91 }; | 92 }; |
| 92 | 93 |
| 93 } // namespace cc | 94 } // namespace cc |
| 94 | 95 |
| 95 #endif // CC_HEADS_UP_DISPLAY_LAYER_IMPL_H_ | 96 #endif // CC_HEADS_UP_DISPLAY_LAYER_IMPL_H_ |
| OLD | NEW |