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 { |
danakj
2017/02/22 00:36:57
else if
halliwell
2017/02/22 14:19:27
Done.
| |
2652 // Expand the swap rect to the full surface unless it's empty, and empty | 2652 // Expand the swap rect to the full surface unless it's empty, and empty |
2653 // swap is allowed. | 2653 // swap is allowed. |
2654 if (!swap_buffer_rect_.IsEmpty() || !allow_empty_swap_) { | 2654 if (swap_buffer_rect_.IsEmpty() && allow_empty_swap_) { |
2655 output_frame.sub_buffer_rect = swap_buffer_rect_; | |
2656 } else { | |
danakj
2017/02/22 00:36:57
i dont think we need this else, we clear the rect
halliwell
2017/02/22 14:19:27
Done.
| |
2655 swap_buffer_rect_ = gfx::Rect(surface_size); | 2657 swap_buffer_rect_ = gfx::Rect(surface_size); |
2656 } | 2658 } |
2657 output_frame.sub_buffer_rect = swap_buffer_rect_; | |
2658 } | 2659 } |
2659 | 2660 |
2660 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_)); | 2661 swapping_overlay_resources_.push_back(std::move(pending_overlay_resources_)); |
2661 pending_overlay_resources_.clear(); | 2662 pending_overlay_resources_.clear(); |
2662 | 2663 |
2663 output_surface_->SwapBuffers(std::move(output_frame)); | 2664 output_surface_->SwapBuffers(std::move(output_frame)); |
2664 | 2665 |
2665 swap_buffer_rect_ = gfx::Rect(); | 2666 swap_buffer_rect_ = gfx::Rect(); |
2666 } | 2667 } |
2667 | 2668 |
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3530 return; | 3531 return; |
3531 | 3532 |
3532 // Report GPU overdraw as a percentage of |max_result|. | 3533 // Report GPU overdraw as a percentage of |max_result|. |
3533 TRACE_COUNTER1( | 3534 TRACE_COUNTER1( |
3534 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", | 3535 TRACE_DISABLED_BY_DEFAULT("cc.debug.overdraw"), "GPU Overdraw", |
3535 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / | 3536 (std::accumulate(overdraw->begin(), overdraw->end(), 0) * 100) / |
3536 max_result); | 3537 max_result); |
3537 } | 3538 } |
3538 | 3539 |
3539 } // namespace cc | 3540 } // namespace cc |
OLD | NEW |