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

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

Issue 273703008: aw: Refactor hardware init (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more refactoring Created 6 years, 7 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 <vector> 5 #include <vector>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "ui/gl/gl_bindings.h" 8 #include "base/memory/scoped_ptr.h"
9 9
10 namespace gfx { 10 namespace gfx {
11 class GLContext; 11 class GLContext;
12 } 12 }
13 13
14 namespace android_webview { 14 namespace android_webview {
15 15
16 namespace internal {
17 class ScopedAppGLStateRestoreImpl;
18 }
19
16 // This class is not thread safe and should only be used on the UI thread. 20 // This class is not thread safe and should only be used on the UI thread.
17 class ScopedAppGLStateRestore { 21 class ScopedAppGLStateRestore {
18 public: 22 public:
19 enum CallMode { 23 enum CallMode {
20 MODE_DRAW, 24 MODE_DRAW,
21 MODE_RESOURCE_MANAGEMENT, 25 MODE_RESOURCE_MANAGEMENT,
22 }; 26 };
23 27
24 ScopedAppGLStateRestore(CallMode mode); 28 ScopedAppGLStateRestore(CallMode mode);
25 ~ScopedAppGLStateRestore(); 29 ~ScopedAppGLStateRestore();
26 30
27 bool stencil_enabled() const { return stencil_test_; } 31 bool stencil_enabled() const;
28 GLint framebuffer_binding_ext() const { return framebuffer_binding_ext_; } 32 int framebuffer_binding_ext() const;
29 33
30 private: 34 private:
31 const CallMode mode_; 35 scoped_ptr<internal::ScopedAppGLStateRestoreImpl> impl_;
32
33 GLint pack_alignment_;
34 GLint unpack_alignment_;
35
36 struct {
37 GLint enabled;
38 GLint size;
39 GLint type;
40 GLint normalized;
41 GLint stride;
42 GLvoid* pointer;
43 GLint vertex_attrib_array_buffer_binding;
44 GLfloat current_vertex_attrib[4];
45 } vertex_attrib_[3];
46
47 GLint vertex_array_buffer_binding_;
48 GLint index_array_buffer_binding_;
49
50 GLboolean depth_test_;
51 GLboolean cull_face_;
52 GLint cull_face_mode_;
53 GLboolean color_mask_[4];
54 GLfloat color_clear_[4];
55 GLfloat depth_clear_;
56 GLint current_program_;
57 GLint depth_func_;
58 GLboolean depth_mask_;
59 GLfloat depth_rage_[2];
60 GLint front_face_;
61 GLint hint_generate_mipmap_;
62 GLfloat line_width_;
63 GLfloat polygon_offset_factor_;
64 GLfloat polygon_offset_units_;
65 GLfloat sample_coverage_value_;
66 GLboolean sample_coverage_invert_;
67
68 GLboolean enable_dither_;
69 GLboolean enable_polygon_offset_fill_;
70 GLboolean enable_sample_alpha_to_coverage_;
71 GLboolean enable_sample_coverage_;
72
73 // Not saved/restored in MODE_DRAW.
74 GLboolean blend_enabled_;
75 GLint blend_src_rgb_;
76 GLint blend_src_alpha_;
77 GLint blend_dest_rgb_;
78 GLint blend_dest_alpha_;
79 GLint active_texture_;
80 GLint viewport_[4];
81 GLboolean scissor_test_;
82 GLint scissor_box_[4];
83
84 GLboolean stencil_test_;
85 GLint stencil_func_;
86 GLint stencil_mask_;
87 GLint stencil_ref_;
88
89 GLint framebuffer_binding_ext_;
90
91 struct TextureBindings {
92 GLint texture_2d;
93 GLint texture_cube_map;
94 GLint texture_external_oes;
95 // TODO(boliu): TEXTURE_RECTANGLE_ARB
96 };
97
98 std::vector<TextureBindings> texture_bindings_;
99
100 GLint vertex_array_bindings_oes_;
101 36
102 DISALLOW_COPY_AND_ASSIGN(ScopedAppGLStateRestore); 37 DISALLOW_COPY_AND_ASSIGN(ScopedAppGLStateRestore);
103 }; 38 };
104 39
105 } // namespace android_webview 40 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698