| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "app/app_switches.h" | 7 #include "app/app_switches.h" |
| 8 #include "app/gfx/gl/gl_context.h" | 8 #include "app/gfx/gl/gl_context.h" |
| 9 #include "app/gfx/gl/gl_bindings.h" | 9 #include "app/gfx/gl/gl_bindings.h" |
| 10 #include "app/gfx/gl/gl_implementation.h" | 10 #include "app/gfx/gl/gl_implementation.h" |
| 11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 | 15 |
| 16 void GLContext::SetSize(gfx::Size size) { |
| 17 if (set_size_callback_.get()) |
| 18 set_size_callback_->Run(size); |
| 19 } |
| 20 |
| 21 void GLContext::RegisterSetSizeCallback(Callback1<gfx::Size>::Type* callback) { |
| 22 set_size_callback_.reset(callback); |
| 23 } |
| 24 |
| 16 std::string GLContext::GetExtensions() { | 25 std::string GLContext::GetExtensions() { |
| 17 DCHECK(IsCurrent()); | 26 DCHECK(IsCurrent()); |
| 18 return std::string(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); | 27 return std::string(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); |
| 19 } | 28 } |
| 20 | 29 |
| 21 bool GLContext::HasExtension(const char* name) { | 30 bool GLContext::HasExtension(const char* name) { |
| 22 std::string extensions = GetExtensions(); | 31 std::string extensions = GetExtensions(); |
| 23 extensions += " "; | 32 extensions += " "; |
| 24 | 33 |
| 25 std::string delimited_name(name); | 34 std::string delimited_name(name); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 44 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 53 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
| 45 if (glGetError() != GL_NO_ERROR) { | 54 if (glGetError() != GL_NO_ERROR) { |
| 46 LOG(ERROR) << "glClear failed."; | 55 LOG(ERROR) << "glClear failed."; |
| 47 return false; | 56 return false; |
| 48 } | 57 } |
| 49 | 58 |
| 50 return true; | 59 return true; |
| 51 } | 60 } |
| 52 | 61 |
| 53 } // namespace gfx | 62 } // namespace gfx |
| OLD | NEW |