| 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 "services/ui/ws/frame_generator.h" | 5 #include "services/ui/ws/frame_generator.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/containers/adapters.h" | 10 #include "base/containers/adapters.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 widget, std::move(sink_request), binding_.CreateInterfacePtrAndBind(), | 36 widget, std::move(sink_request), binding_.CreateInterfacePtrAndBind(), |
| 37 std::move(display_request)); | 37 std::move(display_request)); |
| 38 } | 38 } |
| 39 | 39 |
| 40 FrameGenerator::~FrameGenerator() = default; | 40 FrameGenerator::~FrameGenerator() = default; |
| 41 | 41 |
| 42 void FrameGenerator::SetDeviceScaleFactor(float device_scale_factor) { | 42 void FrameGenerator::SetDeviceScaleFactor(float device_scale_factor) { |
| 43 if (device_scale_factor_ == device_scale_factor) | 43 if (device_scale_factor_ == device_scale_factor) |
| 44 return; | 44 return; |
| 45 device_scale_factor_ = device_scale_factor; | 45 device_scale_factor_ = device_scale_factor; |
| 46 compositor_frame_sink_->SetNeedsBeginFrame(true); | 46 if (window_manager_surface_info_.id().is_valid()) |
| 47 compositor_frame_sink_->SetNeedsBeginFrame(true); |
| 47 } | 48 } |
| 48 | 49 |
| 49 void FrameGenerator::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { | 50 void FrameGenerator::OnSurfaceCreated(const cc::SurfaceInfo& surface_info) { |
| 50 DCHECK(surface_info.id().is_valid()); | 51 DCHECK(surface_info.id().is_valid()); |
| 51 | 52 |
| 52 // Only handle embedded surfaces changing here. The display root surface | 53 // Only handle embedded surfaces changing here. The display root surface |
| 53 // changing is handled immediately after the CompositorFrame is submitted. | 54 // changing is handled immediately after the CompositorFrame is submitted. |
| 54 if (surface_info != window_manager_surface_info_) { | 55 if (surface_info != window_manager_surface_info_) { |
| 55 window_manager_surface_info_ = surface_info; | 56 window_manager_surface_info_ = surface_info; |
| 56 compositor_frame_sink_->SetNeedsBeginFrame(true); | 57 compositor_frame_sink_->SetNeedsBeginFrame(true); |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); | 168 auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
| 168 quad->SetAll(sqs, bounds_at_origin /* rect */, gfx::Rect() /* opaque_rect */, | 169 quad->SetAll(sqs, bounds_at_origin /* rect */, gfx::Rect() /* opaque_rect */, |
| 169 bounds_at_origin /* visible_rect */, true /* needs_blending*/, | 170 bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
| 170 window_manager_surface_info_.id(), | 171 window_manager_surface_info_.id(), |
| 171 cc::SurfaceDrawQuadType::PRIMARY, nullptr); | 172 cc::SurfaceDrawQuadType::PRIMARY, nullptr); |
| 172 } | 173 } |
| 173 | 174 |
| 174 } // namespace ws | 175 } // namespace ws |
| 175 | 176 |
| 176 } // namespace ui | 177 } // namespace ui |
| OLD | NEW |