RenderSVGResourceClipper.h [plain text]
#ifndef RenderSVGResourceClipper_h
#define RenderSVGResourceClipper_h
#if ENABLE(SVG)
#include "FloatRect.h"
#include "GraphicsContext.h"
#include "ImageBuffer.h"
#include "IntSize.h"
#include "Path.h"
#include "RenderSVGResourceContainer.h"
#include "SVGClipPathElement.h"
#include "SVGUnitTypes.h"
#include <wtf/HashMap.h>
#include <wtf/OwnPtr.h>
namespace WebCore {
struct ClipperData {
OwnPtr<ImageBuffer> clipMaskImage;
};
class RenderSVGResourceClipper : public RenderSVGResourceContainer {
public:
RenderSVGResourceClipper(SVGClipPathElement*);
virtual ~RenderSVGResourceClipper();
virtual const char* renderName() const { return "RenderSVGResourceClipper"; }
virtual void invalidateClients();
virtual void invalidateClient(RenderObject*);
virtual bool applyResource(RenderObject*, RenderStyle*, GraphicsContext*&, unsigned short resourceMode);
virtual FloatRect resourceBoundingBox(RenderObject*);
virtual RenderSVGResourceType resourceType() const { return ClipperResourceType; }
SVGUnitTypes::SVGUnitType clipPathUnits() const { return toUnitType(static_cast<SVGClipPathElement*>(node())->clipPathUnits()); }
static RenderSVGResourceType s_resourceType;
private:
bool applyClippingToContext(RenderObject*, const FloatRect&, const FloatRect&, GraphicsContext*);
bool pathOnlyClipping(GraphicsContext*, const FloatRect&);
bool createClipData(ClipperData*, const FloatRect&, const FloatRect&);
void calculateClipContentRepaintRect();
FloatRect m_clipBoundaries;
HashMap<RenderObject*, ClipperData*> m_clipper;
};
}
#endif
#endif