GraphicsContextGLOpenGLPrivate.cpp [plain text]
#include "config.h"
#if ENABLE(WEBGL) && PLATFORM(WIN) && USE(CA)
#include "GraphicsContextGLOpenGLPrivate.h"
#include "HostWindow.h"
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <wtf/StdLibExtras.h>
namespace WebCore {
GraphicsContextGLOpenGLPrivate::GraphicsContextGLOpenGLPrivate(GraphicsContextGLOpenGL*, GraphicsContextGLOpenGL::Destination destination)
{
switch (destination) {
case GraphicsContextGLOpenGL::Destination::Offscreen:
m_glContext = GLContext::createOffscreenContext(&PlatformDisplay::sharedDisplayForCompositing());
break;
case GraphicsContextGLOpenGL::Destination::DirectlyToHostWindow:
ASSERT_NOT_REACHED();
break;
}
}
GraphicsContextGLOpenGLPrivate::~GraphicsContextGLOpenGLPrivate() = default;
bool GraphicsContextGLOpenGLPrivate::makeContextCurrent()
{
return m_glContext ? m_glContext->makeContextCurrent() : false;
}
PlatformGraphicsContextGL GraphicsContextGLOpenGLPrivate::platformContext()
{
return m_glContext ? m_glContext->platformContext() : GLContext::current()->platformContext();
}
}
#endif // ENABLE(WEBGL) && PLATFORM(WIN) && USE(CA)