#ifndef UpdateAtlas_h
#define UpdateAtlas_h
#include "ShareableSurface.h"
#if USE(UI_SIDE_COMPOSITING)
namespace WebCore {
class GraphicsContext;
class IntRect;
}
namespace WebKit {
class UpdateAtlas {
public:
UpdateAtlas(int dimension, ShareableBitmap::Flags);
PassRefPtr<ShareableSurface> surface() { return m_surface; }
inline WebCore::IntSize size() const { return m_surface->size(); }
PassOwnPtr<WebCore::GraphicsContext> beginPaintingOnAvailableBuffer(const WebCore::IntSize&, WebCore::IntPoint& offset);
void didSwapBuffers();
ShareableBitmap::Flags flags() const { return m_flags; }
private:
void buildLayoutIfNeeded();
WebCore::IntPoint offsetForIndex(int) const;
int findAvailableIndex(const WebCore::IntSize&);
private:
enum State {
Available,
Taken
};
Vector<State> m_bufferStates;
Vector<int> m_layout;
ShareableBitmap::Flags m_flags;
RefPtr<ShareableSurface> m_surface;
};
}
#endif
#endif // UpdateAtlas_h