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 #include "ui/gfx/size_conversions.h" | |
12 | 13 |
13 namespace cc { | 14 namespace cc { |
14 | 15 |
15 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create() { | 16 scoped_refptr<HeadsUpDisplayLayer> HeadsUpDisplayLayer::Create() { |
16 return make_scoped_refptr(new HeadsUpDisplayLayer()); | 17 return make_scoped_refptr(new HeadsUpDisplayLayer()); |
17 } | 18 } |
18 | 19 |
19 HeadsUpDisplayLayer::HeadsUpDisplayLayer() {} | 20 HeadsUpDisplayLayer::HeadsUpDisplayLayer() {} |
20 | 21 |
21 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {} | 22 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {} |
22 | 23 |
23 void HeadsUpDisplayLayer::PrepareForCalculateDrawProperties( | 24 void HeadsUpDisplayLayer::PrepareForCalculateDrawProperties( |
24 gfx::Size device_viewport, float device_scale_factor) { | 25 gfx::Size device_viewport, float device_scale_factor) { |
25 gfx::Size device_viewport_in_layout_pixels = gfx::Size( | 26 gfx::Size device_viewport_in_layout_pixels = gfx::Size( |
26 device_viewport.width() / device_scale_factor, | 27 device_viewport.width() / device_scale_factor, |
27 device_viewport.height() / device_scale_factor); | 28 device_viewport.height() / device_scale_factor); |
28 | 29 |
30 if (parent()) { | |
danakj
2013/09/19 17:07:45
I don't know how you'd get a HUD layer without a p
dgozman
2013/09/19 18:42:18
I saw some code like this around hud layer. I'm pr
| |
31 // The root layer may have the transform set. As we still want to be shown | |
32 // at the corner of visible viewport, apply inverted transform to it. | |
33 gfx::Transform invert; | |
34 gfx::RectF rect(device_viewport_in_layout_pixels); | |
35 if (parent()->transform().TransformRectReverse(&rect)) { | |
36 device_viewport_in_layout_pixels = gfx::ToFlooredSize(rect.size()); | |
danakj
2013/09/19 17:07:45
You're projecting from the root surface to the roo
dgozman
2013/09/19 18:42:18
Yep, root layer has a scale transform. I'm not sur
aelias_OOO_until_Jul13
2013/09/19 21:35:28
The Blink-supplied root layer is the one and only
dgozman
2013/09/27 19:02:03
Filed a separate bug for this. I will look into mo
| |
37 } | |
38 } | |
39 | |
29 gfx::Size bounds; | 40 gfx::Size bounds; |
30 gfx::Transform matrix; | 41 gfx::Transform matrix; |
31 matrix.MakeIdentity(); | 42 matrix.MakeIdentity(); |
32 | 43 |
33 if (layer_tree_host()->debug_state().ShowHudRects()) { | 44 if (layer_tree_host()->debug_state().ShowHudRects()) { |
34 int max_texture_size = | 45 int max_texture_size = |
35 layer_tree_host()->GetRendererCapabilities().max_texture_size; | 46 layer_tree_host()->GetRendererCapabilities().max_texture_size; |
36 bounds.SetSize(std::min(max_texture_size, | 47 bounds.SetSize(std::min(max_texture_size, |
37 device_viewport_in_layout_pixels.width()), | 48 device_viewport_in_layout_pixels.width()), |
38 std::min(max_texture_size, | 49 std::min(max_texture_size, |
(...skipping 14 matching lines...) Expand all Loading... | |
53 LayerTreeImpl* tree_impl) { | 64 LayerTreeImpl* tree_impl) { |
54 return HeadsUpDisplayLayerImpl::Create(tree_impl, layer_id_). | 65 return HeadsUpDisplayLayerImpl::Create(tree_impl, layer_id_). |
55 PassAs<LayerImpl>(); | 66 PassAs<LayerImpl>(); |
56 } | 67 } |
57 | 68 |
58 std::string HeadsUpDisplayLayer::DebugName() { | 69 std::string HeadsUpDisplayLayer::DebugName() { |
59 return std::string("Heads Up Display Layer"); | 70 return std::string("Heads Up Display Layer"); |
60 } | 71 } |
61 | 72 |
62 } // namespace cc | 73 } // namespace cc |
OLD | NEW |