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/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 if (swapped_since_resize_ && output_surface_ && | 121 if (swapped_since_resize_ && output_surface_ && |
122 output_surface_->context_provider()) | 122 output_surface_->context_provider()) |
123 output_surface_->context_provider()->ContextGL()->ShallowFinishCHROMIUM(); | 123 output_surface_->context_provider()->ContextGL()->ShallowFinishCHROMIUM(); |
124 } | 124 } |
125 swapped_since_resize_ = false; | 125 swapped_since_resize_ = false; |
126 current_surface_size_ = size; | 126 current_surface_size_ = size; |
127 if (scheduler_) | 127 if (scheduler_) |
128 scheduler_->DisplayResized(); | 128 scheduler_->DisplayResized(); |
129 } | 129 } |
130 | 130 |
| 131 void Display::SetColorSpace(const gfx::ColorSpace& color_space) { |
| 132 device_color_space_ = color_space; |
| 133 } |
| 134 |
131 void Display::SetExternalClip(const gfx::Rect& clip) { | 135 void Display::SetExternalClip(const gfx::Rect& clip) { |
132 external_clip_ = clip; | 136 external_clip_ = clip; |
133 } | 137 } |
134 | 138 |
135 void Display::SetOutputIsSecure(bool secure) { | 139 void Display::SetOutputIsSecure(bool secure) { |
136 if (secure == output_is_secure_) | 140 if (secure == output_is_secure_) |
137 return; | 141 return; |
138 output_is_secure_ = secure; | 142 output_is_secure_ = secure; |
139 | 143 |
140 if (aggregator_) { | 144 if (aggregator_) { |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 288 |
285 if (should_draw) { | 289 if (should_draw) { |
286 gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_); | 290 gfx::Rect device_viewport_rect = gfx::Rect(current_surface_size_); |
287 gfx::Rect device_clip_rect = | 291 gfx::Rect device_clip_rect = |
288 external_clip_.IsEmpty() ? device_viewport_rect : external_clip_; | 292 external_clip_.IsEmpty() ? device_viewport_rect : external_clip_; |
289 bool disable_picture_quad_image_filtering = false; | 293 bool disable_picture_quad_image_filtering = false; |
290 | 294 |
291 renderer_->DecideRenderPassAllocationsForFrame( | 295 renderer_->DecideRenderPassAllocationsForFrame( |
292 frame_data->render_pass_list); | 296 frame_data->render_pass_list); |
293 renderer_->DrawFrame(&frame_data->render_pass_list, device_scale_factor_, | 297 renderer_->DrawFrame(&frame_data->render_pass_list, device_scale_factor_, |
294 device_viewport_rect, device_clip_rect, | 298 device_color_space_, device_viewport_rect, |
| 299 device_clip_rect, |
295 disable_picture_quad_image_filtering); | 300 disable_picture_quad_image_filtering); |
296 } else { | 301 } else { |
297 TRACE_EVENT_INSTANT0("cc", "Draw skipped.", TRACE_EVENT_SCOPE_THREAD); | 302 TRACE_EVENT_INSTANT0("cc", "Draw skipped.", TRACE_EVENT_SCOPE_THREAD); |
298 } | 303 } |
299 | 304 |
300 bool should_swap = should_draw && size_matches; | 305 bool should_swap = should_draw && size_matches; |
301 if (should_swap) { | 306 if (should_swap) { |
302 swapped_since_resize_ = true; | 307 swapped_since_resize_ = true; |
303 for (auto& latency : frame.metadata.latency_info) { | 308 for (auto& latency : frame.metadata.latency_info) { |
304 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", | 309 TRACE_EVENT_WITH_FLOW1("input,benchmark", "LatencyInfo.Flow", |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
410 | 415 |
411 if (surface_id == current_surface_id_) | 416 if (surface_id == current_surface_id_) |
412 UpdateRootSurfaceResourcesLocked(); | 417 UpdateRootSurfaceResourcesLocked(); |
413 } | 418 } |
414 | 419 |
415 SurfaceId Display::CurrentSurfaceId() { | 420 SurfaceId Display::CurrentSurfaceId() { |
416 return current_surface_id_; | 421 return current_surface_id_; |
417 } | 422 } |
418 | 423 |
419 } // namespace cc | 424 } // namespace cc |
OLD | NEW |