OLD | NEW |
---|---|
1 // Copyright 2010 The Chromium Authors. All rights reserved. | 1 // Copyright 2010 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/output/gl_renderer.h" | 5 #include "cc/output/gl_renderer.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 2589 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2600 | 2600 |
2601 TRACE_EVENT0("cc,benchmark", "GLRenderer::SwapBuffers"); | 2601 TRACE_EVENT0("cc,benchmark", "GLRenderer::SwapBuffers"); |
2602 // We're done! Time to swapbuffers! | 2602 // We're done! Time to swapbuffers! |
2603 | 2603 |
2604 gfx::Size surface_size = output_surface_->SurfaceSize(); | 2604 gfx::Size surface_size = output_surface_->SurfaceSize(); |
2605 | 2605 |
2606 CompositorFrame compositor_frame; | 2606 CompositorFrame compositor_frame; |
2607 compositor_frame.metadata = metadata; | 2607 compositor_frame.metadata = metadata; |
2608 compositor_frame.gl_frame_data = make_scoped_ptr(new GLFrameData); | 2608 compositor_frame.gl_frame_data = make_scoped_ptr(new GLFrameData); |
2609 compositor_frame.gl_frame_data->size = surface_size; | 2609 compositor_frame.gl_frame_data->size = surface_size; |
2610 if (capabilities_.using_partial_swap) { | 2610 // If supported, we can save significant bandwidth by only swapping the |
2611 // If supported, we can save significant bandwidth by only swapping the | 2611 // damaged/scissored region (clamped to the viewport). The surface can |
2612 // damaged/scissored region (clamped to the viewport). | 2612 // choose whether to do a full swap or partial swap. |
piman
2015/11/19 21:22:04
If we do that we need to fix all the OutputSurface
| |
2613 swap_buffer_rect_.Intersect(gfx::Rect(surface_size)); | 2613 swap_buffer_rect_.Intersect(gfx::Rect(surface_size)); |
2614 int flipped_y_pos_of_rect_bottom = surface_size.height() - | 2614 int flipped_y_pos_of_rect_bottom = surface_size.height() - |
2615 swap_buffer_rect_.y() - | 2615 swap_buffer_rect_.y() - |
2616 swap_buffer_rect_.height(); | 2616 swap_buffer_rect_.height(); |
2617 compositor_frame.gl_frame_data->sub_buffer_rect = | 2617 compositor_frame.gl_frame_data->sub_buffer_rect = |
2618 gfx::Rect(swap_buffer_rect_.x(), | 2618 gfx::Rect(swap_buffer_rect_.x(), |
2619 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom | 2619 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom |
2620 : swap_buffer_rect_.y(), | 2620 : swap_buffer_rect_.y(), |
2621 swap_buffer_rect_.width(), | 2621 swap_buffer_rect_.width(), swap_buffer_rect_.height()); |
2622 swap_buffer_rect_.height()); | |
2623 } else { | |
2624 compositor_frame.gl_frame_data->sub_buffer_rect = | |
2625 gfx::Rect(output_surface_->SurfaceSize()); | |
2626 } | |
2627 output_surface_->SwapBuffers(&compositor_frame); | 2622 output_surface_->SwapBuffers(&compositor_frame); |
2628 | 2623 |
2629 // We always hold onto resources for an extra frame, to make sure we don't | 2624 // We always hold onto resources for an extra frame, to make sure we don't |
2630 // update the buffer while it's being scanned out. | 2625 // update the buffer while it's being scanned out. |
2631 previous_swap_overlay_resources_.clear(); | 2626 previous_swap_overlay_resources_.clear(); |
2632 previous_swap_overlay_resources_.swap(in_use_overlay_resources_); | 2627 previous_swap_overlay_resources_.swap(in_use_overlay_resources_); |
2633 | 2628 |
2634 in_use_overlay_resources_.swap(pending_overlay_resources_); | 2629 in_use_overlay_resources_.swap(pending_overlay_resources_); |
2635 | 2630 |
2636 swap_buffer_rect_ = gfx::Rect(); | 2631 swap_buffer_rect_ = gfx::Rect(); |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3571 texture_id = pending_overlay_resources_.back()->texture_id(); | 3566 texture_id = pending_overlay_resources_.back()->texture_id(); |
3572 } | 3567 } |
3573 | 3568 |
3574 context_support_->ScheduleOverlayPlane( | 3569 context_support_->ScheduleOverlayPlane( |
3575 overlay.plane_z_order, overlay.transform, texture_id, | 3570 overlay.plane_z_order, overlay.transform, texture_id, |
3576 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3571 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
3577 } | 3572 } |
3578 } | 3573 } |
3579 | 3574 |
3580 } // namespace cc | 3575 } // namespace cc |
OLD | NEW |