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 CCHeadsUpDisplayLayerImpl_h | 5 #ifndef CCHeadsUpDisplayLayerImpl_h |
6 #define CCHeadsUpDisplayLayerImpl_h | 6 #define CCHeadsUpDisplayLayerImpl_h |
7 | 7 |
8 #include "CCFontAtlas.h" | 8 #include "CCFontAtlas.h" |
9 #include "CCLayerImpl.h" | 9 #include "CCLayerImpl.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "cc/scoped_texture.h" | 11 #include "cc/scoped_texture.h" |
12 | 12 |
13 class SkCanvas; | 13 class SkCanvas; |
14 | 14 |
15 namespace cc { | 15 namespace cc { |
16 | 16 |
17 class CCDebugRectHistory; | 17 class CCDebugRectHistory; |
18 class CCFontAtlas; | 18 class CCFontAtlas; |
19 class CCFrameRateCounter; | 19 class CCFrameRateCounter; |
20 | 20 |
21 class CCHeadsUpDisplayLayerImpl : public CCLayerImpl { | 21 class CCHeadsUpDisplayLayerImpl : public CCLayerImpl { |
22 public: | 22 public: |
23 static scoped_ptr<CCHeadsUpDisplayLayerImpl> create(int id) | 23 static scoped_ptr<CCHeadsUpDisplayLayerImpl> create(int id) |
24 { | 24 { |
25 return make_scoped_ptr(new CCHeadsUpDisplayLayerImpl(id)); | 25 return make_scoped_ptr(new CCHeadsUpDisplayLayerImpl(id)); |
26 } | 26 } |
27 virtual ~CCHeadsUpDisplayLayerImpl(); | 27 virtual ~CCHeadsUpDisplayLayerImpl(); |
28 | 28 |
29 void setFontAtlas(scoped_ptr<CCFontAtlas>); | 29 void setFontAtlas(scoped_ptr<CCFontAtlas>); |
| 30 void setShowFPSCounter(bool); |
30 | 31 |
31 virtual void willDraw(CCResourceProvider*) OVERRIDE; | 32 virtual void willDraw(CCResourceProvider*) OVERRIDE; |
32 virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; | 33 virtual void appendQuads(CCQuadSink&, CCAppendQuadsData&) OVERRIDE; |
33 void updateHudTexture(CCResourceProvider*); | 34 void updateHudTexture(CCResourceProvider*); |
34 virtual void didDraw(CCResourceProvider*) OVERRIDE; | 35 virtual void didDraw(CCResourceProvider*) OVERRIDE; |
35 | 36 |
36 virtual void didLoseContext() OVERRIDE; | 37 virtual void didLoseContext() OVERRIDE; |
37 | 38 |
38 virtual bool layerIsAlwaysDamaged() const OVERRIDE; | 39 virtual bool layerIsAlwaysDamaged() const OVERRIDE; |
39 | 40 |
40 private: | 41 private: |
41 explicit CCHeadsUpDisplayLayerImpl(int); | 42 explicit CCHeadsUpDisplayLayerImpl(int); |
42 | 43 |
43 virtual const char* layerTypeAsString() const OVERRIDE; | 44 virtual const char* layerTypeAsString() const OVERRIDE; |
44 | 45 |
45 void drawHudContents(SkCanvas*); | 46 void drawHudContents(SkCanvas*); |
46 void drawFPSCounter(SkCanvas*, CCFrameRateCounter*, int top, int height); | 47 void drawFPSCounter(SkCanvas*, CCFrameRateCounter*, int top, int height); |
47 void drawFPSCounterText(SkCanvas*, CCFrameRateCounter*, int top, int width,
int height); | 48 void drawFPSCounterText(SkCanvas*, CCFrameRateCounter*, int top, int width,
int height); |
48 void drawDebugRects(SkCanvas*, CCDebugRectHistory*); | 49 void drawDebugRects(SkCanvas*, CCDebugRectHistory*); |
49 | 50 |
50 scoped_ptr<CCFontAtlas> m_fontAtlas; | 51 scoped_ptr<CCFontAtlas> m_fontAtlas; |
51 scoped_ptr<CCScopedTexture> m_hudTexture; | 52 scoped_ptr<CCScopedTexture> m_hudTexture; |
52 scoped_ptr<SkCanvas> m_hudCanvas; | 53 scoped_ptr<SkCanvas> m_hudCanvas; |
| 54 |
| 55 bool m_showFPSCounter; |
53 }; | 56 }; |
54 | 57 |
55 } // namespace cc | 58 } // namespace cc |
56 | 59 |
57 #endif // CCHeadsUpDisplayLayerImpl_h | 60 #endif // CCHeadsUpDisplayLayerImpl_h |
OLD | NEW |