#ifndef SurfacePool_h
#define SurfacePool_h
#include "BackingStoreTile.h"
#include "PlatformContextSkia.h"
#include <BlackBerryPlatformGraphics.h>
#include <BlackBerryPlatformPrimitives.h>
#include <wtf/Vector.h>
#define ENABLE_COMPOSITING_SURFACE 1
namespace BlackBerry {
namespace WebKit {
class BackingStoreCompositingSurface;
class SurfacePool {
public:
static SurfacePool* globalSurfacePool();
void initialize(const BlackBerry::Platform::IntSize&);
int isActive() const { return !m_tilePool.isEmpty() && !m_buffersSuspended; }
int isEmpty() const { return m_tilePool.isEmpty(); }
int size() const { return m_tilePool.size(); }
typedef WTF::Vector<BackingStoreTile*> TileList;
const TileList tileList() const { return m_tilePool; }
PlatformGraphicsContext* createPlatformGraphicsContext(BlackBerry::Platform::Graphics::Drawable*) const;
PlatformGraphicsContext* lockTileRenderingSurface() const;
void releaseTileRenderingSurface(PlatformGraphicsContext*) const;
BackingStoreTile* visibleTileBuffer() const { return m_visibleTileBuffer; }
void initializeVisibleTileBuffer(const BlackBerry::Platform::IntSize&);
TileBuffer* backBuffer() const;
BackingStoreCompositingSurface* compositingSurface() const;
void notifyScreenRotated();
std::string sharedPixmapGroup() const;
void releaseBuffers();
void createBuffers();
private:
friend class BackingStoreTile;
SurfacePool();
TileList m_tilePool;
BackingStoreTile* m_visibleTileBuffer;
#if USE(ACCELERATED_COMPOSITING)
RefPtr<BackingStoreCompositingSurface> m_compositingSurface;
#endif
BlackBerry::Platform::Graphics::Buffer* m_tileRenderingSurface;
unsigned m_backBuffer;
bool m_initialized; bool m_buffersSuspended; };
}
}
#endif // SurfacePool_h