| 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 |
| 60 unsigned GpuSurfacelessBrowserCompositorOutputSurface::GetOverlayTextureId() | 65 unsigned GpuSurfacelessBrowserCompositorOutputSurface::GetOverlayTextureId() |
| 61 const { | 66 const { |
| 62 return output_surface_->current_texture_id(); | 67 return output_surface_->current_texture_id(); |
| 63 } | 68 } |
| 64 | 69 |
| 65 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( | 70 void GpuSurfacelessBrowserCompositorOutputSurface::SwapBuffers( |
| 66 cc::CompositorFrame* frame) { | 71 cc::CompositorFrame* frame) { |
| 67 DCHECK(output_surface_); | 72 DCHECK(output_surface_); |
| 68 | |
| 69 GLuint texture = output_surface_->current_texture_id(); | |
| 70 output_surface_->SwapBuffers(frame->gl_frame_data->sub_buffer_rect); | 73 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); | |
| 84 GpuBrowserCompositorOutputSurface::SwapBuffers(frame); | 74 GpuBrowserCompositorOutputSurface::SwapBuffers(frame); |
| 85 } | 75 } |
| 86 | 76 |
| 87 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() { | 77 void GpuSurfacelessBrowserCompositorOutputSurface::OnSwapBuffersComplete() { |
| 88 DCHECK(output_surface_); | 78 DCHECK(output_surface_); |
| 89 output_surface_->PageFlipComplete(); | 79 output_surface_->PageFlipComplete(); |
| 90 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete(); | 80 GpuBrowserCompositorOutputSurface::OnSwapBuffersComplete(); |
| 91 } | 81 } |
| 92 | 82 |
| 93 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { | 83 void GpuSurfacelessBrowserCompositorOutputSurface::BindFramebuffer() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 124 #endif | 114 #endif |
| 125 } | 115 } |
| 126 | 116 |
| 127 #if defined(OS_MACOSX) | 117 #if defined(OS_MACOSX) |
| 128 void GpuSurfacelessBrowserCompositorOutputSurface::OnSurfaceDisplayed() { | 118 void GpuSurfacelessBrowserCompositorOutputSurface::OnSurfaceDisplayed() { |
| 129 OnSwapBuffersComplete(); | 119 OnSwapBuffersComplete(); |
| 130 } | 120 } |
| 131 #endif | 121 #endif |
| 132 | 122 |
| 133 } // namespace content | 123 } // namespace content |
| OLD | NEW |