diff options
Diffstat (limited to 'WebCore/platform/graphics/gpu/DrawingBuffer.h')
-rw-r--r-- | WebCore/platform/graphics/gpu/DrawingBuffer.h | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/WebCore/platform/graphics/gpu/DrawingBuffer.h b/WebCore/platform/graphics/gpu/DrawingBuffer.h index 23e6f4a..75c7f99 100644 --- a/WebCore/platform/graphics/gpu/DrawingBuffer.h +++ b/WebCore/platform/graphics/gpu/DrawingBuffer.h @@ -31,30 +31,39 @@ #ifndef DrawingBuffer_h #define DrawingBuffer_h +#include "GraphicsContext3D.h" #include "GraphicsLayer.h" #include "IntSize.h" #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> +#if PLATFORM(MAC) +#include <wtf/RetainPtr.h> +#endif namespace WebCore { -class SharedGraphicsContext3D; - +#if PLATFORM(CHROMIUM) struct DrawingBufferInternal; +#endif // Manages a rendering target (framebuffer + attachment) for a canvas. Can publish its rendering // results to a PlatformLayer for compositing. -class DrawingBuffer : public Noncopyable { +class DrawingBuffer : public RefCounted<DrawingBuffer> { public: - static PassOwnPtr<DrawingBuffer> create(SharedGraphicsContext3D*, const IntSize&); + friend class GraphicsContext3D; + ~DrawingBuffer(); void reset(const IntSize&); void bind(); IntSize size() const { return m_size; } + // Clear all resources from this object, as well as context. Called when context is destroyed + // to prevent invalid accesses to the resources. + void clear(); + #if USE(ACCELERATED_COMPOSITING) PlatformLayer* platformLayer(); void publishToPlatformLayer(); @@ -62,21 +71,36 @@ public: unsigned getRenderingResultsAsTexture(); +#if PLATFORM(CHROMIUM) class WillPublishCallback : public Noncopyable { public: + virtual ~WillPublishCallback() { } + virtual void willPublish() = 0; }; - void setWillPublishCallback(PassOwnPtr<WillPublishCallback>); + void setWillPublishCallback(PassOwnPtr<WillPublishCallback> callback) { m_callback = callback; } +#endif + + PassRefPtr<GraphicsContext3D> graphicsContext3D() const { return m_context; } + private: - DrawingBuffer(SharedGraphicsContext3D*, const IntSize&, unsigned framebuffer); + static PassRefPtr<DrawingBuffer> create(GraphicsContext3D*, const IntSize&); + + DrawingBuffer(GraphicsContext3D*, const IntSize&); - SharedGraphicsContext3D* m_context; + RefPtr<GraphicsContext3D> m_context; IntSize m_size; - unsigned m_framebuffer; + Platform3DObject m_fbo; +#if PLATFORM(CHROMIUM) OwnPtr<WillPublishCallback> m_callback; OwnPtr<DrawingBufferInternal> m_internal; +#endif + +#if PLATFORM(MAC) + RetainPtr<WebGLLayer> m_platformLayer; +#endif }; } // namespace WebCore |