BackingStoreTile.h [plain text]
#ifndef BackingStoreTile_h
#define BackingStoreTile_h
#include "BlackBerryPlatformIntRectRegion.h"
#include "BlackBerryPlatformMisc.h"
#include "BlackBerryPlatformPrimitives.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
namespace BlackBerry {
namespace Platform {
namespace Graphics {
struct Buffer;
}
}
namespace WebKit {
class Fence : public RefCounted<Fence> {
public:
static PassRefPtr<Fence> create(void* platformSync = 0)
{
return adoptRef(new Fence(platformSync));
}
void* takePlatformSync()
{
void* tmp = m_platformSync;
m_platformSync = 0;
return tmp;
}
~Fence();
private:
Fence(void* platformSync)
: m_platformSync(platformSync)
{
}
void* m_platformSync;
};
class TileBuffer {
public:
TileBuffer(const Platform::IntSize&);
~TileBuffer();
Platform::IntSize size() const;
Platform::IntRect surfaceRect() const;
Platform::IntRect pixelContentsRect() const;
Platform::IntPoint lastRenderOrigin() const { return m_lastRenderOrigin; }
void setLastRenderOrigin(const Platform::IntPoint& origin) { m_lastRenderOrigin = origin; }
double lastRenderScale() const { return m_lastRenderScale; }
void setLastRenderScale(double scale) { m_lastRenderScale = scale; }
bool isRendered(double scale) const;
bool isRendered(const Platform::IntRectRegion& pixelContentsRegion, double scale) const;
void clearRenderedRegion();
void clearRenderedRegion(const Platform::IntRectRegion&);
void addRenderedRegion(const Platform::IntRectRegion&);
Platform::IntRectRegion renderedRegion() const;
Platform::IntRectRegion notRenderedRegion() const;
Platform::Graphics::Buffer* nativeBuffer() const;
bool wasNativeBufferCreated() const;
bool backgroundPainted() const { return m_backgroundPainted; }
void paintBackground();
Fence* fence() const { return m_fence.get(); }
void setFence(PassRefPtr<Fence> fence) { m_fence = fence; }
private:
Platform::IntPoint m_lastRenderOrigin;
Platform::IntSize m_size;
Platform::IntRectRegion m_renderedRegion;
RefPtr<Fence> m_fence;
mutable Platform::Graphics::Buffer* m_nativeBuffer;
double m_lastRenderScale;
bool m_backgroundPainted;
DISABLE_COPY(TileBuffer)
};
} }
#endif // BackingStoreTile_h