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" |
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 SkTypeface* typeface) { |
| 17 return make_scoped_refptr(new HeadsUpDisplayLayer(typeface)); |
17 } | 18 } |
18 | 19 |
19 HeadsUpDisplayLayer::HeadsUpDisplayLayer() { | 20 HeadsUpDisplayLayer::HeadsUpDisplayLayer(SkTypeface* typeface) |
| 21 : typeface_(typeface) { |
20 SetIsDrawable(true); | 22 SetIsDrawable(true); |
21 UpdateDrawsContent(HasDrawableContent()); | 23 UpdateDrawsContent(HasDrawableContent()); |
22 } | 24 } |
23 | 25 |
24 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {} | 26 HeadsUpDisplayLayer::~HeadsUpDisplayLayer() {} |
25 | 27 |
26 void HeadsUpDisplayLayer::PrepareForCalculateDrawProperties( | 28 void HeadsUpDisplayLayer::PrepareForCalculateDrawProperties( |
27 const gfx::Size& device_viewport, float device_scale_factor) { | 29 const gfx::Size& device_viewport, float device_scale_factor) { |
28 gfx::Size device_viewport_in_layout_pixels = gfx::Size( | 30 gfx::Size device_viewport_in_layout_pixels = gfx::Size( |
29 device_viewport.width() / device_scale_factor, | 31 device_viewport.width() / device_scale_factor, |
(...skipping 19 matching lines...) Expand all Loading... |
49 SetBounds(bounds); | 51 SetBounds(bounds); |
50 SetTransform(matrix); | 52 SetTransform(matrix); |
51 } | 53 } |
52 | 54 |
53 bool HeadsUpDisplayLayer::HasDrawableContent() const { | 55 bool HeadsUpDisplayLayer::HasDrawableContent() const { |
54 return true; | 56 return true; |
55 } | 57 } |
56 | 58 |
57 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::CreateLayerImpl( | 59 scoped_ptr<LayerImpl> HeadsUpDisplayLayer::CreateLayerImpl( |
58 LayerTreeImpl* tree_impl) { | 60 LayerTreeImpl* tree_impl) { |
59 return HeadsUpDisplayLayerImpl::Create(tree_impl, layer_id_); | 61 return HeadsUpDisplayLayerImpl::Create(tree_impl, layer_id_, typeface_); |
60 } | 62 } |
61 | 63 |
62 } // namespace cc | 64 } // namespace cc |
OLD | NEW |