Extensions: Store disable reasons in Sync
[chromium-blink-merge.git] / ui / gl / scoped_binders.h
blobdab7b3155487d78547ba0447485b6a965cc62eae
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef UI_GL_SCOPED_BINDERS_H_
6 #define UI_GL_SCOPED_BINDERS_H_
8 #include "base/basictypes.h"
9 #include "ui/gl/gl_export.h"
11 namespace gfx {
12 class GLStateRestorer;
14 class GL_EXPORT ScopedFrameBufferBinder {
15 public:
16 explicit ScopedFrameBufferBinder(unsigned int fbo);
17 ~ScopedFrameBufferBinder();
19 private:
20 // Whenever possible we prefer to use the current GLContext's
21 // GLStateRestorer to maximize driver compabitility.
22 GLStateRestorer* state_restorer_;
24 // Failing that we use GL calls to save and restore state.
25 int old_fbo_;
27 DISALLOW_COPY_AND_ASSIGN(ScopedFrameBufferBinder);
31 class GL_EXPORT ScopedTextureBinder {
32 public:
33 ScopedTextureBinder(unsigned int target, unsigned int id);
34 ~ScopedTextureBinder();
36 private:
37 // Whenever possible we prefer to use the current GLContext's
38 // GLStateRestorer to maximize driver compabitility.
39 GLStateRestorer* state_restorer_;
41 // Failing that we use GL calls to save and restore state.
42 int target_;
43 int old_id_;
45 DISALLOW_COPY_AND_ASSIGN(ScopedTextureBinder);
48 } // namespace gfx
50 #endif // UI_GL_SCOPED_BINDERS_H_