diff options
Diffstat (limited to 'WebCore/platform/graphics/gpu/DrawingBuffer.cpp')
-rw-r--r-- | WebCore/platform/graphics/gpu/DrawingBuffer.cpp | 37 |
1 files changed, 23 insertions, 14 deletions
diff --git a/WebCore/platform/graphics/gpu/DrawingBuffer.cpp b/WebCore/platform/graphics/gpu/DrawingBuffer.cpp index dc80954..2dc0517 100644 --- a/WebCore/platform/graphics/gpu/DrawingBuffer.cpp +++ b/WebCore/platform/graphics/gpu/DrawingBuffer.cpp @@ -30,31 +30,40 @@ #include "config.h" -#include "DrawingBuffer.h" +#if ENABLE(ACCELERATED_2D_CANVAS) || ENABLE(3D_CANVAS) -#include "GraphicsContext3D.h" -#include "SharedGraphicsContext3D.h" +#include "DrawingBuffer.h" namespace WebCore { -PassOwnPtr<DrawingBuffer> DrawingBuffer::create(SharedGraphicsContext3D* context, const IntSize& size) +PassRefPtr<DrawingBuffer> DrawingBuffer::create(GraphicsContext3D* context, const IntSize& size) { - unsigned framebuffer = context->createFramebuffer(); - ASSERT(framebuffer); - if (!framebuffer) - return 0; - return adoptPtr(new DrawingBuffer(context, size, framebuffer)); + RefPtr<DrawingBuffer> drawingBuffer = adoptRef(new DrawingBuffer(context, size)); + return (drawingBuffer->m_context) ? drawingBuffer.release() : 0; } -void DrawingBuffer::bind() +void DrawingBuffer::clear() { - m_context->bindFramebuffer(m_framebuffer); - m_context->setViewport(m_size); + if (!m_context) + return; + + m_context->makeContextCurrent(); + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); + m_context->deleteFramebuffer(m_fbo); + m_fbo = 0; + + m_context.clear(); } -void DrawingBuffer::setWillPublishCallback(PassOwnPtr<WillPublishCallback> callback) +void DrawingBuffer::bind() { - m_callback = callback; + if (!m_context) + return; + + m_context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, m_fbo); + m_context->viewport(0, 0, m_size.width(), m_size.height()); } } // namespace WebCore + +#endif |