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 "android_webview/browser/parent_output_surface.h" | 5 #include "android_webview/browser/parent_output_surface.h" |
6 | 6 |
7 #include "android_webview/browser/aw_render_thread_context_provider.h" | 7 #include "android_webview/browser/aw_render_thread_context_provider.h" |
8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
9 #include "cc/output/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
10 #include "gpu/command_buffer/client/gles2_interface.h" | 10 #include "gpu/command_buffer/client/gles2_interface.h" |
11 | 11 |
12 namespace android_webview { | 12 namespace android_webview { |
13 | 13 |
14 ParentOutputSurface::ParentOutputSurface( | 14 ParentOutputSurface::ParentOutputSurface( |
15 scoped_refptr<AwRenderThreadContextProvider> context_provider) | 15 scoped_refptr<AwRenderThreadContextProvider> context_provider) |
16 : cc::OutputSurface(std::move(context_provider), nullptr, nullptr) { | 16 : cc::OutputSurface(std::move(context_provider), nullptr, nullptr) { |
17 stencil_state_.stencil_test_enabled = false; | 17 stencil_state_.stencil_test_enabled = false; |
18 } | 18 } |
19 | 19 |
20 ParentOutputSurface::~ParentOutputSurface() { | 20 ParentOutputSurface::~ParentOutputSurface() { |
21 } | 21 } |
22 | 22 |
23 void ParentOutputSurface::DidLoseOutputSurface() { | 23 void ParentOutputSurface::DidLoseOutputSurface() { |
24 // Android WebView does not handle context loss. | 24 // Android WebView does not handle context loss. |
25 LOG(FATAL) << "Render thread context loss"; | 25 LOG(FATAL) << "Render thread context loss"; |
26 } | 26 } |
27 | 27 |
28 void ParentOutputSurface::Reshape(const gfx::Size& size, | 28 void ParentOutputSurface::Reshape(const gfx::Size& size, |
29 float scale_factor, | 29 float scale_factor, |
| 30 const gfx::ColorSpace& color_space, |
30 bool has_alpha) { | 31 bool has_alpha) { |
31 DCHECK_EQ(1.f, scale_factor); | 32 DCHECK_EQ(1.f, scale_factor); |
32 surface_size_ = size; | 33 surface_size_ = size; |
33 } | 34 } |
34 | 35 |
35 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame frame) { | 36 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame frame) { |
36 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); | 37 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); |
37 client_->DidSwapBuffers(); | 38 client_->DidSwapBuffers(); |
38 } | 39 } |
39 | 40 |
(...skipping 20 matching lines...) Expand all Loading... |
60 auto* gl = static_cast<AwRenderThreadContextProvider*>(context_provider()); | 61 auto* gl = static_cast<AwRenderThreadContextProvider*>(context_provider()); |
61 return gl->GetCopyTextureInternalFormat(); | 62 return gl->GetCopyTextureInternalFormat(); |
62 } | 63 } |
63 | 64 |
64 void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) { | 65 void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) { |
65 stencil_state_ = gl_state.stencil_state(); | 66 stencil_state_ = gl_state.stencil_state(); |
66 SetExternalStencilTest(stencil_state_.stencil_test_enabled); | 67 SetExternalStencilTest(stencil_state_.stencil_test_enabled); |
67 } | 68 } |
68 | 69 |
69 } // namespace android_webview | 70 } // namespace android_webview |
OLD | NEW |