LayerBackingStore.h [plain text]
#ifndef LayerBackingStore_h
#define LayerBackingStore_h
#if USE(UI_SIDE_COMPOSITING)
#include "TextureMapper.h"
#include "TextureMapperBackingStore.h"
#include <wtf/HashMap.h>
namespace WebKit {
class ShareableSurface;
class LayerBackingStoreTile : public WebCore::TextureMapperTile {
public:
LayerBackingStoreTile(float scale = 1)
: TextureMapperTile(WebCore::FloatRect())
, m_scale(scale)
{
}
inline float scale() const { return m_scale; }
void swapBuffers(WebCore::TextureMapper*);
void setBackBuffer(const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface> buffer, const WebCore::IntPoint&);
private:
RefPtr<ShareableSurface> m_surface;
WebCore::IntRect m_sourceRect;
WebCore::IntRect m_targetRect;
WebCore::IntPoint m_surfaceOffset;
float m_scale;
};
class LayerBackingStore : public WebCore::TextureMapperBackingStore {
public:
void createTile(int, float);
void removeTile(int);
void updateTile(int, const WebCore::IntRect&, const WebCore::IntRect&, PassRefPtr<ShareableSurface>, const WebCore::IntPoint&);
static PassRefPtr<LayerBackingStore> create() { return adoptRef(new LayerBackingStore); }
void commitTileOperations(WebCore::TextureMapper*);
PassRefPtr<WebCore::BitmapTexture> texture() const;
virtual void paintToTextureMapper(WebCore::TextureMapper*, const WebCore::FloatRect&, const WebCore::TransformationMatrix&, float, WebCore::BitmapTexture*);
private:
LayerBackingStore()
: m_scale(1.)
{ }
HashMap<int, LayerBackingStoreTile> m_tiles;
Vector<int> m_tilesToRemove;
float m_scale;
};
} #endif
#endif // LayerBackingStore_h