CoordinatedGraphicsState.h [plain text]
#ifndef CoordinatedGraphicsState_h
#define CoordinatedGraphicsState_h
#if USE(COORDINATED_GRAPHICS)
#include "Color.h"
#include "FilterOperations.h"
#include "FloatRect.h"
#include "FloatSize.h"
#include "IntRect.h"
#include "IntSize.h"
#include "SurfaceUpdateInfo.h"
#include "TextureMapperAnimation.h"
#include "TransformationMatrix.h"
#if USE(GRAPHICS_SURFACE)
#include "GraphicsSurface.h"
#include "GraphicsSurfaceToken.h"
#endif
#if USE(COORDINATED_GRAPHICS_THREADED)
#include "TextureMapperPlatformLayerProxy.h"
#endif
namespace WebCore {
class CoordinatedSurface;
typedef uint32_t CoordinatedLayerID;
enum { InvalidCoordinatedLayerID = 0 };
typedef uint64_t CoordinatedImageBackingID;
enum { InvalidCoordinatedImageBackingID = 0 };
struct TileUpdateInfo {
uint32_t tileID;
IntRect tileRect;
WebCore::SurfaceUpdateInfo updateInfo;
};
struct TileCreationInfo {
uint32_t tileID;
float scale;
};
struct CoordinatedGraphicsLayerState {
union {
struct {
bool positionChanged: 1;
bool anchorPointChanged: 1;
bool sizeChanged: 1;
bool transformChanged: 1;
bool childrenTransformChanged: 1;
bool contentsRectChanged: 1;
bool opacityChanged: 1;
bool solidColorChanged: 1;
bool debugBorderColorChanged: 1;
bool debugBorderWidthChanged: 1;
bool replicaChanged: 1;
bool maskChanged: 1;
bool imageChanged: 1;
bool flagsChanged: 1;
bool animationsChanged: 1;
bool filtersChanged: 1;
bool childrenChanged: 1;
bool repaintCountChanged : 1;
bool platformLayerChanged: 1;
bool platformLayerShouldSwapBuffers: 1;
bool isScrollableChanged: 1;
bool committedScrollOffsetChanged: 1;
bool contentsTilingChanged: 1;
};
unsigned changeMask;
};
union {
struct {
bool contentsOpaque : 1;
bool drawsContent : 1;
bool contentsVisible : 1;
bool backfaceVisible : 1;
bool masksToBounds : 1;
bool preserves3D : 1;
bool fixedToViewport : 1;
bool showDebugBorders : 1;
bool showRepaintCounter : 1;
bool isScrollable: 1;
};
unsigned flags;
};
CoordinatedGraphicsLayerState()
: changeMask(0)
, contentsOpaque(false)
, drawsContent(false)
, contentsVisible(true)
, backfaceVisible(true)
, masksToBounds(false)
, preserves3D(false)
, fixedToViewport(false)
, showDebugBorders(false)
, showRepaintCounter(false)
, isScrollable(false)
, opacity(0)
, debugBorderWidth(0)
, replica(InvalidCoordinatedLayerID)
, mask(InvalidCoordinatedLayerID)
, imageID(InvalidCoordinatedImageBackingID)
#if USE(GRAPHICS_SURFACE)
, platformLayerFrontBuffer(0)
#endif
#if USE(COORDINATED_GRAPHICS_THREADED)
, platformLayerProxy(0)
#endif
{
}
FloatPoint pos;
FloatPoint3D anchorPoint;
FloatSize size;
TransformationMatrix transform;
TransformationMatrix childrenTransform;
FloatRect contentsRect;
FloatSize contentsTilePhase;
FloatSize contentsTileSize;
float opacity;
Color solidColor;
Color debugBorderColor;
float debugBorderWidth;
FilterOperations filters;
TextureMapperAnimations animations;
Vector<uint32_t> children;
Vector<TileCreationInfo> tilesToCreate;
Vector<uint32_t> tilesToRemove;
CoordinatedLayerID replica;
CoordinatedLayerID mask;
CoordinatedImageBackingID imageID;
unsigned repaintCount;
Vector<TileUpdateInfo> tilesToUpdate;
#if USE(GRAPHICS_SURFACE)
IntSize platformLayerSize;
GraphicsSurfaceToken platformLayerToken;
uint32_t platformLayerFrontBuffer;
GraphicsSurface::Flags platformLayerSurfaceFlags;
#endif
#if USE(COORDINATED_GRAPHICS_THREADED)
RefPtr<TextureMapperPlatformLayerProxy> platformLayerProxy;
#endif
IntSize committedScrollOffset;
bool hasPendingChanges() const
{
return changeMask || tilesToUpdate.size() || tilesToRemove.size() || tilesToCreate.size();
}
};
struct CoordinatedGraphicsState {
uint32_t rootCompositingLayer;
FloatPoint scrollPosition;
IntSize contentsSize;
IntRect coveredRect;
Vector<CoordinatedLayerID> layersToCreate;
Vector<std::pair<CoordinatedLayerID, CoordinatedGraphicsLayerState> > layersToUpdate;
Vector<CoordinatedLayerID> layersToRemove;
Vector<CoordinatedImageBackingID> imagesToCreate;
Vector<CoordinatedImageBackingID> imagesToRemove;
Vector<std::pair<CoordinatedImageBackingID, RefPtr<CoordinatedSurface> > > imagesToUpdate;
Vector<CoordinatedImageBackingID> imagesToClear;
Vector<std::pair<uint32_t , RefPtr<CoordinatedSurface> > > updateAtlasesToCreate;
Vector<uint32_t > updateAtlasesToRemove;
};
}
#endif // USE(COORDINATED_GRAPHICS)
#endif // CoordinatedGraphicsState_h