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
3 // found in the LICENSE file.
5 #ifndef CCHeadsUpDisplayLayerImpl_h
6 #define CCHeadsUpDisplayLayerImpl_h
8 #include "base/memory/scoped_ptr.h"
9 #include "CCFontAtlas.h"
10 #include "CCLayerImpl.h"
11 #include "CCScopedTexture.h"
17 class CCDebugRectHistory
;
19 class CCFrameRateCounter
;
21 class CCHeadsUpDisplayLayerImpl
: public CCLayerImpl
{
23 static scoped_ptr
<CCHeadsUpDisplayLayerImpl
> create(int id
)
25 return make_scoped_ptr(new CCHeadsUpDisplayLayerImpl(id
));
27 virtual ~CCHeadsUpDisplayLayerImpl();
29 void setFontAtlas(scoped_ptr
<CCFontAtlas
>);
31 virtual void willDraw(CCResourceProvider
*) OVERRIDE
;
32 virtual void appendQuads(CCQuadSink
&, CCAppendQuadsData
&) OVERRIDE
;
33 void updateHudTexture(CCResourceProvider
*);
34 virtual void didDraw(CCResourceProvider
*) OVERRIDE
;
36 virtual void didLoseContext() OVERRIDE
;
38 virtual bool layerIsAlwaysDamaged() const OVERRIDE
;
41 explicit CCHeadsUpDisplayLayerImpl(int);
43 virtual const char* layerTypeAsString() const OVERRIDE
;
45 void drawHudContents(SkCanvas
*);
46 void drawFPSCounter(SkCanvas
*, CCFrameRateCounter
*, int top
, int height
);
47 void drawFPSCounterText(SkCanvas
*, CCFrameRateCounter
*, int top
, int width
, int height
);
48 void drawDebugRects(SkCanvas
*, CCDebugRectHistory
*);
50 scoped_ptr
<CCFontAtlas
> m_fontAtlas
;
51 scoped_ptr
<CCScopedTexture
> m_hudTexture
;
52 scoped_ptr
<SkCanvas
> m_hudCanvas
;
57 #endif // CCHeadsUpDisplayLayerImpl_h