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