| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/offscreen_browser_compositor_output_surface
.h" | 5 #include "content/browser/compositor/offscreen_browser_compositor_output_surface
.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| 11 #include "cc/output/compositor_frame.h" | |
| 12 #include "cc/output/gl_frame_data.h" | |
| 13 #include "cc/output/output_surface_client.h" | 11 #include "cc/output/output_surface_client.h" |
| 12 #include "cc/output/output_surface_frame.h" |
| 14 #include "cc/resources/resource_provider.h" | 13 #include "cc/resources/resource_provider.h" |
| 15 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" | 14 #include "components/display_compositor/compositor_overlay_candidate_validator.h
" |
| 16 #include "content/browser/compositor/reflector_impl.h" | 15 #include "content/browser/compositor/reflector_impl.h" |
| 17 #include "content/browser/compositor/reflector_texture.h" | 16 #include "content/browser/compositor/reflector_texture.h" |
| 18 #include "content/common/gpu/client/context_provider_command_buffer.h" | 17 #include "content/common/gpu/client/context_provider_command_buffer.h" |
| 19 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
| 20 #include "gpu/command_buffer/client/context_support.h" | 19 #include "gpu/command_buffer/client/context_support.h" |
| 21 #include "gpu/command_buffer/client/gles2_interface.h" | 20 #include "gpu/command_buffer/client/gles2_interface.h" |
| 22 #include "third_party/khronos/GLES2/gl2.h" | 21 #include "third_party/khronos/GLES2/gl2.h" |
| 23 #include "third_party/khronos/GLES2/gl2ext.h" | 22 #include "third_party/khronos/GLES2/gl2ext.h" |
| 24 | 23 |
| 25 using cc::CompositorFrame; | |
| 26 using cc::GLFrameData; | |
| 27 using cc::ResourceProvider; | |
| 28 using gpu::gles2::GLES2Interface; | 24 using gpu::gles2::GLES2Interface; |
| 29 | 25 |
| 30 namespace content { | 26 namespace content { |
| 31 | 27 |
| 32 static cc::ResourceFormat kFboTextureFormat = cc::RGBA_8888; | 28 static cc::ResourceFormat kFboTextureFormat = cc::RGBA_8888; |
| 33 | 29 |
| 34 OffscreenBrowserCompositorOutputSurface:: | 30 OffscreenBrowserCompositorOutputSurface:: |
| 35 OffscreenBrowserCompositorOutputSurface( | 31 OffscreenBrowserCompositorOutputSurface( |
| 36 scoped_refptr<ContextProviderCommandBuffer> context, | 32 scoped_refptr<ContextProviderCommandBuffer> context, |
| 37 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, | 33 scoped_refptr<ui::CompositorVSyncManager> vsync_manager, |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 DCHECK(reflector_texture_.get()); | 123 DCHECK(reflector_texture_.get()); |
| 128 DCHECK(fbo_); | 124 DCHECK(fbo_); |
| 129 | 125 |
| 130 if (need_to_bind) { | 126 if (need_to_bind) { |
| 131 GLES2Interface* gl = context_provider_->ContextGL(); | 127 GLES2Interface* gl = context_provider_->ContextGL(); |
| 132 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); | 128 gl->BindFramebuffer(GL_FRAMEBUFFER, fbo_); |
| 133 } | 129 } |
| 134 } | 130 } |
| 135 | 131 |
| 136 void OffscreenBrowserCompositorOutputSurface::SwapBuffers( | 132 void OffscreenBrowserCompositorOutputSurface::SwapBuffers( |
| 137 cc::CompositorFrame frame) { | 133 cc::OutputSurfaceFrame frame) { |
| 138 gfx::Size surface_size = frame.gl_frame_data->size; | 134 gfx::Size surface_size = frame.size; |
| 139 DCHECK(surface_size == surface_size_); | 135 DCHECK(surface_size == surface_size_); |
| 140 gfx::Rect swap_rect = frame.gl_frame_data->sub_buffer_rect; | 136 gfx::Rect swap_rect = frame.sub_buffer_rect; |
| 141 | 137 |
| 142 if (reflector_) { | 138 if (reflector_) { |
| 143 if (swap_rect == gfx::Rect(surface_size)) | 139 if (swap_rect == gfx::Rect(surface_size)) |
| 144 reflector_->OnSourceSwapBuffers(surface_size); | 140 reflector_->OnSourceSwapBuffers(surface_size); |
| 145 else | 141 else |
| 146 reflector_->OnSourcePostSubBuffer(swap_rect, surface_size); | 142 reflector_->OnSourcePostSubBuffer(swap_rect, surface_size); |
| 147 } | 143 } |
| 148 | 144 |
| 149 // TODO(oshima): sync with the reflector's SwapBuffersComplete | 145 // TODO(oshima): sync with the reflector's SwapBuffersComplete |
| 150 // (crbug.com/520567). | 146 // (crbug.com/520567). |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 reflector_changed_ = true; | 182 reflector_changed_ = true; |
| 187 EnsureBackbuffer(); | 183 EnsureBackbuffer(); |
| 188 } | 184 } |
| 189 } | 185 } |
| 190 | 186 |
| 191 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete() { | 187 void OffscreenBrowserCompositorOutputSurface::OnSwapBuffersComplete() { |
| 192 client_->DidSwapBuffersComplete(); | 188 client_->DidSwapBuffersComplete(); |
| 193 } | 189 } |
| 194 | 190 |
| 195 } // namespace content | 191 } // namespace content |
| OLD | NEW |