| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ui/aura/local/window_port_local.h" | 5 #include "ui/aura/local/window_port_local.h" |
| 6 | 6 |
| 7 #include "cc/surfaces/surface_manager.h" | 7 #include "cc/surfaces/surface_manager.h" |
| 8 #include "ui/aura/client/cursor_client.h" | 8 #include "ui/aura/client/cursor_client.h" |
| 9 #include "ui/aura/env.h" | 9 #include "ui/aura/env.h" |
| 10 #include "ui/aura/local/compositor_frame_sink_local.h" | 10 #include "ui/aura/local/compositor_frame_sink_local.h" |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 | 122 |
| 123 void WindowPortLocal::OnWillRemoveWindowFromRootWindow() { | 123 void WindowPortLocal::OnWillRemoveWindowFromRootWindow() { |
| 124 if (frame_sink_id_.is_valid()) | 124 if (frame_sink_id_.is_valid()) |
| 125 window_->layer()->GetCompositor()->RemoveFrameSink(frame_sink_id_); | 125 window_->layer()->GetCompositor()->RemoveFrameSink(frame_sink_id_); |
| 126 } | 126 } |
| 127 | 127 |
| 128 void WindowPortLocal::OnSurfaceChanged(const cc::SurfaceId& surface_id, | 128 void WindowPortLocal::OnSurfaceChanged(const cc::SurfaceId& surface_id, |
| 129 const gfx::Size& surface_size) { | 129 const gfx::Size& surface_size) { |
| 130 DCHECK_EQ(surface_id.frame_sink_id(), frame_sink_id_); | 130 DCHECK_EQ(surface_id.frame_sink_id(), frame_sink_id_); |
| 131 local_surface_id_ = surface_id.local_surface_id(); | 131 local_surface_id_ = surface_id.local_surface_id(); |
| 132 // The bounds must be updated before switching to the new surface, because | |
| 133 // the layer may be mirrored, in which case a surface change causes the | |
| 134 // mirror layer to update its surface using the latest bounds. | |
| 135 window_->layer()->SetBounds( | |
| 136 gfx::Rect(window_->layer()->bounds().origin(), surface_size)); | |
| 137 cc::SurfaceInfo surface_info(surface_id, 1.0f, surface_size); | 132 cc::SurfaceInfo surface_info(surface_id, 1.0f, surface_size); |
| 138 scoped_refptr<cc::SurfaceReferenceFactory> reference_factory = | 133 scoped_refptr<cc::SurfaceReferenceFactory> reference_factory = |
| 139 aura::Env::GetInstance() | 134 aura::Env::GetInstance() |
| 140 ->context_factory_private() | 135 ->context_factory_private() |
| 141 ->GetSurfaceManager() | 136 ->GetSurfaceManager() |
| 142 ->reference_factory(); | 137 ->reference_factory(); |
| 143 window_->layer()->SetShowPrimarySurface(surface_info, reference_factory); | 138 window_->layer()->SetShowPrimarySurface(surface_info, reference_factory); |
| 144 window_->layer()->SetFallbackSurface(surface_info); | 139 window_->layer()->SetFallbackSurface(surface_info); |
| 145 } | 140 } |
| 146 | 141 |
| 147 } // namespace aura | 142 } // namespace aura |
| OLD | NEW |