#ifndef MOZILLA_GFX_PATHBUILDERNVPR_H_
#define MOZILLA_GFX_PATHBUILDERNVPR_H_
#include "2D.h"
#include "nvpr/GL.h"
#include <vector>
namespace mozilla {
namespace gfx {
class PathObjectNVpr;
struct PathDescriptionNVpr {
PathDescriptionNVpr() {}
PathDescriptionNVpr(const PathDescriptionNVpr& aOther);
PathDescriptionNVpr(PathDescriptionNVpr&& aOther);
bool operator <(const PathDescriptionNVpr& aOther) const;
bool IsEmpty() const { return mCommands.empty() && mCoords.empty(); }
void Clear() { mCommands.clear(); mCoords.clear(); }
void AppendCommand(GLubyte aCommand) { mCommands.push_back(aCommand); }
void AppendPoint(const Point& aPt) { AppendFloat(aPt.x); AppendFloat(aPt.y); }
void AppendFloat(float aVal) { mCoords.push_back(aVal); }
std::vector<GLubyte> mCommands;
std::vector<GLfloat> mCoords;
};
class PathBuilderNVpr : public PathBuilder
{
public:
PathBuilderNVpr(FillRule aFillRule);
PathBuilderNVpr(FillRule aFillRule, TemporaryRef<PathObjectNVpr> aPathObject);
PathBuilderNVpr(FillRule aFillRule, TemporaryRef<PathObjectNVpr> aPathObject,
const Matrix& aTransform);
virtual ~PathBuilderNVpr();
virtual void MoveTo(const Point& aPoint);
virtual void LineTo(const Point& aPoint);
virtual void BezierTo(const Point& aCP1,
const Point& aCP2,
const Point& aCP3);
virtual void QuadraticBezierTo(const Point& aCP1,
const Point& aCP2);
virtual void Close();
virtual void Arc(const Point& aOrigin, Float aRadius, Float aStartAngle,
Float aEndAngle, bool aAntiClockwise = false);
virtual Point CurrentPoint() const;
virtual TemporaryRef<Path> Finish();
private:
void MakeWritable();
const FillRule mFillRule;
RefPtr<PathObjectNVpr> mPathObject;
PathDescriptionNVpr mDescription;
Point mStartPoint;
Point mCurrentPoint;
bool mIsPolygon;
};
}
}
#endif