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

Side by Side Diff: android_webview/browser/in_process_renderer/in_process_view_renderer.cc

Issue 16096004: Fix app gl state restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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/in_process_renderer/in_process_view_renderer.h " 5 #include "android_webview/browser/in_process_renderer/in_process_view_renderer.h "
6 6
7 #include <android/bitmap.h> 7 #include <android/bitmap.h>
8 8
9 #include "android_webview/public/browser/draw_gl.h" 9 #include "android_webview/public/browser/draw_gl.h"
10 #include "android_webview/public/browser/draw_sw.h" 10 #include "android_webview/public/browser/draw_sw.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 namespace android_webview { 45 namespace android_webview {
46 46
47 namespace { 47 namespace {
48 48
49 class GLStateRestore { 49 class GLStateRestore {
50 public: 50 public:
51 GLStateRestore() { 51 GLStateRestore() {
52 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, 52 glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES,
53 &texture_external_oes_binding_); 53 &texture_external_oes_binding_);
54 glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &vertex_array_buffer_binding_);
55 glGetIntegerv(GL_ELEMENT_ARRAY_BUFFER_BINDING,
56 &index_array_buffer_binding_);
joth 2013/05/28 20:44:05 can we leave this in under !NDEBUG just to keep th
57 glGetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment_); 54 glGetIntegerv(GL_PACK_ALIGNMENT, &pack_alignment_);
58 glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment_); 55 glGetIntegerv(GL_UNPACK_ALIGNMENT, &unpack_alignment_);
59 56
60 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(vertex_attrib_); ++i) { 57 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(vertex_attrib_); ++i) {
61 glGetVertexAttribiv( 58 glGetVertexAttribiv(
62 i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &vertex_attrib_[i].enabled); 59 i, GL_VERTEX_ATTRIB_ARRAY_ENABLED, &vertex_attrib_[i].enabled);
63 glGetVertexAttribiv( 60 glGetVertexAttribiv(
64 i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &vertex_attrib_[i].size); 61 i, GL_VERTEX_ATTRIB_ARRAY_SIZE, &vertex_attrib_[i].size);
65 glGetVertexAttribiv( 62 glGetVertexAttribiv(
66 i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &vertex_attrib_[i].type); 63 i, GL_VERTEX_ATTRIB_ARRAY_TYPE, &vertex_attrib_[i].type);
(...skipping 11 matching lines...) Expand all
78 glGetBooleanv(GL_BLEND, &blend_enabled_); 75 glGetBooleanv(GL_BLEND, &blend_enabled_);
79 glGetIntegerv(GL_BLEND_SRC_RGB, &blend_src_rgb_); 76 glGetIntegerv(GL_BLEND_SRC_RGB, &blend_src_rgb_);
80 glGetIntegerv(GL_BLEND_SRC_ALPHA, &blend_src_alpha_); 77 glGetIntegerv(GL_BLEND_SRC_ALPHA, &blend_src_alpha_);
81 glGetIntegerv(GL_BLEND_DST_RGB, &blend_dest_rgb_); 78 glGetIntegerv(GL_BLEND_DST_RGB, &blend_dest_rgb_);
82 glGetIntegerv(GL_BLEND_DST_ALPHA, &blend_dest_alpha_); 79 glGetIntegerv(GL_BLEND_DST_ALPHA, &blend_dest_alpha_);
83 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture_); 80 glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture_);
84 glGetIntegerv(GL_VIEWPORT, viewport_); 81 glGetIntegerv(GL_VIEWPORT, viewport_);
85 glGetBooleanv(GL_SCISSOR_TEST, &scissor_test_); 82 glGetBooleanv(GL_SCISSOR_TEST, &scissor_test_);
86 glGetIntegerv(GL_SCISSOR_BOX, scissor_box_); 83 glGetIntegerv(GL_SCISSOR_BOX, scissor_box_);
87 glGetIntegerv(GL_CURRENT_PROGRAM, &current_program_); 84 glGetIntegerv(GL_CURRENT_PROGRAM, &current_program_);
88
89 DCHECK_EQ(0, vertex_array_buffer_binding_);
90 DCHECK_EQ(0, index_array_buffer_binding_);
91 } 85 }
92 86
93 ~GLStateRestore() { 87 ~GLStateRestore() {
94 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_external_oes_binding_); 88 glBindTexture(GL_TEXTURE_EXTERNAL_OES, texture_external_oes_binding_);
95 glBindBuffer(GL_ARRAY_BUFFER, vertex_array_buffer_binding_);
96 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, index_array_buffer_binding_);
97 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment_); 89 glPixelStorei(GL_PACK_ALIGNMENT, pack_alignment_);
98 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment_); 90 glPixelStorei(GL_UNPACK_ALIGNMENT, unpack_alignment_);
99 91
100 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(vertex_attrib_); ++i) { 92 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(vertex_attrib_); ++i) {
101 glVertexAttribPointer(i, 93 glVertexAttribPointer(i,
102 vertex_attrib_[i].size, 94 vertex_attrib_[i].size,
103 vertex_attrib_[i].type, 95 vertex_attrib_[i].type,
104 vertex_attrib_[i].normalized, 96 vertex_attrib_[i].normalized,
105 vertex_attrib_[i].stride, 97 vertex_attrib_[i].stride,
106 vertex_attrib_[i].pointer); 98 vertex_attrib_[i].pointer);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 if (scissor_test_) { 133 if (scissor_test_) {
142 glEnable(GL_SCISSOR_TEST); 134 glEnable(GL_SCISSOR_TEST);
143 } else { 135 } else {
144 glDisable(GL_SCISSOR_TEST); 136 glDisable(GL_SCISSOR_TEST);
145 } 137 }
146 138
147 glScissor( 139 glScissor(
148 scissor_box_[0], scissor_box_[1], scissor_box_[2], scissor_box_[3]); 140 scissor_box_[0], scissor_box_[1], scissor_box_[2], scissor_box_[3]);
149 141
150 glUseProgram(current_program_); 142 glUseProgram(current_program_);
143
144 glBindBuffer(GL_ARRAY_BUFFER, 0);
no sievers 2013/05/28 20:04:04 Interesting, so it's expected that draw functor in
joth 2013/05/28 20:44:05 Today, Framework ensures nothing is bound when we'
145 glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);
151 } 146 }
152 147
153 private: 148 private:
154 GLint texture_external_oes_binding_; 149 GLint texture_external_oes_binding_;
155 GLint vertex_array_buffer_binding_;
156 GLint index_array_buffer_binding_;
157 GLint pack_alignment_; 150 GLint pack_alignment_;
158 GLint unpack_alignment_; 151 GLint unpack_alignment_;
159 152
160 struct { 153 struct {
161 GLint enabled; 154 GLint enabled;
162 GLint size; 155 GLint size;
163 GLint type; 156 GLint type;
164 GLint normalized; 157 GLint normalized;
165 GLint stride; 158 GLint stride;
166 GLvoid* pointer; 159 GLvoid* pointer;
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 // TODO(joth): BrowserViewRendererImpl had a bunch of logic for dpi and page 573 // TODO(joth): BrowserViewRendererImpl had a bunch of logic for dpi and page
581 // scale here. Determine what if any needs bringing over to this class. 574 // scale here. Determine what if any needs bringing over to this class.
582 return CompositeSW(canvas); 575 return CompositeSW(canvas);
583 } 576 }
584 577
585 bool InProcessViewRenderer::CompositeSW(SkCanvas* canvas) { 578 bool InProcessViewRenderer::CompositeSW(SkCanvas* canvas) {
586 return compositor_ && compositor_->DemandDrawSw(canvas); 579 return compositor_ && compositor_->DemandDrawSw(canvas);
587 } 580 }
588 581
589 } // namespace android_webview 582 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698