Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2179)

Unified Diff: android_webview/browser/parent_output_surface.cc

Issue 1564703005: Implement external stencil for Android WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, fix pixel tests Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: android_webview/browser/parent_output_surface.cc
diff --git a/android_webview/browser/parent_output_surface.cc b/android_webview/browser/parent_output_surface.cc
index 4a777cb31881a601ee4c5f994158f0d38fea3380..e73fecf42893ccf376741748c7b759a84ec017a5 100644
--- a/android_webview/browser/parent_output_surface.cc
+++ b/android_webview/browser/parent_output_surface.cc
@@ -12,6 +12,7 @@ namespace android_webview {
ParentOutputSurface::ParentOutputSurface(
scoped_refptr<cc::ContextProvider> context_provider)
: cc::OutputSurface(context_provider) {
+ stencil_state_.stencil_test_enabled = false;
}
ParentOutputSurface::~ParentOutputSurface() {
@@ -34,4 +35,28 @@ void ParentOutputSurface::SwapBuffers(cc::CompositorFrame* frame) {
client_->DidSwapBuffers();
}
+void ParentOutputSurface::ApplyExternalStencil() {
+ DCHECK(stencil_state_.stencil_test_enabled);
+ gpu::gles2::GLES2Interface* gl = context_provider()->ContextGL();
+ gl->StencilFuncSeparate(GL_FRONT, stencil_state_.stencil_front_func,
+ stencil_state_.stencil_front_mask,
+ stencil_state_.stencil_front_ref);
+ gl->StencilFuncSeparate(GL_BACK, stencil_state_.stencil_back_func,
+ stencil_state_.stencil_back_mask,
+ stencil_state_.stencil_back_ref);
+ gl->StencilMaskSeparate(GL_FRONT, stencil_state_.stencil_front_writemask);
+ gl->StencilMaskSeparate(GL_BACK, stencil_state_.stencil_back_writemask);
+ gl->StencilOpSeparate(GL_FRONT, stencil_state_.stencil_front_fail_op,
+ stencil_state_.stencil_front_z_fail_op,
+ stencil_state_.stencil_front_z_pass_op);
+ gl->StencilOpSeparate(GL_BACK, stencil_state_.stencil_back_fail_op,
+ stencil_state_.stencil_back_z_fail_op,
+ stencil_state_.stencil_back_z_pass_op);
+}
+
+void ParentOutputSurface::SetGLState(const ScopedAppGLStateRestore& gl_state) {
+ stencil_state_ = gl_state.stencil_state();
+ SetExternalStencilTest(stencil_state_.stencil_test_enabled);
+}
+
} // namespace android_webview
« no previous file with comments | « android_webview/browser/parent_output_surface.h ('k') | android_webview/browser/scoped_app_gl_state_restore.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698