| 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/layers/heads_up_display_layer.h" | 5 #include "cc/layers/heads_up_display_layer.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "cc/layers/heads_up_display_layer_impl.h" | 10 #include "cc/layers/heads_up_display_layer_impl.h" |
| 11 #include "cc/trees/layer_tree_host.h" | 11 #include "cc/trees/layer_tree_host.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create() { | 15 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create() { |
| 16 return make_scoped_refptr(new HeadsUpDisplayLayer()); | 16 return make_scoped_refptr(new HeadsUpDisplayLayer()); |
| 17 } | 17 } |
| 18 | 18 |
| 19 HeadsUpDisplayLayer::HeadsUpDisplayLayer() {} | 19 HeadsUpDisplayLayer::HeadsUpDisplayLayer() { |
| 20 UpdateDrawsContent(HasDrawableContent()); |
| 21 } |
| 20 | 22 |
| 21 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {} | 23 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {} |
| 22 | 24 |
| 23 void HeadsUpDisplayLayer::PrepareForCalculateDrawProperties( | 25 void HeadsUpDisplayLayer::PrepareForCalculateDrawProperties( |
| 24 const gfx::Size& device_viewport, float device_scale_factor) { | 26 const gfx::Size& device_viewport, float device_scale_factor) { |
| 25 gfx::Size device_viewport_in_layout_pixels = gfx::Size( | 27 gfx::Size device_viewport_in_layout_pixels = gfx::Size( |
| 26 device_viewport.width() / device_scale_factor, | 28 device_viewport.width() / device_scale_factor, |
| 27 device_viewport.height() / device_scale_factor); | 29 device_viewport.height() / device_scale_factor); |
| 28 | 30 |
| 29 gfx::Size bounds; | 31 gfx::Size bounds; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 40 } else { | 42 } else { |
| 41 int size = 256; | 43 int size = 256; |
| 42 bounds.SetSize(size, size); | 44 bounds.SetSize(size, size); |
| 43 matrix.Translate(device_viewport_in_layout_pixels.width() - size, 0.0); | 45 matrix.Translate(device_viewport_in_layout_pixels.width() - size, 0.0); |
| 44 } | 46 } |
| 45 | 47 |
| 46 SetBounds(bounds); | 48 SetBounds(bounds); |
| 47 SetTransform(matrix); | 49 SetTransform(matrix); |
| 48 } | 50 } |
| 49 | 51 |
| 50 bool HeadsUpDisplayLayer::DrawsContent() const { return true; } | 52 bool HeadsUpDisplayLayer::HasDrawableContent() const { |
| 53 return true; |
| 54 } |
| 51 | 55 |
| 52 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::CreateLayerImpl( | 56 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::CreateLayerImpl( |
| 53 LayerTreeImpl* tree_impl) { | 57 LayerTreeImpl* tree_impl) { |
| 54 return HeadsUpDisplayLayerImpl::Create(tree_impl, layer_id_). | 58 return HeadsUpDisplayLayerImpl::Create(tree_impl, layer_id_). |
| 55 PassAs<LayerImpl>(); | 59 PassAs<LayerImpl>(); |
| 56 } | 60 } |
| 57 | 61 |
| 58 } // namespace cc | 62 } // namespace cc |
| OLD | NEW |