| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surface_layer.h" | 5 #include "cc/layers/surface_layer.h" |
| 6 | 6 |
| 7 #include "cc/layers/surface_layer_impl.h" | 7 #include "cc/layers/surface_layer_impl.h" |
| 8 #include "cc/output/swap_promise.h" | 8 #include "cc/output/swap_promise.h" |
| 9 #include "cc/trees/layer_tree_host.h" | 9 #include "cc/trees/layer_tree_host.h" |
| 10 | 10 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 SatisfyDestroySequence(); | 87 SatisfyDestroySequence(); |
| 88 Layer::SetLayerTreeHost(host); | 88 Layer::SetLayerTreeHost(host); |
| 89 CreateNewDestroySequence(); | 89 CreateNewDestroySequence(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void SurfaceLayer::PushPropertiesTo(LayerImpl* layer) { | 92 void SurfaceLayer::PushPropertiesTo(LayerImpl* layer) { |
| 93 Layer::PushPropertiesTo(layer); | 93 Layer::PushPropertiesTo(layer); |
| 94 SurfaceLayerImpl* layer_impl = static_cast<SurfaceLayerImpl*>(layer); | 94 SurfaceLayerImpl* layer_impl = static_cast<SurfaceLayerImpl*>(layer); |
| 95 | 95 |
| 96 layer_impl->SetSurfaceId(surface_id_); | 96 layer_impl->SetSurfaceId(surface_id_); |
| 97 } | 97 layer_impl->SetSurfaceSize(surface_size_); |
| 98 | 98 layer_impl->SetSurfaceScale(surface_scale_); |
| 99 void SurfaceLayer::CalculateContentsScale(float ideal_contents_scale, | |
| 100 float* contents_scale_x, | |
| 101 float* contents_scale_y, | |
| 102 gfx::Size* content_bounds) { | |
| 103 *content_bounds = surface_size_; | |
| 104 *contents_scale_x = surface_scale_; | |
| 105 *contents_scale_y = surface_scale_; | |
| 106 } | 99 } |
| 107 | 100 |
| 108 void SurfaceLayer::CreateNewDestroySequence() { | 101 void SurfaceLayer::CreateNewDestroySequence() { |
| 109 DCHECK(destroy_sequence_.is_null()); | 102 DCHECK(destroy_sequence_.is_null()); |
| 110 if (layer_tree_host()) { | 103 if (layer_tree_host()) { |
| 111 destroy_sequence_ = layer_tree_host()->CreateSurfaceSequence(); | 104 destroy_sequence_ = layer_tree_host()->CreateSurfaceSequence(); |
| 112 require_callback_.Run(surface_id_, destroy_sequence_); | 105 require_callback_.Run(surface_id_, destroy_sequence_); |
| 113 } | 106 } |
| 114 } | 107 } |
| 115 | 108 |
| 116 void SurfaceLayer::SatisfyDestroySequence() { | 109 void SurfaceLayer::SatisfyDestroySequence() { |
| 117 if (!layer_tree_host()) | 110 if (!layer_tree_host()) |
| 118 return; | 111 return; |
| 119 DCHECK(!destroy_sequence_.is_null()); | 112 DCHECK(!destroy_sequence_.is_null()); |
| 120 scoped_ptr<SatisfySwapPromise> satisfy( | 113 scoped_ptr<SatisfySwapPromise> satisfy( |
| 121 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); | 114 new SatisfySwapPromise(destroy_sequence_, satisfy_callback_)); |
| 122 layer_tree_host()->QueueSwapPromise(satisfy.Pass()); | 115 layer_tree_host()->QueueSwapPromise(satisfy.Pass()); |
| 123 destroy_sequence_ = SurfaceSequence(); | 116 destroy_sequence_ = SurfaceSequence(); |
| 124 } | 117 } |
| 125 | 118 |
| 126 } // namespace cc | 119 } // namespace cc |
| OLD | NEW |