Use SCHEME_HTTP for HTTPS proxies on Android.
[chromium-blink-merge.git] / cc / heads_up_display_layer.cc
blob675c5cf349fb64f57fae265cf6d5e3d825a6878f
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 #include "cc/heads_up_display_layer.h"
7 #include "base/debug/trace_event.h"
8 #include "cc/heads_up_display_layer_impl.h"
9 #include "cc/layer_tree_host.h"
11 namespace cc {
13 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create()
15 return make_scoped_refptr(new HeadsUpDisplayLayer());
18 HeadsUpDisplayLayer::HeadsUpDisplayLayer()
19 : Layer()
20 , m_hasFontAtlas(false)
22 setBounds(gfx::Size(256, 128));
25 HeadsUpDisplayLayer::~HeadsUpDisplayLayer()
29 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*, RenderingStats&)
31 const LayerTreeDebugState& debugState = layerTreeHost()->debugState();
32 int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize;
34 gfx::Size bounds;
35 gfx::Transform matrix;
36 matrix.MakeIdentity();
38 if (debugState.showPlatformLayerTree || debugState.showHudRects()) {
39 int width = std::min(maxTextureSize, layerTreeHost()->layoutViewportSize().width());
40 int height = std::min(maxTextureSize, layerTreeHost()->layoutViewportSize().height());
41 bounds = gfx::Size(width, height);
42 } else {
43 bounds = gfx::Size(256, 128);
44 matrix.Translate(layerTreeHost()->layoutViewportSize().width() - 256, 0);
47 setBounds(bounds);
48 setTransform(matrix);
51 bool HeadsUpDisplayLayer::drawsContent() const
53 return true;
56 void HeadsUpDisplayLayer::setFontAtlas(scoped_ptr<FontAtlas> fontAtlas)
58 m_fontAtlas = fontAtlas.Pass();
59 m_hasFontAtlas = true;
62 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl(LayerTreeHostImpl* hostImpl)
64 return HeadsUpDisplayLayerImpl::create(hostImpl, m_layerId).PassAs<LayerImpl>();
67 void HeadsUpDisplayLayer::pushPropertiesTo(LayerImpl* layerImpl)
69 Layer::pushPropertiesTo(layerImpl);
71 if (!m_fontAtlas)
72 return;
74 HeadsUpDisplayLayerImpl* hudLayerImpl = static_cast<HeadsUpDisplayLayerImpl*>(layerImpl);
75 hudLayerImpl->setFontAtlas(m_fontAtlas.Pass());
78 } // namespace cc