OLD | NEW |
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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "ui/gl/gl_bindings.h" | 6 #include "ui/gl/gl_bindings.h" |
7 | 7 |
8 namespace gfx { | 8 namespace gfx { |
9 class GLContext; | 9 class GLContext; |
10 } | 10 } |
11 | 11 |
12 namespace android_webview { | 12 namespace android_webview { |
13 | 13 |
14 // This class is not thread safe and should only be used on the UI thread. | 14 // This class is not thread safe and should only be used on the UI thread. |
15 class ScopedAppGLStateRestore { | 15 class ScopedAppGLStateRestore { |
16 public: | 16 public: |
17 enum CallMode { | 17 enum CallMode { |
18 MODE_DRAW, | 18 MODE_DRAW, |
19 MODE_DETACH_FROM_WINDOW | 19 MODE_DETACH_FROM_WINDOW |
20 }; | 20 }; |
21 | 21 |
22 ScopedAppGLStateRestore(CallMode mode); | 22 ScopedAppGLStateRestore(CallMode mode); |
23 ~ScopedAppGLStateRestore(); | 23 ~ScopedAppGLStateRestore(); |
24 | 24 |
25 private: | 25 private: |
| 26 const CallMode mode_; |
| 27 |
26 GLint texture_external_oes_binding_; | 28 GLint texture_external_oes_binding_; |
27 GLint pack_alignment_; | 29 GLint pack_alignment_; |
28 GLint unpack_alignment_; | 30 GLint unpack_alignment_; |
29 | 31 |
30 struct { | 32 struct { |
31 GLint enabled; | 33 GLint enabled; |
32 GLint size; | 34 GLint size; |
33 GLint type; | 35 GLint type; |
34 GLint normalized; | 36 GLint normalized; |
35 GLint stride; | 37 GLint stride; |
36 GLvoid* pointer; | 38 GLvoid* pointer; |
37 } vertex_attrib_[3]; | 39 } vertex_attrib_[3]; |
38 | 40 |
39 GLint vertex_array_buffer_binding_; | 41 GLint vertex_array_buffer_binding_; |
40 GLint index_array_buffer_binding_; | 42 GLint index_array_buffer_binding_; |
41 | 43 |
42 GLboolean depth_test_; | 44 GLboolean depth_test_; |
43 GLboolean cull_face_; | 45 GLboolean cull_face_; |
| 46 GLint cull_face_mode_; |
44 GLboolean color_mask_[4]; | 47 GLboolean color_mask_[4]; |
| 48 GLfloat color_clear_[4]; |
| 49 GLfloat depth_clear_; |
| 50 GLint current_program_; |
| 51 GLint depth_func_; |
| 52 GLboolean depth_mask_; |
| 53 GLfloat depth_rage_[2]; |
| 54 GLint front_face_; |
| 55 GLint hint_generate_mipmap_; |
| 56 GLfloat line_width_; |
| 57 GLfloat polygon_offset_factor_; |
| 58 GLfloat polygon_offset_units_; |
| 59 GLfloat sample_coverage_value_; |
| 60 GLboolean sample_coverage_invert_; |
| 61 |
| 62 GLboolean enable_dither_; |
| 63 GLboolean enable_polygon_offset_fill_; |
| 64 GLboolean enable_sample_alpha_to_coverage_; |
| 65 GLboolean enable_sample_coverage_; |
| 66 |
| 67 // Not saved/restored in MODE_DRAW. |
45 GLboolean blend_enabled_; | 68 GLboolean blend_enabled_; |
46 GLint blend_src_rgb_; | 69 GLint blend_src_rgb_; |
47 GLint blend_src_alpha_; | 70 GLint blend_src_alpha_; |
48 GLint blend_dest_rgb_; | 71 GLint blend_dest_rgb_; |
49 GLint blend_dest_alpha_; | 72 GLint blend_dest_alpha_; |
50 GLint active_texture_; | 73 GLint active_texture_; |
51 GLint viewport_[4]; | 74 GLint viewport_[4]; |
52 GLboolean scissor_test_; | 75 GLboolean scissor_test_; |
53 GLint scissor_box_[4]; | 76 GLint scissor_box_[4]; |
54 GLint current_program_; | |
55 | 77 |
56 DISALLOW_COPY_AND_ASSIGN(ScopedAppGLStateRestore); | 78 DISALLOW_COPY_AND_ASSIGN(ScopedAppGLStateRestore); |
57 }; | 79 }; |
58 | 80 |
59 } // namespace android_webview | 81 } // namespace android_webview |
OLD | NEW |