WebGLLayerWebKitThread.cpp [plain text]
#include "config.h"
#include "WebGLLayerWebKitThread.h"
#if USE(ACCELERATED_COMPOSITING) && ENABLE(WEBGL)
#include "GraphicsContext3D.h"
#include <pthread.h>
namespace WebCore {
WebGLLayerWebKitThread::WebGLLayerWebKitThread()
: EGLImageLayerWebKitThread(WebGLLayer)
, m_webGLContext(0)
{
}
WebGLLayerWebKitThread::~WebGLLayerWebKitThread()
{
deleteTextures();
}
void WebGLLayerWebKitThread::updateTextureContentsIfNeeded()
{
if (!m_webGLContext || !m_webGLContext->makeContextCurrent())
return;
m_webGLContext->prepareTexture();
updateFrontBuffer(m_webGLContext->getInternalFramebufferSize(), m_webGLContext->platformTexture());
}
void WebGLLayerWebKitThread::deleteTextures()
{
if (m_webGLContext && m_webGLContext->makeContextCurrent())
deleteFrontBuffer();
}
void WebGLLayerWebKitThread::webGLContextDestroyed()
{
deleteTextures();
m_webGLContext = 0;
}
}
#endif // USE(ACCELERATED_COMPOSITING) && ENABLE(WEBGL)