| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui_resource_layer.h" | 5 #include "cc/layers/ui_resource_layer.h" |
| 6 | 6 |
| 7 #include "base/trace_event/trace_event.h" |
| 7 #include "cc/layers/ui_resource_layer_impl.h" | 8 #include "cc/layers/ui_resource_layer_impl.h" |
| 8 #include "cc/resources/scoped_ui_resource.h" | 9 #include "cc/resources/scoped_ui_resource.h" |
| 9 #include "cc/resources/ui_resource_bitmap.h" | 10 #include "cc/resources/ui_resource_bitmap.h" |
| 10 #include "cc/trees/layer_tree_host.h" | 11 #include "cc/trees/layer_tree_host.h" |
| 11 | 12 |
| 12 namespace cc { | 13 namespace cc { |
| 13 | 14 |
| 14 | 15 |
| 15 namespace { | 16 namespace { |
| 16 | 17 |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 SetNeedsCommit(); | 143 SetNeedsCommit(); |
| 143 } | 144 } |
| 144 | 145 |
| 145 bool UIResourceLayer::HasDrawableContent() const { | 146 bool UIResourceLayer::HasDrawableContent() const { |
| 146 return ui_resource_holder_ && ui_resource_holder_->id() && | 147 return ui_resource_holder_ && ui_resource_holder_->id() && |
| 147 Layer::HasDrawableContent(); | 148 Layer::HasDrawableContent(); |
| 148 } | 149 } |
| 149 | 150 |
| 150 void UIResourceLayer::PushPropertiesTo(LayerImpl* layer) { | 151 void UIResourceLayer::PushPropertiesTo(LayerImpl* layer) { |
| 151 Layer::PushPropertiesTo(layer); | 152 Layer::PushPropertiesTo(layer); |
| 153 TRACE_EVENT0("cc", "UIResourceLayer::PushPropertiesTo"); |
| 152 UIResourceLayerImpl* layer_impl = static_cast<UIResourceLayerImpl*>(layer); | 154 UIResourceLayerImpl* layer_impl = static_cast<UIResourceLayerImpl*>(layer); |
| 153 | 155 |
| 154 if (!ui_resource_holder_) { | 156 if (!ui_resource_holder_) { |
| 155 layer_impl->SetUIResourceId(0); | 157 layer_impl->SetUIResourceId(0); |
| 156 } else { | 158 } else { |
| 157 DCHECK(layer_tree_host()); | 159 DCHECK(layer_tree_host()); |
| 158 | 160 |
| 159 gfx::Size image_size = | 161 gfx::Size image_size = |
| 160 layer_tree_host()->GetUIResourceSize(ui_resource_holder_->id()); | 162 layer_tree_host()->GetUIResourceSize(ui_resource_holder_->id()); |
| 161 layer_impl->SetUIResourceId(ui_resource_holder_->id()); | 163 layer_impl->SetUIResourceId(ui_resource_holder_->id()); |
| 162 layer_impl->SetImageBounds(image_size); | 164 layer_impl->SetImageBounds(image_size); |
| 163 layer_impl->SetUV(uv_top_left_, uv_bottom_right_); | 165 layer_impl->SetUV(uv_top_left_, uv_bottom_right_); |
| 164 layer_impl->SetVertexOpacity(vertex_opacity_); | 166 layer_impl->SetVertexOpacity(vertex_opacity_); |
| 165 } | 167 } |
| 166 } | 168 } |
| 167 | 169 |
| 168 } // namespace cc | 170 } // namespace cc |
| OLD | NEW |