#ifndef PaintInfo_h
#define PaintInfo_h
#if ENABLE(SVG)
#include "AffineTransform.h"
#endif
#include "GraphicsContext.h"
#include "IntRect.h"
#include "PaintPhase.h"
#include <wtf/HashMap.h>
#include <wtf/ListHashSet.h>
namespace WebCore {
class OverlapTestRequestClient;
class RenderInline;
class RenderObject;
typedef HashMap<OverlapTestRequestClient*, IntRect> OverlapTestRequestMap;
struct PaintInfo {
PaintInfo(GraphicsContext* newContext, const IntRect& newRect, PaintPhase newPhase, bool newForceBlackText,
RenderObject* newPaintingRoot, ListHashSet<RenderInline*>* newOutlineObjects,
OverlapTestRequestMap* overlapTestRequests = 0)
: context(newContext)
, rect(newRect)
, phase(newPhase)
, forceBlackText(newForceBlackText)
, paintingRoot(newPaintingRoot)
, outlineObjects(newOutlineObjects)
, overlapTestRequests(overlapTestRequests)
{
}
void updatePaintingRootForChildren(const RenderObject* renderer)
{
if (!paintingRoot)
return;
if (paintingRoot == renderer) {
paintingRoot = 0;
return;
}
}
bool shouldPaintWithinRoot(const RenderObject* renderer) const
{
return !paintingRoot || paintingRoot == renderer;
}
#if ENABLE(SVG)
void applyTransform(const AffineTransform& localToAncestorTransform)
{
if (localToAncestorTransform.isIdentity())
return;
context->concatCTM(localToAncestorTransform);
if (rect == infiniteRect())
return;
rect = localToAncestorTransform.inverse().mapRect(rect);
}
#endif
static IntRect infiniteRect() { return IntRect(INT_MIN / 2, INT_MIN / 2, INT_MAX, INT_MAX); }
GraphicsContext* context;
IntRect rect;
PaintPhase phase;
bool forceBlackText;
RenderObject* paintingRoot; ListHashSet<RenderInline*>* outlineObjects; OverlapTestRequestMap* overlapTestRequests;
};
}
#endif // PaintInfo_h