AcceleratedCompositingContext.h [plain text]
#ifndef AcceleratedCompositingContext_h
#define AcceleratedCompositingContext_h
#include "GraphicsLayer.h"
#include "GraphicsLayerClient.h"
#include "IntRect.h"
#include "IntSize.h"
#include "Timer.h"
#include "webkitwebview.h"
#include <wtf/PassOwnPtr.h>
#if USE(TEXTURE_MAPPER)
#include "TextureMapperLayer.h"
#endif
#if USE(TEXTURE_MAPPER_GL)
#include "GLContext.h"
#include "RedirectedXCompositeWindow.h"
#include "TextureMapperFPSCounter.h"
#endif
#if USE(ACCELERATED_COMPOSITING)
namespace WebKit {
class AcceleratedCompositingContext : public WebCore::GraphicsLayerClient {
WTF_MAKE_NONCOPYABLE(AcceleratedCompositingContext);
public:
static PassOwnPtr<AcceleratedCompositingContext> create(WebKitWebView* webView)
{
return adoptPtr(new AcceleratedCompositingContext(webView));
}
virtual ~AcceleratedCompositingContext();
void setRootCompositingLayer(WebCore::GraphicsLayer*);
void setNonCompositedContentsNeedDisplay(const WebCore::IntRect&);
void scheduleLayerFlush();
void resizeRootLayer(const WebCore::IntSize&);
bool renderLayersToWindow(cairo_t*, const WebCore::IntRect& clipRect);
bool enabled();
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& rectToPaint);
void initialize();
enum CompositePurpose { ForResize, NotForResize };
void compositeLayersToContext(CompositePurpose = NotForResize);
void flushAndRenderLayers();
bool flushPendingLayerChanges();
void scrollNonCompositedContents(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollOffset);
private:
WebKitWebView* m_webView;
unsigned int m_layerFlushTimerCallbackId;
#if USE(CLUTTER)
GtkWidget* m_rootLayerEmbedder;
OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
static gboolean layerFlushTimerFiredCallback(AcceleratedCompositingContext*);
#elif USE(TEXTURE_MAPPER_GL)
OwnPtr<WebCore::RedirectedXCompositeWindow> m_redirectedWindow;
OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
OwnPtr<WebCore::TextureMapper> m_textureMapper;
double m_lastFlushTime;
double m_redrawPendingTime;
bool m_needsExtraFlush;
WebCore::TextureMapperFPSCounter m_fpsCounter;
void layerFlushTimerFired();
void stopAnyPendingLayerFlush();
static gboolean layerFlushTimerFiredCallback(AcceleratedCompositingContext*);
WebCore::GLContext* prepareForRendering();
void clearEverywhere();
#elif USE(TEXTURE_MAPPER)
WebCore::TextureMapperLayer* m_rootTextureMapperLayer;
OwnPtr<WebCore::GraphicsLayer> m_rootGraphicsLayer;
OwnPtr<WebCore::TextureMapper> m_textureMapper;
#endif
AcceleratedCompositingContext(WebKitWebView*);
};
}
#endif // USE(ACCELERATED_COMPOSITING)
#endif // AcceleratedCompositingContext_h