| 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 "content/browser/compositor/browser_compositor_view_private_mac.h" | 5 #include "content/browser/compositor/browser_compositor_view_private_mac.h" |
| 6 | 6 |
| 7 #include "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
| 8 #include "content/browser/compositor/gpu_process_transport_factory.h" | 8 #include "content/browser/compositor/gpu_process_transport_factory.h" |
| 9 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" | 9 #include "content/browser/renderer_host/compositing_iosurface_context_mac.h" |
| 10 #include "content/browser/renderer_host/compositing_iosurface_mac.h" | 10 #include "content/browser/renderer_host/compositing_iosurface_mac.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 // Set the bounds of the accelerated layer to match the size of the frame. | 140 // Set the bounds of the accelerated layer to match the size of the frame. |
| 141 // If the bounds changed, force the content to be displayed immediately. | 141 // If the bounds changed, force the content to be displayed immediately. |
| 142 CGRect new_layer_bounds = CGRectMake( | 142 CGRect new_layer_bounds = CGRectMake( |
| 143 0, | 143 0, |
| 144 0, | 144 0, |
| 145 [accelerated_layer_ iosurface]->dip_io_surface_size().width(), | 145 [accelerated_layer_ iosurface]->dip_io_surface_size().width(), |
| 146 [accelerated_layer_ iosurface]->dip_io_surface_size().height()); | 146 [accelerated_layer_ iosurface]->dip_io_surface_size().height()); |
| 147 bool bounds_changed = !CGRectEqualToRect( | 147 bool bounds_changed = !CGRectEqualToRect( |
| 148 new_layer_bounds, [accelerated_layer_ bounds]); | 148 new_layer_bounds, [accelerated_layer_ bounds]); |
| 149 [accelerated_layer_ setBounds:new_layer_bounds]; | 149 [accelerated_layer_ setBounds:new_layer_bounds]; |
| 150 if (bounds_changed) { | 150 if (bounds_changed) |
| 151 [accelerated_layer_ setNeedsDisplay]; | 151 [accelerated_layer_ setNeedsDisplayAndDisplayAndAck]; |
| 152 [accelerated_layer_ displayIfNeeded]; | |
| 153 } | |
| 154 | 152 |
| 155 // If there was a software layer or an old accelerated layer, remove it. | 153 // If there was a software layer or an old accelerated layer, remove it. |
| 156 // Disable the fade-out animation as the layer is removed. | 154 // Disable the fade-out animation as the layer is removed. |
| 157 { | 155 { |
| 158 [software_layer_ removeFromSuperlayer]; | 156 [software_layer_ removeFromSuperlayer]; |
| 159 software_layer_.reset(); | 157 software_layer_.reset(); |
| 160 [old_accelerated_layer resetClient]; | 158 [old_accelerated_layer resetClient]; |
| 161 [old_accelerated_layer removeFromSuperlayer]; | 159 [old_accelerated_layer removeFromSuperlayer]; |
| 162 old_accelerated_layer.reset(); | 160 old_accelerated_layer.reset(); |
| 163 } | 161 } |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data | 260 - (void)gotSoftwareFrame:(cc::SoftwareFrameData*)frame_data |
| 263 withScaleFactor:(float)scale_factor | 261 withScaleFactor:(float)scale_factor |
| 264 withCanvas:(SkCanvas*)canvas { | 262 withCanvas:(SkCanvas*)canvas { |
| 265 if (!client_) | 263 if (!client_) |
| 266 return; | 264 return; |
| 267 client_->GotSoftwareFrame(frame_data, scale_factor, canvas); | 265 client_->GotSoftwareFrame(frame_data, scale_factor, canvas); |
| 268 } | 266 } |
| 269 | 267 |
| 270 @end // BrowserCompositorViewCocoa | 268 @end // BrowserCompositorViewCocoa |
| 271 | 269 |
| OLD | NEW |