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.
7 #include "HeadsUpDisplayLayerChromium.h"
9 #include "CCHeadsUpDisplayLayerImpl.h"
10 #include "CCLayerTreeHost.h"
11 #include "TraceEvent.h"
15 scoped_refptr
<HeadsUpDisplayLayerChromium
> HeadsUpDisplayLayerChromium::create()
17 return make_scoped_refptr(new HeadsUpDisplayLayerChromium());
20 HeadsUpDisplayLayerChromium::HeadsUpDisplayLayerChromium()
24 setBounds(IntSize(512, 128));
27 HeadsUpDisplayLayerChromium::~HeadsUpDisplayLayerChromium()
31 void HeadsUpDisplayLayerChromium::update(CCTextureUpdateQueue
&, const CCOcclusionTracker
*, CCRenderingStats
&)
33 const CCLayerTreeSettings
& settings
= layerTreeHost()->settings();
34 int maxTextureSize
= layerTreeHost()->rendererCapabilities().maxTextureSize
;
37 if (settings
.showPlatformLayerTree
|| settings
.showDebugRects()) {
38 bounds
.setWidth(std::min(maxTextureSize
, layerTreeHost()->deviceViewportSize().width()));
39 bounds
.setHeight(std::min(maxTextureSize
, layerTreeHost()->deviceViewportSize().height()));
42 bounds
.setHeight(128);
48 bool HeadsUpDisplayLayerChromium::drawsContent() const
53 void HeadsUpDisplayLayerChromium::setFontAtlas(scoped_ptr
<CCFontAtlas
> fontAtlas
)
55 m_fontAtlas
= fontAtlas
.Pass();
59 PassOwnPtr
<CCLayerImpl
> HeadsUpDisplayLayerChromium::createCCLayerImpl()
61 return CCHeadsUpDisplayLayerImpl::create(m_layerId
);
64 void HeadsUpDisplayLayerChromium::pushPropertiesTo(CCLayerImpl
* layerImpl
)
66 LayerChromium::pushPropertiesTo(layerImpl
);
68 if (!m_fontAtlas
.get())
71 CCHeadsUpDisplayLayerImpl
* hudLayerImpl
= static_cast<CCHeadsUpDisplayLayerImpl
*>(layerImpl
);
72 hudLayerImpl
->setFontAtlas(m_fontAtlas
.Pass());