| 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 2434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2445 current_sync_query_->End(); | 2445 current_sync_query_->End(); |
| 2446 pending_sync_queries_.push_back(current_sync_query_.Pass()); | 2446 pending_sync_queries_.push_back(current_sync_query_.Pass()); |
| 2447 } | 2447 } |
| 2448 | 2448 |
| 2449 current_framebuffer_lock_ = nullptr; | 2449 current_framebuffer_lock_ = nullptr; |
| 2450 swap_buffer_rect_.Union(frame->root_damage_rect); | 2450 swap_buffer_rect_.Union(frame->root_damage_rect); |
| 2451 | 2451 |
| 2452 gl_->Disable(GL_BLEND); | 2452 gl_->Disable(GL_BLEND); |
| 2453 blend_shadow_ = false; | 2453 blend_shadow_ = false; |
| 2454 | 2454 |
| 2455 ScheduleCALayers(frame); |
| 2455 ScheduleOverlays(frame); | 2456 ScheduleOverlays(frame); |
| 2456 } | 2457 } |
| 2457 | 2458 |
| 2458 void GLRenderer::FinishDrawingQuadList() { | 2459 void GLRenderer::FinishDrawingQuadList() { |
| 2459 FlushTextureQuadCache(SHARED_BINDING); | 2460 FlushTextureQuadCache(SHARED_BINDING); |
| 2460 } | 2461 } |
| 2461 | 2462 |
| 2462 bool GLRenderer::FlippedFramebuffer(const DrawingFrame* frame) const { | 2463 bool GLRenderer::FlippedFramebuffer(const DrawingFrame* frame) const { |
| 2463 if (frame->current_render_pass != frame->root_render_pass) | 2464 if (frame->current_render_pass != frame->root_render_pass) |
| 2464 return true; | 2465 return true; |
| (...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3520 // Call SetViewport directly, rather than through PrepareSurfaceForPass. | 3521 // Call SetViewport directly, rather than through PrepareSurfaceForPass. |
| 3521 // PrepareSurfaceForPass also clears the surface, which is not desired when | 3522 // PrepareSurfaceForPass also clears the surface, which is not desired when |
| 3522 // restoring. | 3523 // restoring. |
| 3523 SetViewport(); | 3524 SetViewport(); |
| 3524 } | 3525 } |
| 3525 | 3526 |
| 3526 bool GLRenderer::IsContextLost() { | 3527 bool GLRenderer::IsContextLost() { |
| 3527 return gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR; | 3528 return gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR; |
| 3528 } | 3529 } |
| 3529 | 3530 |
| 3531 void GLRenderer::ScheduleCALayers(DrawingFrame* frame) { |
| 3532 for (const CALayerOverlay& ca_layer_overlay : frame->ca_layer_overlay_list) { |
| 3533 unsigned texture_id = 0; |
| 3534 if (ca_layer_overlay.contents_resource_id) { |
| 3535 pending_overlay_resources_.push_back( |
| 3536 make_scoped_ptr(new ResourceProvider::ScopedReadLockGL( |
| 3537 resource_provider_, ca_layer_overlay.contents_resource_id))); |
| 3538 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3539 } |
| 3540 GLfloat contents_rect[4] = { |
| 3541 ca_layer_overlay.contents_rect.x(), ca_layer_overlay.contents_rect.y(), |
| 3542 ca_layer_overlay.contents_rect.width(), |
| 3543 ca_layer_overlay.contents_rect.height(), |
| 3544 }; |
| 3545 GLfloat bounds_size[2] = { |
| 3546 ca_layer_overlay.bounds_size.width(), |
| 3547 ca_layer_overlay.bounds_size.height(), |
| 3548 }; |
| 3549 GLfloat transform[16]; |
| 3550 ca_layer_overlay.transform.asColMajorf(transform); |
| 3551 gl_->ScheduleCALayerCHROMIUM( |
| 3552 texture_id, contents_rect, ca_layer_overlay.opacity, |
| 3553 ca_layer_overlay.background_color, bounds_size, transform); |
| 3554 } |
| 3555 } |
| 3556 |
| 3530 void GLRenderer::ScheduleOverlays(DrawingFrame* frame) { | 3557 void GLRenderer::ScheduleOverlays(DrawingFrame* frame) { |
| 3531 if (!frame->overlay_list.size()) | 3558 if (!frame->overlay_list.size()) |
| 3532 return; | 3559 return; |
| 3533 | 3560 |
| 3534 OverlayCandidateList& overlays = frame->overlay_list; | 3561 OverlayCandidateList& overlays = frame->overlay_list; |
| 3535 for (const OverlayCandidate& overlay : overlays) { | 3562 for (const OverlayCandidate& overlay : overlays) { |
| 3536 unsigned texture_id = 0; | 3563 unsigned texture_id = 0; |
| 3537 if (overlay.use_output_surface_for_resource) { | 3564 if (overlay.use_output_surface_for_resource) { |
| 3538 texture_id = output_surface_->GetOverlayTextureId(); | 3565 texture_id = output_surface_->GetOverlayTextureId(); |
| 3539 DCHECK(texture_id || IsContextLost()); | 3566 DCHECK(texture_id || IsContextLost()); |
| 3540 } else { | 3567 } else { |
| 3541 pending_overlay_resources_.push_back( | 3568 pending_overlay_resources_.push_back( |
| 3542 make_scoped_ptr(new ResourceProvider::ScopedReadLockGL( | 3569 make_scoped_ptr(new ResourceProvider::ScopedReadLockGL( |
| 3543 resource_provider_, overlay.resource_id))); | 3570 resource_provider_, overlay.resource_id))); |
| 3544 texture_id = pending_overlay_resources_.back()->texture_id(); | 3571 texture_id = pending_overlay_resources_.back()->texture_id(); |
| 3545 } | 3572 } |
| 3546 | 3573 |
| 3547 context_support_->ScheduleOverlayPlane( | 3574 context_support_->ScheduleOverlayPlane( |
| 3548 overlay.plane_z_order, overlay.transform, texture_id, | 3575 overlay.plane_z_order, overlay.transform, texture_id, |
| 3549 ToNearestRect(overlay.display_rect), overlay.uv_rect); | 3576 ToNearestRect(overlay.display_rect), overlay.uv_rect); |
| 3550 } | 3577 } |
| 3551 } | 3578 } |
| 3552 | 3579 |
| 3553 } // namespace cc | 3580 } // namespace cc |
| OLD | NEW |