| OLD | NEW | 
|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "ui/gl/scoped_binders.h" | 5 #include "ui/gl/scoped_binders.h" | 
| 6 #include "ui/gl/gl_bindings.h" | 6 #include "ui/gl/gl_bindings.h" | 
| 7 #include "ui/gl/gl_context.h" | 7 #include "ui/gl/gl_context.h" | 
| 8 #include "ui/gl/gl_state_restorer.h" | 8 #include "ui/gl/gl_state_restorer.h" | 
| 9 | 9 | 
| 10 namespace gfx { | 10 namespace gl { | 
| 11 | 11 | 
| 12 ScopedFrameBufferBinder::ScopedFrameBufferBinder(unsigned int fbo) | 12 ScopedFrameBufferBinder::ScopedFrameBufferBinder(unsigned int fbo) | 
| 13     : state_restorer_(!GLContext::GetCurrent() | 13     : state_restorer_(!GLContext::GetCurrent() | 
| 14                           ? NULL | 14                           ? NULL | 
| 15                           : GLContext::GetCurrent()->GetGLStateRestorer()), | 15                           : GLContext::GetCurrent()->GetGLStateRestorer()), | 
| 16       old_fbo_(-1) { | 16       old_fbo_(-1) { | 
| 17   if (!state_restorer_) | 17   if (!state_restorer_) | 
| 18     glGetIntegerv(GL_FRAMEBUFFER_BINDING, &old_fbo_); | 18     glGetIntegerv(GL_FRAMEBUFFER_BINDING, &old_fbo_); | 
| 19   glBindFramebufferEXT(GL_FRAMEBUFFER, fbo); | 19   glBindFramebufferEXT(GL_FRAMEBUFFER, fbo); | 
| 20 } | 20 } | 
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 169 } | 169 } | 
| 170 | 170 | 
| 171 ScopedCapability::~ScopedCapability() { | 171 ScopedCapability::~ScopedCapability() { | 
| 172   if (enabled_ == GL_TRUE) { | 172   if (enabled_ == GL_TRUE) { | 
| 173     glEnable(capability_); | 173     glEnable(capability_); | 
| 174   } else { | 174   } else { | 
| 175     glDisable(capability_); | 175     glDisable(capability_); | 
| 176   } | 176   } | 
| 177 } | 177 } | 
| 178 | 178 | 
| 179 }  // namespace gfx | 179 }  // namespace gl | 
| OLD | NEW | 
|---|