| 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 3667 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3678 | 3678 |
| 3679 bool GLRenderer::IsContextLost() { | 3679 bool GLRenderer::IsContextLost() { |
| 3680 return gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR; | 3680 return gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR; |
| 3681 } | 3681 } |
| 3682 | 3682 |
| 3683 void GLRenderer::ScheduleCALayers(DrawingFrame* frame) { | 3683 void GLRenderer::ScheduleCALayers(DrawingFrame* frame) { |
| 3684 for (const CALayerOverlay& ca_layer_overlay : frame->ca_layer_overlay_list) { | 3684 for (const CALayerOverlay& ca_layer_overlay : frame->ca_layer_overlay_list) { |
| 3685 unsigned texture_id = 0; | 3685 unsigned texture_id = 0; |
| 3686 if (ca_layer_overlay.contents_resource_id) { | 3686 if (ca_layer_overlay.contents_resource_id) { |
| 3687 pending_overlay_resources_.push_back( | 3687 pending_overlay_resources_.push_back( |
| 3688 base::WrapUnique(new ResourceProvider::ScopedReadLockGpuMemoryBuffer( | 3688 base::WrapUnique(new ResourceProvider::ScopedReadLockGL( |
| 3689 resource_provider_, ca_layer_overlay.contents_resource_id))); | 3689 resource_provider_, ca_layer_overlay.contents_resource_id))); |
| 3690 texture_id = pending_overlay_resources_.back()->texture_id(); | 3690 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3691 } | 3691 } |
| 3692 GLfloat contents_rect[4] = { | 3692 GLfloat contents_rect[4] = { |
| 3693 ca_layer_overlay.contents_rect.x(), ca_layer_overlay.contents_rect.y(), | 3693 ca_layer_overlay.contents_rect.x(), ca_layer_overlay.contents_rect.y(), |
| 3694 ca_layer_overlay.contents_rect.width(), | 3694 ca_layer_overlay.contents_rect.width(), |
| 3695 ca_layer_overlay.contents_rect.height(), | 3695 ca_layer_overlay.contents_rect.height(), |
| 3696 }; | 3696 }; |
| 3697 GLfloat bounds_rect[4] = { | 3697 GLfloat bounds_rect[4] = { |
| 3698 ca_layer_overlay.bounds_rect.x(), ca_layer_overlay.bounds_rect.y(), | 3698 ca_layer_overlay.bounds_rect.x(), ca_layer_overlay.bounds_rect.y(), |
| (...skipping 22 matching lines...) Expand all Loading... |
| 3721 return; | 3721 return; |
| 3722 | 3722 |
| 3723 OverlayCandidateList& overlays = frame->overlay_list; | 3723 OverlayCandidateList& overlays = frame->overlay_list; |
| 3724 for (const OverlayCandidate& overlay : overlays) { | 3724 for (const OverlayCandidate& overlay : overlays) { |
| 3725 unsigned texture_id = 0; | 3725 unsigned texture_id = 0; |
| 3726 if (overlay.use_output_surface_for_resource) { | 3726 if (overlay.use_output_surface_for_resource) { |
| 3727 texture_id = output_surface_->GetOverlayTextureId(); | 3727 texture_id = output_surface_->GetOverlayTextureId(); |
| 3728 DCHECK(texture_id || IsContextLost()); | 3728 DCHECK(texture_id || IsContextLost()); |
| 3729 } else { | 3729 } else { |
| 3730 pending_overlay_resources_.push_back( | 3730 pending_overlay_resources_.push_back( |
| 3731 base::WrapUnique(new ResourceProvider::ScopedReadLockGpuMemoryBuffer( | 3731 base::WrapUnique(new ResourceProvider::ScopedReadLockGL( |
| 3732 resource_provider_, overlay.resource_id))); | 3732 resource_provider_, overlay.resource_id))); |
| 3733 texture_id = pending_overlay_resources_.back()->texture_id(); | 3733 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3734 } | 3734 } |
| 3735 | 3735 |
| 3736 context_support_->ScheduleOverlayPlane( | 3736 context_support_->ScheduleOverlayPlane( |
| 3737 overlay.plane_z_order, overlay.transform, texture_id, | 3737 overlay.plane_z_order, overlay.transform, texture_id, |
| 3738 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3738 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3739 } | 3739 } |
| 3740 } | 3740 } |
| 3741 | 3741 |
| 3742 } // namespace cc | 3742 } // namespace cc |
| OLD | NEW |