diff options
Diffstat (limited to 'ui')
-rw-r--r-- | ui/gl/gl_context.cc | 16 | ||||
-rw-r--r-- | ui/gl/gl_surface.cc | 13 | ||||
-rw-r--r-- | ui/gl/gl_surface.h | 4 |
3 files changed, 17 insertions, 16 deletions
diff --git a/ui/gl/gl_context.cc b/ui/gl/gl_context.cc index 8652e25..48ef5fb 100644 --- a/ui/gl/gl_context.cc +++ b/ui/gl/gl_context.cc @@ -37,20 +37,8 @@ GLContext::~GLContext() { std::string GLContext::GetExtensions() { DCHECK(IsCurrent(NULL)); - - std::string extensions; - if (GLSurface::GetCurrent()) { - extensions = GLSurface::GetCurrent()->GetExtensions(); - } - - const char* gl_ext = reinterpret_cast<const char*>( - glGetString(GL_EXTENSIONS)); - if (gl_ext) { - extensions += (!extensions.empty() && gl_ext[0]) ? " " : ""; - extensions += gl_ext; - } - - return extensions; + const char* ext = reinterpret_cast<const char*>(glGetString(GL_EXTENSIONS)); + return std::string(ext ? ext : ""); } bool GLContext::HasExtension(const char* name) { diff --git a/ui/gl/gl_surface.cc b/ui/gl/gl_surface.cc index e7efc12..b9040ec 100644 --- a/ui/gl/gl_surface.cc +++ b/ui/gl/gl_surface.cc @@ -75,8 +75,7 @@ bool GLSurface::InitializeOneOff() { GLSurface::GLSurface() {} -bool GLSurface::Initialize() -{ +bool GLSurface::Initialize() { return true; } @@ -92,6 +91,16 @@ std::string GLSurface::GetExtensions() { return std::string(""); } +bool GLSurface::HasExtension(const char* name) { + std::string extensions = GetExtensions(); + extensions += " "; + + std::string delimited_name(name); + delimited_name += " "; + + return extensions.find(delimited_name) != std::string::npos; +} + unsigned int GLSurface::GetBackingFrameBufferObject() { return 0; } diff --git a/ui/gl/gl_surface.h b/ui/gl/gl_surface.h index a2483c4..5872ed0 100644 --- a/ui/gl/gl_surface.h +++ b/ui/gl/gl_surface.h @@ -6,6 +6,8 @@ #define UI_GL_GL_SURFACE_H_ #pragma once +#include <string> + #include "base/memory/ref_counted.h" #include "build/build_config.h" #include "ui/gfx/native_widget_types.h" @@ -58,6 +60,8 @@ class GL_EXPORT GLSurface : public base::RefCounted<GLSurface> { // The surface must be current. virtual std::string GetExtensions(); + bool HasExtension(const char* name); + // Returns the internal frame buffer object name if the surface is backed by // FBO. Otherwise returns 0. virtual unsigned int GetBackingFrameBufferObject(); |