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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 swapped_since_resize_ = false; | 139 swapped_since_resize_ = false; |
140 current_surface_size_ = size; | 140 current_surface_size_ = size; |
141 if (scheduler_) | 141 if (scheduler_) |
142 scheduler_->DisplayResized(); | 142 scheduler_->DisplayResized(); |
143 } | 143 } |
144 | 144 |
145 void Display::SetColorSpace(const gfx::ColorSpace& color_space) { | 145 void Display::SetColorSpace(const gfx::ColorSpace& color_space) { |
146 device_color_space_ = color_space; | 146 device_color_space_ = color_space; |
147 } | 147 } |
148 | 148 |
149 void Display::SetExternalClip(const gfx::Rect& clip) { | |
150 external_clip_ = clip; | |
151 } | |
152 | |
153 void Display::SetExternalViewport(const gfx::Rect& viewport) { | |
154 external_viewport_ = viewport; | |
155 } | |
156 | |
157 void Display::SetOutputIsSecure(bool secure) { | 149 void Display::SetOutputIsSecure(bool secure) { |
158 if (secure == output_is_secure_) | 150 if (secure == output_is_secure_) |
159 return; | 151 return; |
160 output_is_secure_ = secure; | 152 output_is_secure_ = secure; |
161 | 153 |
162 if (aggregator_) { | 154 if (aggregator_) { |
163 aggregator_->set_output_is_secure(secure); | 155 aggregator_->set_output_is_secure(secure); |
164 // Force a redraw. | 156 // Force a redraw. |
165 if (!current_surface_id_.is_null()) | 157 if (!current_surface_id_.is_null()) |
166 aggregator_->SetFullDamageForSurface(current_surface_id_); | 158 aggregator_->SetFullDamageForSurface(current_surface_id_); |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 // likely destroyed. | 282 // likely destroyed. |
291 if (output_surface_->SurfaceIsSuspendForRecycle()) { | 283 if (output_surface_->SurfaceIsSuspendForRecycle()) { |
292 TRACE_EVENT_INSTANT0("cc", "Surface is suspended for recycle.", | 284 TRACE_EVENT_INSTANT0("cc", "Surface is suspended for recycle.", |
293 TRACE_EVENT_SCOPE_THREAD); | 285 TRACE_EVENT_SCOPE_THREAD); |
294 should_draw = false; | 286 should_draw = false; |
295 } | 287 } |
296 | 288 |
297 client_->DisplayWillDrawAndSwap(should_draw, frame_data->render_pass_list); | 289 client_->DisplayWillDrawAndSwap(should_draw, frame_data->render_pass_list); |
298 | 290 |
299 if (should_draw) { | 291 if (should_draw) { |
300 gfx::Rect device_viewport_rect = external_viewport_.IsEmpty() | 292 gfx::Rect device_viewport_rect(current_surface_size_); |
301 ? gfx::Rect(current_surface_size_) | 293 gfx::Rect device_clip_rect(current_surface_size_); |
302 : external_viewport_; | |
303 gfx::Rect device_clip_rect = | |
304 external_clip_.IsEmpty() ? device_viewport_rect : external_clip_; | |
305 | 294 |
306 bool disable_image_filtering = | 295 bool disable_image_filtering = |
307 frame.metadata.is_resourceless_software_draw_with_scroll_or_animation; | 296 frame.metadata.is_resourceless_software_draw_with_scroll_or_animation; |
308 if (software_renderer_) { | 297 if (software_renderer_) { |
309 software_renderer_->SetDisablePictureQuadImageFiltering( | 298 software_renderer_->SetDisablePictureQuadImageFiltering( |
310 disable_image_filtering); | 299 disable_image_filtering); |
311 } else { | 300 } else { |
312 // This should only be set for software draws in synchronous compositor. | 301 // This should only be set for software draws in synchronous compositor. |
313 DCHECK(!disable_image_filtering); | 302 DCHECK(!disable_image_filtering); |
314 } | 303 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 const SurfaceId& Display::CurrentSurfaceId() { | 419 const SurfaceId& Display::CurrentSurfaceId() { |
431 return current_surface_id_; | 420 return current_surface_id_; |
432 } | 421 } |
433 | 422 |
434 void Display::ForceImmediateDrawAndSwapIfPossible() { | 423 void Display::ForceImmediateDrawAndSwapIfPossible() { |
435 if (scheduler_) | 424 if (scheduler_) |
436 scheduler_->ForceImmediateSwapIfPossible(); | 425 scheduler_->ForceImmediateSwapIfPossible(); |
437 } | 426 } |
438 | 427 |
439 } // namespace cc | 428 } // namespace cc |
OLD | NEW |