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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 2630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2641 // damaged/scissored region (clamped to the viewport). | 2641 // damaged/scissored region (clamped to the viewport). |
2642 swap_buffer_rect_.Intersect(gfx::Rect(surface_size)); | 2642 swap_buffer_rect_.Intersect(gfx::Rect(surface_size)); |
2643 int flipped_y_pos_of_rect_bottom = surface_size.height() - | 2643 int flipped_y_pos_of_rect_bottom = surface_size.height() - |
2644 swap_buffer_rect_.y() - | 2644 swap_buffer_rect_.y() - |
2645 swap_buffer_rect_.height(); | 2645 swap_buffer_rect_.height(); |
2646 output_frame.sub_buffer_rect = | 2646 output_frame.sub_buffer_rect = |
2647 gfx::Rect(swap_buffer_rect_.x(), | 2647 gfx::Rect(swap_buffer_rect_.x(), |
2648 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom | 2648 FlippedRootFramebuffer() ? flipped_y_pos_of_rect_bottom |
2649 : swap_buffer_rect_.y(), | 2649 : swap_buffer_rect_.y(), |
2650 swap_buffer_rect_.width(), swap_buffer_rect_.height()); | 2650 swap_buffer_rect_.width(), swap_buffer_rect_.height()); |
2651 } else { | 2651 } else if (swap_buffer_rect_.IsEmpty() && allow_empty_swap_) { |
2652 // Expand the swap rect to the full surface unless it's empty, and empty | |
2653 // swap is allowed. | |
2654 if (!swap_buffer_rect_.IsEmpty() || !allow_empty_swap_) { | |
2655 swap_buffer_rect_ = gfx::Rect(surface_size); | |
2656 } | |
2657 output_frame.sub_buffer_rect = swap_buffer_rect_; | 2652 output_frame.sub_buffer_rect = swap_buffer_rect_; |
2658 } | 2653 } |
2659 | 2654 |
2660 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_)); | 2655 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_)); |
2661 pending_overlay_resources_.clear(); | 2656 pending_overlay_resources_.clear(); |
2662 | 2657 |
2663 output_surface_->SwapBuffers(std::move(output_frame)); | 2658 output_surface_->SwapBuffers(std::move(output_frame)); |
2664 | 2659 |
2665 swap_buffer_rect_ = gfx::Rect(); | 2660 swap_buffer_rect_ = gfx::Rect(); |
2666 } | 2661 } |
(...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3530 return; | 3525 return; |
3531 | 3526 |
3532 // Report GPU overdraw as a percentage of |max_result|. | 3527 // Report GPU overdraw as a percentage of |max_result|. |
3533 TRACE_COUNTER1( | 3528 TRACE_COUNTER1( |
3534 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", | 3529 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", |
3535 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / | 3530 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / |
3536 max_result); | 3531 max_result); |
3537 } | 3532 } |
3538 | 3533 |
3539 } // namespace cc | 3534 } // namespace cc |
OLD | NEW |