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/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/layers/heads_up_display_layer_impl.h" | 10 #include "cc/layers/heads_up_display_layer_impl.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 const gfx::Size& device_viewport, float device_scale_factor) { | 34 const gfx::Size& device_viewport, float device_scale_factor) { |
35 gfx::Size device_viewport_in_layout_pixels = gfx::Size( | 35 gfx::Size device_viewport_in_layout_pixels = gfx::Size( |
36 device_viewport.width() / device_scale_factor, | 36 device_viewport.width() / device_scale_factor, |
37 device_viewport.height() / device_scale_factor); | 37 device_viewport.height() / device_scale_factor); |
38 | 38 |
39 gfx::Size bounds; | 39 gfx::Size bounds; |
40 gfx::Transform matrix; | 40 gfx::Transform matrix; |
41 matrix.MakeIdentity(); | 41 matrix.MakeIdentity(); |
42 | 42 |
43 if (layer_tree_host()->debug_state().ShowHudRects()) { | 43 if (layer_tree_host()->debug_state().ShowHudRects()) { |
44 int max_texture_size = | 44 bounds = device_viewport_in_layout_pixels; |
45 layer_tree_host()->GetRendererCapabilities().max_texture_size; | |
46 bounds.SetSize(std::min(max_texture_size, | |
47 device_viewport_in_layout_pixels.width()), | |
48 std::min(max_texture_size, | |
49 device_viewport_in_layout_pixels.height())); | |
50 } else { | 45 } else { |
51 int size = 256; | 46 int size = 256; |
52 bounds.SetSize(size, size); | 47 bounds.SetSize(size, size); |
53 matrix.Translate(device_viewport_in_layout_pixels.width() - size, 0.0); | 48 matrix.Translate(device_viewport_in_layout_pixels.width() - size, 0.0); |
54 } | 49 } |
55 | 50 |
56 SetBounds(bounds); | 51 SetBounds(bounds); |
57 SetTransform(matrix); | 52 SetTransform(matrix); |
58 } | 53 } |
59 | 54 |
(...skipping 14 matching lines...) Expand all Loading... |
74 void HeadsUpDisplayLayer::PushPropertiesTo(LayerImpl* layer) { | 69 void HeadsUpDisplayLayer::PushPropertiesTo(LayerImpl* layer) { |
75 Layer::PushPropertiesTo(layer); | 70 Layer::PushPropertiesTo(layer); |
76 TRACE_EVENT0("cc", "HeadsUpDisplayLayer::PushPropertiesTo"); | 71 TRACE_EVENT0("cc", "HeadsUpDisplayLayer::PushPropertiesTo"); |
77 HeadsUpDisplayLayerImpl* layer_impl = | 72 HeadsUpDisplayLayerImpl* layer_impl = |
78 static_cast<HeadsUpDisplayLayerImpl*>(layer); | 73 static_cast<HeadsUpDisplayLayerImpl*>(layer); |
79 | 74 |
80 layer_impl->SetHUDTypeface(typeface_); | 75 layer_impl->SetHUDTypeface(typeface_); |
81 } | 76 } |
82 | 77 |
83 } // namespace cc | 78 } // namespace cc |
OLD | NEW |