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 bounds = device_viewport_in_layout_pixels; | 44 int max_texture_size = |
| 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())); |
45 } else { | 50 } else { |
46 int size = 256; | 51 int size = 256; |
47 bounds.SetSize(size, size); | 52 bounds.SetSize(size, size); |
48 matrix.Translate(device_viewport_in_layout_pixels.width() - size, 0.0); | 53 matrix.Translate(device_viewport_in_layout_pixels.width() - size, 0.0); |
49 } | 54 } |
50 | 55 |
51 SetBounds(bounds); | 56 SetBounds(bounds); |
52 SetTransform(matrix); | 57 SetTransform(matrix); |
53 } | 58 } |
54 | 59 |
(...skipping 14 matching lines...) Expand all Loading... |
69 void HeadsUpDisplayLayer::PushPropertiesTo(LayerImpl* layer) { | 74 void HeadsUpDisplayLayer::PushPropertiesTo(LayerImpl* layer) { |
70 Layer::PushPropertiesTo(layer); | 75 Layer::PushPropertiesTo(layer); |
71 TRACE_EVENT0("cc", "HeadsUpDisplayLayer::PushPropertiesTo"); | 76 TRACE_EVENT0("cc", "HeadsUpDisplayLayer::PushPropertiesTo"); |
72 HeadsUpDisplayLayerImpl* layer_impl = | 77 HeadsUpDisplayLayerImpl* layer_impl = |
73 static_cast<HeadsUpDisplayLayerImpl*>(layer); | 78 static_cast<HeadsUpDisplayLayerImpl*>(layer); |
74 | 79 |
75 layer_impl->SetHUDTypeface(typeface_); | 80 layer_impl->SetHUDTypeface(typeface_); |
76 } | 81 } |
77 | 82 |
78 } // namespace cc | 83 } // namespace cc |
OLD | NEW |