| 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 #include "cc/heads_up_display_layer.h" | 5 #include "cc/heads_up_display_layer.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "cc/heads_up_display_layer_impl.h" | 8 #include "cc/heads_up_display_layer_impl.h" |
| 9 #include "cc/layer_tree_host.h" | 9 #include "cc/layer_tree_host.h" |
| 10 | 10 |
| 11 namespace cc { | 11 namespace cc { |
| 12 | 12 |
| 13 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::create() | 13 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create() |
| 14 { | 14 { |
| 15 return make_scoped_refptr(new HeadsUpDisplayLayer()); | 15 return make_scoped_refptr(new HeadsUpDisplayLayer()); |
| 16 } | 16 } |
| 17 | 17 |
| 18 HeadsUpDisplayLayer::HeadsUpDisplayLayer() | 18 HeadsUpDisplayLayer::HeadsUpDisplayLayer() |
| 19 : Layer() | 19 : Layer() |
| 20 { | 20 { |
| 21 setBounds(gfx::Size(256, 256)); | 21 SetBounds(gfx::Size(256, 256)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() | 24 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() |
| 25 { | 25 { |
| 26 } | 26 } |
| 27 | 27 |
| 28 void HeadsUpDisplayLayer::update(ResourceUpdateQueue&, const OcclusionTracker*,
RenderingStats*) | 28 void HeadsUpDisplayLayer::Update(ResourceUpdateQueue*, const OcclusionTracker*,
RenderingStats*) |
| 29 { | 29 { |
| 30 const LayerTreeDebugState& debugState = layerTreeHost()->debugState(); | 30 const LayerTreeDebugState& debugState = layer_tree_host()->debugState(); |
| 31 int maxTextureSize = layerTreeHost()->rendererCapabilities().maxTextureSize; | 31 int maxTextureSize = layer_tree_host()->rendererCapabilities().maxTextureSiz
e; |
| 32 | 32 |
| 33 int deviceViewportInLayoutPixelsWidth = layerTreeHost()->deviceViewportSize(
).width() / layerTreeHost()->deviceScaleFactor(); | 33 int deviceViewportInLayoutPixelsWidth = layer_tree_host()->deviceViewportSiz
e().width() / layer_tree_host()->deviceScaleFactor(); |
| 34 int deviceViewportInLayoutPixelsHeight = layerTreeHost()->deviceViewportSize
().height() / layerTreeHost()->deviceScaleFactor(); | 34 int deviceViewportInLayoutPixelsHeight = layer_tree_host()->deviceViewportSi
ze().height() / layer_tree_host()->deviceScaleFactor(); |
| 35 | 35 |
| 36 gfx::Size bounds; | 36 gfx::Size bounds; |
| 37 gfx::Transform matrix; | 37 gfx::Transform matrix; |
| 38 matrix.MakeIdentity(); | 38 matrix.MakeIdentity(); |
| 39 | 39 |
| 40 if (debugState.showPlatformLayerTree || debugState.showHudRects()) { | 40 if (debugState.showPlatformLayerTree || debugState.showHudRects()) { |
| 41 int width = std::min(maxTextureSize, deviceViewportInLayoutPixelsWidth); | 41 int width = std::min(maxTextureSize, deviceViewportInLayoutPixelsWidth); |
| 42 int height = std::min(maxTextureSize, deviceViewportInLayoutPixelsHeight
); | 42 int height = std::min(maxTextureSize, deviceViewportInLayoutPixelsHeight
); |
| 43 bounds = gfx::Size(width, height); | 43 bounds = gfx::Size(width, height); |
| 44 } else { | 44 } else { |
| 45 bounds = gfx::Size(256, 256); | 45 bounds = gfx::Size(256, 256); |
| 46 matrix.Translate(deviceViewportInLayoutPixelsWidth - 256, 0); | 46 matrix.Translate(deviceViewportInLayoutPixelsWidth - 256, 0); |
| 47 } | 47 } |
| 48 | 48 |
| 49 setBounds(bounds); | 49 SetBounds(bounds); |
| 50 setTransform(matrix); | 50 SetTransform(matrix); |
| 51 } | 51 } |
| 52 | 52 |
| 53 bool HeadsUpDisplayLayer::drawsContent() const | 53 bool HeadsUpDisplayLayer::DrawsContent() const |
| 54 { | 54 { |
| 55 return true; | 55 return true; |
| 56 } | 56 } |
| 57 | 57 |
| 58 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::createLayerImpl(LayerTreeImpl* treeIm
pl) | 58 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::CreateLayerImpl(LayerTreeImpl* treeIm
pl) |
| 59 { | 59 { |
| 60 return HeadsUpDisplayLayerImpl::create(treeImpl, m_layerId).PassAs<LayerImpl
>(); | 60 return HeadsUpDisplayLayerImpl::Create(treeImpl, layer_id_).PassAs<LayerImpl
>(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 } // namespace cc | 63 } // namespace cc |
| OLD | NEW |