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/nine_patch_layer.h" | 5 #include "cc/layers/nine_patch_layer.h" |
6 | 6 |
7 #include "base/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "cc/layers/nine_patch_layer_impl.h" | 8 #include "cc/layers/nine_patch_layer_impl.h" |
9 #include "cc/resources/scoped_ui_resource.h" | 9 #include "cc/resources/scoped_ui_resource.h" |
10 #include "cc/resources/ui_resource_bitmap.h" | 10 #include "cc/resources/ui_resource_bitmap.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<NinePatchLayer> NinePatchLayer::Create() { | 15 scoped_refptr<NinePatchLayer> NinePatchLayer::Create() { |
16 return make_scoped_refptr(new NinePatchLayer()); | 16 return make_scoped_refptr(new NinePatchLayer()); |
17 } | 17 } |
18 | 18 |
19 NinePatchLayer::NinePatchLayer() | 19 NinePatchLayer::NinePatchLayer() |
20 : UIResourceLayer(), fill_center_(false), nearest_neighbor_(false) {} | 20 : UIResourceLayer(), fill_center_(false), nearest_neighbor_(false) {} |
21 | 21 |
22 NinePatchLayer::~NinePatchLayer() {} | 22 NinePatchLayer::~NinePatchLayer() {} |
23 | 23 |
24 scoped_ptr<LayerImpl> NinePatchLayer::CreateLayerImpl( | 24 std::unique_ptr<LayerImpl> NinePatchLayer::CreateLayerImpl( |
25 LayerTreeImpl* tree_impl) { | 25 LayerTreeImpl* tree_impl) { |
26 return NinePatchLayerImpl::Create(tree_impl, id()); | 26 return NinePatchLayerImpl::Create(tree_impl, id()); |
27 } | 27 } |
28 | 28 |
29 void NinePatchLayer::SetBorder(const gfx::Rect& border) { | 29 void NinePatchLayer::SetBorder(const gfx::Rect& border) { |
30 if (border == border_) | 30 if (border == border_) |
31 return; | 31 return; |
32 border_ = border; | 32 border_ = border; |
33 SetNeedsCommit(); | 33 SetNeedsCommit(); |
34 } | 34 } |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 layer_impl->SetUIResourceId(0); | 66 layer_impl->SetUIResourceId(0); |
67 } else { | 67 } else { |
68 DCHECK(layer_tree_host()); | 68 DCHECK(layer_tree_host()); |
69 | 69 |
70 layer_impl->SetLayout(image_aperture_, border_, fill_center_, | 70 layer_impl->SetLayout(image_aperture_, border_, fill_center_, |
71 nearest_neighbor_); | 71 nearest_neighbor_); |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 } // namespace cc | 75 } // namespace cc |
OLD | NEW |