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" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 | 51 |
52 void NinePatchLayer::SetNearestNeighbor(bool nearest_neighbor) { | 52 void NinePatchLayer::SetNearestNeighbor(bool nearest_neighbor) { |
53 if (nearest_neighbor_ == nearest_neighbor) | 53 if (nearest_neighbor_ == nearest_neighbor) |
54 return; | 54 return; |
55 | 55 |
56 nearest_neighbor_ = nearest_neighbor; | 56 nearest_neighbor_ = nearest_neighbor; |
57 SetNeedsCommit(); | 57 SetNeedsCommit(); |
58 } | 58 } |
59 | 59 |
| 60 void NinePatchLayer::SetLayerOcclusion(const gfx::Rect& occlusion) { |
| 61 if (layer_occlusion_ == occlusion) |
| 62 return; |
| 63 |
| 64 layer_occlusion_ = occlusion; |
| 65 SetNeedsCommit(); |
| 66 } |
| 67 |
60 void NinePatchLayer::PushPropertiesTo(LayerImpl* layer) { | 68 void NinePatchLayer::PushPropertiesTo(LayerImpl* layer) { |
61 UIResourceLayer::PushPropertiesTo(layer); | 69 UIResourceLayer::PushPropertiesTo(layer); |
62 TRACE_EVENT0("cc", "NinePatchLayer::PushPropertiesTo"); | 70 TRACE_EVENT0("cc", "NinePatchLayer::PushPropertiesTo"); |
63 NinePatchLayerImpl* layer_impl = static_cast<NinePatchLayerImpl*>(layer); | 71 NinePatchLayerImpl* layer_impl = static_cast<NinePatchLayerImpl*>(layer); |
64 | 72 |
65 if (!ui_resource_holder_) { | 73 if (!ui_resource_holder_) { |
66 layer_impl->SetUIResourceId(0); | 74 layer_impl->SetUIResourceId(0); |
67 } else { | 75 } else { |
68 DCHECK(layer_tree_host()); | 76 DCHECK(layer_tree_host()); |
69 | 77 |
70 layer_impl->SetLayout(image_aperture_, border_, fill_center_, | 78 layer_impl->SetLayout(image_aperture_, border_, fill_center_, |
71 nearest_neighbor_); | 79 nearest_neighbor_, layer_occlusion_); |
72 } | 80 } |
73 } | 81 } |
74 | 82 |
75 } // namespace cc | 83 } // namespace cc |
OLD | NEW |