| 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 std::string GLContext::GetExtensions() { | 16 std::string GLContext::GetExtensions() { |
| 17 DCHECK(IsCurrent()); | 17 DCHECK(IsCurrent()); |
| 18 const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); | 18 return std::string(reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS))); |
| 19 return std::string(ext ? ext : ""); | |
| 20 } | 19 } |
| 21 | 20 |
| 22 bool GLContext::HasExtension(const char* name) { | 21 bool GLContext::HasExtension(const char* name) { |
| 23 std::string extensions = GetExtensions(); | 22 std::string extensions = GetExtensions(); |
| 24 extensions += " "; | 23 extensions += " "; |
| 25 | 24 |
| 26 std::string delimited_name(name); | 25 std::string delimited_name(name); |
| 27 delimited_name += " "; | 26 delimited_name += " "; |
| 28 | 27 |
| 29 return extensions.find(delimited_name) != std::string::npos; | 28 return extensions.find(delimited_name) != std::string::npos; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 45 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); | 44 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); |
| 46 if (glGetError() != GL_NO_ERROR) { | 45 if (glGetError() != GL_NO_ERROR) { |
| 47 LOG(ERROR) << "glClear failed."; | 46 LOG(ERROR) << "glClear failed."; |
| 48 return false; | 47 return false; |
| 49 } | 48 } |
| 50 | 49 |
| 51 return true; | 50 return true; |
| 52 } | 51 } |
| 53 | 52 |
| 54 } // namespace gfx | 53 } // namespace gfx |
| OLD | NEW |