| 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/surfaces/display.h" | 5 #include "cc/surfaces/display.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 TRACE_EVENT0("cc", "Display::SetSurfaceId"); | 99 TRACE_EVENT0("cc", "Display::SetSurfaceId"); |
| 100 current_surface_id_ = id; | 100 current_surface_id_ = id; |
| 101 device_scale_factor_ = device_scale_factor; | 101 device_scale_factor_ = device_scale_factor; |
| 102 | 102 |
| 103 UpdateRootSurfaceResourcesLocked(); | 103 UpdateRootSurfaceResourcesLocked(); |
| 104 if (scheduler_) | 104 if (scheduler_) |
| 105 scheduler_->SetNewRootSurface(id); | 105 scheduler_->SetNewRootSurface(id); |
| 106 } | 106 } |
| 107 | 107 |
| 108 void Display::SetVisible(bool visible) { |
| 109 TRACE_EVENT1("cc", "Display::SetVisible", "visible", visible); |
| 110 if (renderer_) |
| 111 renderer_->SetVisible(visible); |
| 112 if (scheduler_) |
| 113 scheduler_->SetVisible(visible); |
| 114 visible_ = visible; |
| 115 } |
| 116 |
| 108 void Display::Resize(const gfx::Size& size) { | 117 void Display::Resize(const gfx::Size& size) { |
| 109 if (size == current_surface_size_) | 118 if (size == current_surface_size_) |
| 110 return; | 119 return; |
| 111 | 120 |
| 112 TRACE_EVENT0("cc", "Display::Resize"); | 121 TRACE_EVENT0("cc", "Display::Resize"); |
| 113 | 122 |
| 114 // Need to ensure all pending swaps have executed before the window is | 123 // Need to ensure all pending swaps have executed before the window is |
| 115 // resized, or D3D11 will scale the swap output. | 124 // resized, or D3D11 will scale the swap output. |
| 116 if (settings_.finish_rendering_on_resize) { | 125 if (settings_.finish_rendering_on_resize) { |
| 117 if (!swapped_since_resize_ && scheduler_) | 126 if (!swapped_since_resize_ && scheduler_) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 NOTREACHED(); | 184 NOTREACHED(); |
| 176 #endif | 185 #endif |
| 177 } else { | 186 } else { |
| 178 auto renderer = base::MakeUnique<SoftwareRenderer>( | 187 auto renderer = base::MakeUnique<SoftwareRenderer>( |
| 179 this, &settings_, output_surface_.get(), resource_provider_.get()); | 188 this, &settings_, output_surface_.get(), resource_provider_.get()); |
| 180 software_renderer_ = renderer.get(); | 189 software_renderer_ = renderer.get(); |
| 181 renderer_ = std::move(renderer); | 190 renderer_ = std::move(renderer); |
| 182 } | 191 } |
| 183 | 192 |
| 184 renderer_->SetEnlargePassTextureAmount(enlarge_texture_amount_); | 193 renderer_->SetEnlargePassTextureAmount(enlarge_texture_amount_); |
| 194 renderer_->SetVisible(visible_); |
| 185 | 195 |
| 186 // TODO(jbauman): Outputting an incomplete quad list doesn't work when using | 196 // TODO(jbauman): Outputting an incomplete quad list doesn't work when using |
| 187 // overlays. | 197 // overlays. |
| 188 bool output_partial_list = renderer_->Capabilities().using_partial_swap && | 198 bool output_partial_list = renderer_->Capabilities().using_partial_swap && |
| 189 !output_surface_->GetOverlayCandidateValidator(); | 199 !output_surface_->GetOverlayCandidateValidator(); |
| 190 aggregator_.reset(new SurfaceAggregator( | 200 aggregator_.reset(new SurfaceAggregator( |
| 191 surface_manager_, resource_provider_.get(), output_partial_list)); | 201 surface_manager_, resource_provider_.get(), output_partial_list)); |
| 192 aggregator_->set_output_is_secure(output_is_secure_); | 202 aggregator_->set_output_is_secure(output_is_secure_); |
| 193 } | 203 } |
| 194 | 204 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 const SurfaceId& Display::CurrentSurfaceId() { | 430 const SurfaceId& Display::CurrentSurfaceId() { |
| 421 return current_surface_id_; | 431 return current_surface_id_; |
| 422 } | 432 } |
| 423 | 433 |
| 424 void Display::ForceImmediateDrawAndSwapIfPossible() { | 434 void Display::ForceImmediateDrawAndSwapIfPossible() { |
| 425 if (scheduler_) | 435 if (scheduler_) |
| 426 scheduler_->ForceImmediateSwapIfPossible(); | 436 scheduler_->ForceImmediateSwapIfPossible(); |
| 427 } | 437 } |
| 428 | 438 |
| 429 } // namespace cc | 439 } // namespace cc |
| OLD | NEW |