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

Side by Side Diff: android_webview/browser/scoped_app_gl_state_restore.cc

Issue 22277004: Add gfx::SurfaceFactoryWebview (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix clang build Created 7 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/scoped_app_gl_state_restore.h" 5 #include "android_webview/browser/scoped_app_gl_state_restore.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "ui/gl/gl_context.h" 9 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_surface_stub.h" 10 #include "ui/gl/gl_surface_stub.h"
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 glGetBooleanv(GL_DITHER, &enable_dither_); 125 glGetBooleanv(GL_DITHER, &enable_dither_);
126 glGetBooleanv(GL_POLYGON_OFFSET_FILL, &enable_polygon_offset_fill_); 126 glGetBooleanv(GL_POLYGON_OFFSET_FILL, &enable_polygon_offset_fill_);
127 glGetBooleanv(GL_SAMPLE_ALPHA_TO_COVERAGE, &enable_sample_alpha_to_coverage_); 127 glGetBooleanv(GL_SAMPLE_ALPHA_TO_COVERAGE, &enable_sample_alpha_to_coverage_);
128 glGetBooleanv(GL_SAMPLE_COVERAGE, &enable_sample_coverage_); 128 glGetBooleanv(GL_SAMPLE_COVERAGE, &enable_sample_coverage_);
129 129
130 glGetBooleanv(GL_STENCIL_TEST, &stencil_test_); 130 glGetBooleanv(GL_STENCIL_TEST, &stencil_test_);
131 glGetIntegerv(GL_STENCIL_FUNC, &stencil_func_); 131 glGetIntegerv(GL_STENCIL_FUNC, &stencil_func_);
132 glGetIntegerv(GL_STENCIL_VALUE_MASK, &stencil_mask_); 132 glGetIntegerv(GL_STENCIL_VALUE_MASK, &stencil_mask_);
133 glGetIntegerv(GL_STENCIL_REF, &stencil_ref_); 133 glGetIntegerv(GL_STENCIL_REF, &stencil_ref_);
134 134
135 glGetIntegerv(GL_FRAMEBUFFER_BINDING_EXT, &framebuffer_binding_ext_);
135 136
136 if (!g_gl_max_texture_units) { 137 if (!g_gl_max_texture_units) {
137 glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &g_gl_max_texture_units); 138 glGetIntegerv(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &g_gl_max_texture_units);
138 DCHECK_GT(g_gl_max_texture_units, 0); 139 DCHECK_GT(g_gl_max_texture_units, 0);
139 } 140 }
140 141
141 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture_); 142 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture_);
142 143
143 texture_bindings_.resize(g_gl_max_texture_units); 144 texture_bindings_.resize(g_gl_max_texture_units);
144 for (int ii = 0; ii < g_gl_max_texture_units; ++ii) { 145 for (int ii = 0; ii < g_gl_max_texture_units; ++ii) {
145 glActiveTexture(GL_TEXTURE0 + ii); 146 glActiveTexture(GL_TEXTURE0 + ii);
146 TextureBindings& bindings = texture_bindings_[ii]; 147 TextureBindings& bindings = texture_bindings_[ii];
147 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bindings.texture_2d); 148 glGetIntegerv(GL_TEXTURE_BINDING_2D, &bindings.texture_2d);
148 glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &bindings.texture_cube_map); 149 glGetIntegerv(GL_TEXTURE_BINDING_CUBE_MAP, &bindings.texture_cube_map);
149 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, 150 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES,
150 &bindings.texture_external_oes); 151 &bindings.texture_external_oes);
151 } 152 }
152 } 153 }
153 154
154 ScopedAppGLStateRestore::~ScopedAppGLStateRestore() { 155 ScopedAppGLStateRestore::~ScopedAppGLStateRestore() {
155 TRACE_EVENT0("android_webview", "AppGLStateRestore"); 156 TRACE_EVENT0("android_webview", "AppGLStateRestore");
156 MakeAppContextCurrent(); 157 MakeAppContextCurrent();
157 158
159 glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_binding_ext_);
158 glBindBuffer(GL_ARRAY_BUFFER, vertex_array_buffer_binding_); 160 glBindBuffer(GL_ARRAY_BUFFER, vertex_array_buffer_binding_);
159 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_buffer_binding_); 161 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_buffer_binding_);
160 162
161 for (int ii = 0; ii < g_gl_max_texture_units; ++ii) { 163 for (int ii = 0; ii < g_gl_max_texture_units; ++ii) {
162 glActiveTexture(GL_TEXTURE0 + ii); 164 glActiveTexture(GL_TEXTURE0 + ii);
163 TextureBindings& bindings = texture_bindings_[ii]; 165 TextureBindings& bindings = texture_bindings_[ii];
164 glBindTexture(GL_TEXTURE_2D, bindings.texture_2d); 166 glBindTexture(GL_TEXTURE_2D, bindings.texture_2d);
165 glBindTexture(GL_TEXTURE_CUBE_MAP, bindings.texture_cube_map); 167 glBindTexture(GL_TEXTURE_CUBE_MAP, bindings.texture_cube_map);
166 glBindTexture(GL_TEXTURE_EXTERNAL_OES, bindings.texture_external_oes); 168 glBindTexture(GL_TEXTURE_EXTERNAL_OES, bindings.texture_external_oes);
167 } 169 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 226
225 glScissor( 227 glScissor(
226 scissor_box_[0], scissor_box_[1], scissor_box_[2], scissor_box_[3]); 228 scissor_box_[0], scissor_box_[1], scissor_box_[2], scissor_box_[3]);
227 } 229 }
228 230
229 GLEnableDisable(GL_STENCIL_TEST, stencil_test_); 231 GLEnableDisable(GL_STENCIL_TEST, stencil_test_);
230 glStencilFunc(stencil_func_, stencil_mask_, stencil_ref_); 232 glStencilFunc(stencil_func_, stencil_mask_, stencil_ref_);
231 } 233 }
232 234
233 } // namespace android_webview 235 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698