| 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" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 const gfx::ColorSpace& color_space, | 30 const gfx::ColorSpace& color_space, |
| 31 bool has_alpha) { | 31 bool has_alpha) { |
| 32 DCHECK_EQ(1.f, scale_factor); | 32 DCHECK_EQ(1.f, scale_factor); |
| 33 surface_size_ = size; | 33 surface_size_ = size; |
| 34 } | 34 } |
| 35 | 35 |
| 36 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame frame) { | 36 void ParentOutputSurface::SwapBuffers(cc::CompositorFrame frame) { |
| 37 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); | 37 context_provider_->ContextGL()->ShallowFlushCHROMIUM(); |
| 38 } | 38 } |
| 39 | 39 |
| 40 bool ParentOutputSurface::HasExternalStencilTest() const { |
| 41 return stencil_state_.stencil_test_enabled; |
| 42 } |
| 43 |
| 40 void ParentOutputSurface::ApplyExternalStencil() { | 44 void ParentOutputSurface::ApplyExternalStencil() { |
| 41 DCHECK(stencil_state_.stencil_test_enabled); | 45 DCHECK(stencil_state_.stencil_test_enabled); |
| 42 gpu::gles2::GLES2Interface* gl = context_provider()->ContextGL(); | 46 gpu::gles2::GLES2Interface* gl = context_provider()->ContextGL(); |
| 43 gl->StencilFuncSeparate(GL_FRONT, stencil_state_.stencil_front_func, | 47 gl->StencilFuncSeparate(GL_FRONT, stencil_state_.stencil_front_func, |
| 44 stencil_state_.stencil_front_mask, | 48 stencil_state_.stencil_front_mask, |
| 45 stencil_state_.stencil_front_ref); | 49 stencil_state_.stencil_front_ref); |
| 46 gl->StencilFuncSeparate(GL_BACK, stencil_state_.stencil_back_func, | 50 gl->StencilFuncSeparate(GL_BACK, stencil_state_.stencil_back_func, |
| 47 stencil_state_.stencil_back_mask, | 51 stencil_state_.stencil_back_mask, |
| 48 stencil_state_.stencil_back_ref); | 52 stencil_state_.stencil_back_ref); |
| 49 gl->StencilMaskSeparate(GL_FRONT, stencil_state_.stencil_front_writemask); | 53 gl->StencilMaskSeparate(GL_FRONT, stencil_state_.stencil_front_writemask); |
| 50 gl->StencilMaskSeparate(GL_BACK, stencil_state_.stencil_back_writemask); | 54 gl->StencilMaskSeparate(GL_BACK, stencil_state_.stencil_back_writemask); |
| 51 gl->StencilOpSeparate(GL_FRONT, stencil_state_.stencil_front_fail_op, | 55 gl->StencilOpSeparate(GL_FRONT, stencil_state_.stencil_front_fail_op, |
| 52 stencil_state_.stencil_front_z_fail_op, | 56 stencil_state_.stencil_front_z_fail_op, |
| 53 stencil_state_.stencil_front_z_pass_op); | 57 stencil_state_.stencil_front_z_pass_op); |
| 54 gl->StencilOpSeparate(GL_BACK, stencil_state_.stencil_back_fail_op, | 58 gl->StencilOpSeparate(GL_BACK, stencil_state_.stencil_back_fail_op, |
| 55 stencil_state_.stencil_back_z_fail_op, | 59 stencil_state_.stencil_back_z_fail_op, |
| 56 stencil_state_.stencil_back_z_pass_op); | 60 stencil_state_.stencil_back_z_pass_op); |
| 57 } | 61 } |
| 58 | 62 |
| 59 uint32_t ParentOutputSurface::GetFramebufferCopyTextureFormat() { | 63 uint32_t ParentOutputSurface::GetFramebufferCopyTextureFormat() { |
| 60 auto* gl = static_cast<AwRenderThreadContextProvider*>(context_provider()); | 64 auto* gl = static_cast<AwRenderThreadContextProvider*>(context_provider()); |
| 61 return gl->GetCopyTextureInternalFormat(); | 65 return gl->GetCopyTextureInternalFormat(); |
| 62 } | 66 } |
| 63 | 67 |
| 64 void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) { | 68 void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) { |
| 65 stencil_state_ = gl_state.stencil_state(); | 69 stencil_state_ = gl_state.stencil_state(); |
| 66 SetExternalStencilTest(stencil_state_.stencil_test_enabled); | |
| 67 } | 70 } |
| 68 | 71 |
| 69 } // namespace android_webview | 72 } // namespace android_webview |
| OLD | NEW |