| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" | 5 #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_s
urface.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/output/output_surface_client.h" | 8 #include "cc/output/output_surface_client.h" |
| 9 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" | 9 #include "content/browser/compositor/browser_compositor_overlay_candidate_valida
tor.h" |
| 10 #include "content/browser/compositor/buffer_queue.h" | 10 #include "content/browser/compositor/buffer_queue.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 output_surface_.reset(new BufferQueue( | 50 output_surface_.reset(new BufferQueue( |
| 51 context_provider_, target, internalformat_, gl_helper_.get(), | 51 context_provider_, target, internalformat_, gl_helper_.get(), |
| 52 gpu_memory_buffer_manager_, surface_id)); | 52 gpu_memory_buffer_manager_, surface_id)); |
| 53 output_surface_->Initialize(); | 53 output_surface_->Initialize(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 GpuSurfacelessBrowserCompositorOutputSurface:: | 56 GpuSurfacelessBrowserCompositorOutputSurface:: |
| 57 ~GpuSurfacelessBrowserCompositorOutputSurface() { | 57 ~GpuSurfacelessBrowserCompositorOutputSurface() { |
| 58 } | 58 } |
| 59 | 59 |
| 60 bool GpuSurfacelessBrowserCompositorOutputSurface::IsDisplayedAsOverlayPlane() | |
| 61 const { | |
| 62 return true; | |
| 63 } | |
| 64 | |
| 65 unsigned GpuSurfacelessBrowserCompositorOutputSurface::GetOverlayTextureId() | 60 unsigned GpuSurfacelessBrowserCompositorOutputSurface::GetOverlayTextureId() |
| 66 const { | 61 const { |
| 67 return output_surface_->current_texture_id(); | 62 return output_surface_->current_texture_id(); |
| 68 } | 63 } |
| 69 | 64 |
| 70 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( | 65 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( |
| 71 cc::CompositorFrame* frame) { | 66 cc::CompositorFrame* frame) { |
| 72 DCHECK(output_surface_); | 67 DCHECK(output_surface_); |
| 68 |
| 69 GLuint texture = output_surface_->current_texture_id(); |
| 73 output_surface_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect); | 70 output_surface_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect); |
| 71 const gfx::Size& size = frame->gl_frame_data->size; |
| 72 context_provider_->ContextGL()->ScheduleOverlayPlaneCHROMIUM( |
| 73 0, |
| 74 GL_OVERLAY_TRANSFORM_NONE_CHROMIUM, |
| 75 texture, |
| 76 0, |
| 77 0, |
| 78 size.width(), |
| 79 size.height(), |
| 80 0, |
| 81 0, |
| 82 1.0f, |
| 83 1.0f); |
| 74 GpuBrowserCompositorOutputSurface::SwapBuffers(frame); | 84 GpuBrowserCompositorOutputSurface::SwapBuffers(frame); |
| 75 } | 85 } |
| 76 | 86 |
| 77 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() { | 87 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() { |
| 78 DCHECK(output_surface_); | 88 DCHECK(output_surface_); |
| 79 output_surface_->PageFlipComplete(); | 89 output_surface_->PageFlipComplete(); |
| 80 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete(); | 90 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete(); |
| 81 } | 91 } |
| 82 | 92 |
| 83 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { | 93 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 114 #endif | 124 #endif |
| 115 } | 125 } |
| 116 | 126 |
| 117 #if defined(OS_MACOSX) | 127 #if defined(OS_MACOSX) |
| 118 void GpuSurfacelessBrowserCompositorOutputSurface::OnSurfaceDisplayed() { | 128 void GpuSurfacelessBrowserCompositorOutputSurface::OnSurfaceDisplayed() { |
| 119 OnSwapBuffersComplete(); | 129 OnSwapBuffersComplete(); |
| 120 } | 130 } |
| 121 #endif | 131 #endif |
| 122 | 132 |
| 123 } // namespace content | 133 } // namespace content |
| OLD | NEW |