Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(932)

Side by Side Diff: cc/output/gl_renderer.cc

Issue 2163493002: Break glScheduleCALayerCHROMIUM into smaller functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@temp37_cleanup_calayeroverlay
Patch Set: Comments from piman. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | gpu/GLES2/extensions/CHROMIUM/CHROMIUM_schedule_ca_layer.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 3613 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 // PrepareSurfaceForPass also clears the surface, which is not desired when 3624 // PrepareSurfaceForPass also clears the surface, which is not desired when
3625 // restoring. 3625 // restoring.
3626 SetViewport(); 3626 SetViewport();
3627 } 3627 }
3628 3628
3629 bool GLRenderer::IsContextLost() { 3629 bool GLRenderer::IsContextLost() {
3630 return gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR; 3630 return gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR;
3631 } 3631 }
3632 3632
3633 void GLRenderer::ScheduleCALayers(DrawingFrame* frame) { 3633 void GLRenderer::ScheduleCALayers(DrawingFrame* frame) {
3634 scoped_refptr<CALayerOverlaySharedState> shared_state;
3634 for (const CALayerOverlay& ca_layer_overlay : frame->ca_layer_overlay_list) { 3635 for (const CALayerOverlay& ca_layer_overlay : frame->ca_layer_overlay_list) {
3635 unsigned texture_id = 0; 3636 unsigned texture_id = 0;
3636 if (ca_layer_overlay.contents_resource_id) { 3637 if (ca_layer_overlay.contents_resource_id) {
3637 pending_overlay_resources_.push_back( 3638 pending_overlay_resources_.push_back(
3638 base::WrapUnique(new ResourceProvider::ScopedReadLockGL( 3639 base::WrapUnique(new ResourceProvider::ScopedReadLockGL(
3639 resource_provider_, ca_layer_overlay.contents_resource_id))); 3640 resource_provider_, ca_layer_overlay.contents_resource_id)));
3640 texture_id = pending_overlay_resources_.back()->texture_id(); 3641 texture_id = pending_overlay_resources_.back()->texture_id();
3641 } 3642 }
3642 GLfloat contents_rect[4] = { 3643 GLfloat contents_rect[4] = {
3643 ca_layer_overlay.contents_rect.x(), ca_layer_overlay.contents_rect.y(), 3644 ca_layer_overlay.contents_rect.x(), ca_layer_overlay.contents_rect.y(),
3644 ca_layer_overlay.contents_rect.width(), 3645 ca_layer_overlay.contents_rect.width(),
3645 ca_layer_overlay.contents_rect.height(), 3646 ca_layer_overlay.contents_rect.height(),
3646 }; 3647 };
3647 GLfloat bounds_rect[4] = { 3648 GLfloat bounds_rect[4] = {
3648 ca_layer_overlay.bounds_rect.x(), ca_layer_overlay.bounds_rect.y(), 3649 ca_layer_overlay.bounds_rect.x(), ca_layer_overlay.bounds_rect.y(),
3649 ca_layer_overlay.bounds_rect.width(), 3650 ca_layer_overlay.bounds_rect.width(),
3650 ca_layer_overlay.bounds_rect.height(), 3651 ca_layer_overlay.bounds_rect.height(),
3651 }; 3652 };
3652 GLboolean is_clipped = ca_layer_overlay.shared_state->is_clipped; 3653 GLboolean is_clipped = ca_layer_overlay.shared_state->is_clipped;
3653 GLfloat clip_rect[4] = {ca_layer_overlay.shared_state->clip_rect.x(), 3654 GLfloat clip_rect[4] = {ca_layer_overlay.shared_state->clip_rect.x(),
3654 ca_layer_overlay.shared_state->clip_rect.y(), 3655 ca_layer_overlay.shared_state->clip_rect.y(),
3655 ca_layer_overlay.shared_state->clip_rect.width(), 3656 ca_layer_overlay.shared_state->clip_rect.width(),
3656 ca_layer_overlay.shared_state->clip_rect.height()}; 3657 ca_layer_overlay.shared_state->clip_rect.height()};
3657 GLint sorting_context_id = 3658 GLint sorting_context_id =
3658 ca_layer_overlay.shared_state->sorting_context_id; 3659 ca_layer_overlay.shared_state->sorting_context_id;
3659 GLfloat transform[16]; 3660 GLfloat transform[16];
3660 ca_layer_overlay.shared_state->transform.asColMajorf(transform); 3661 ca_layer_overlay.shared_state->transform.asColMajorf(transform);
3661 unsigned filter = ca_layer_overlay.filter; 3662 unsigned filter = ca_layer_overlay.filter;
3663
3664 if (ca_layer_overlay.shared_state != shared_state) {
3665 shared_state = ca_layer_overlay.shared_state;
3666 gl_->ScheduleCALayerSharedStateCHROMIUM(
3667 ca_layer_overlay.shared_state->opacity, is_clipped, clip_rect,
3668 sorting_context_id, transform);
3669 }
3662 gl_->ScheduleCALayerCHROMIUM( 3670 gl_->ScheduleCALayerCHROMIUM(
3663 texture_id, contents_rect, ca_layer_overlay.shared_state->opacity, 3671 texture_id, contents_rect, ca_layer_overlay.background_color,
3664 ca_layer_overlay.background_color, ca_layer_overlay.edge_aa_mask, 3672 ca_layer_overlay.edge_aa_mask, bounds_rect, filter);
3665 bounds_rect, is_clipped, clip_rect, sorting_context_id, transform,
3666 filter);
3667 } 3673 }
3668 } 3674 }
3669 3675
3670 void GLRenderer::ScheduleOverlays(DrawingFrame* frame) { 3676 void GLRenderer::ScheduleOverlays(DrawingFrame* frame) {
3671 if (frame->overlay_list.empty()) 3677 if (frame->overlay_list.empty())
3672 return; 3678 return;
3673 3679
3674 OverlayCandidateList& overlays = frame->overlay_list; 3680 OverlayCandidateList& overlays = frame->overlay_list;
3675 for (const OverlayCandidate& overlay : overlays) { 3681 for (const OverlayCandidate& overlay : overlays) {
3676 unsigned texture_id = 0; 3682 unsigned texture_id = 0;
3677 if (overlay.use_output_surface_for_resource) { 3683 if (overlay.use_output_surface_for_resource) {
3678 texture_id = output_surface_->GetOverlayTextureId(); 3684 texture_id = output_surface_->GetOverlayTextureId();
3679 DCHECK(texture_id || IsContextLost()); 3685 DCHECK(texture_id || IsContextLost());
3680 } else { 3686 } else {
3681 pending_overlay_resources_.push_back( 3687 pending_overlay_resources_.push_back(
3682 base::WrapUnique(new ResourceProvider::ScopedReadLockGL( 3688 base::WrapUnique(new ResourceProvider::ScopedReadLockGL(
3683 resource_provider_, overlay.resource_id))); 3689 resource_provider_, overlay.resource_id)));
3684 texture_id = pending_overlay_resources_.back()->texture_id(); 3690 texture_id = pending_overlay_resources_.back()->texture_id();
3685 } 3691 }
3686 3692
3687 context_support_->ScheduleOverlayPlane( 3693 context_support_->ScheduleOverlayPlane(
3688 overlay.plane_z_order, overlay.transform, texture_id, 3694 overlay.plane_z_order, overlay.transform, texture_id,
3689 ToNearestRect(overlay.display_rect), overlay.uv_rect); 3695 ToNearestRect(overlay.display_rect), overlay.uv_rect);
3690 } 3696 }
3691 } 3697 }
3692 3698
3693 } // namespace cc 3699 } // namespace cc
OLDNEW
« no previous file with comments | « no previous file | gpu/GLES2/extensions/CHROMIUM/CHROMIUM_schedule_ca_layer.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698