Bug 1077544 - Add a GetBackendType() method to PathBuilder. r=Bas
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -530,16 +530,18 @@ protected:
class PathBuilder : public PathSink
{
public:
MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathBuilder)
/** Finish writing to the path and return a Path object that can be used for
* drawing. Future use of the builder results in a crash!
*/
virtual TemporaryRef<Path> Finish() = 0;
+
+ virtual BackendType GetBackendType() const = 0;
};
struct Glyph
{
uint32_t mIndex;
Point mPosition;
};
--- a/gfx/2d/PathCG.h
+++ b/gfx/2d/PathCG.h
@@ -42,16 +42,18 @@ public:
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();
+ virtual BackendType GetBackendType() const { return BackendType::COREGRAPHICS; }
+
private:
friend class PathCG;
friend class ScaledFontMac;
void EnsureActive(const Point &aPoint);
CGMutablePathRef mCGPath;
Point mCurrentPoint;
--- a/gfx/2d/PathCairo.h
+++ b/gfx/2d/PathCairo.h
@@ -30,16 +30,18 @@ public:
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();
+ virtual BackendType GetBackendType() const { return BackendType::CAIRO; }
+
private: // data
friend class PathCairo;
FillRule mFillRule;
std::vector<cairo_path_data_t> mPathData;
// It's easiest to track this here, parsing the path data to find the current
// point is a little tricky.
Point mCurrentPoint;
--- a/gfx/2d/PathD2D.h
+++ b/gfx/2d/PathD2D.h
@@ -37,16 +37,18 @@ public:
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();
+ virtual BackendType GetBackendType() const { return BackendType::DIRECT2D; }
+
ID2D1GeometrySink *GetSink() { return mSink; }
private:
friend class PathD2D;
void EnsureActive(const Point &aPoint);
RefPtr<ID2D1GeometrySink> mSink;
--- a/gfx/2d/PathRecording.h
+++ b/gfx/2d/PathRecording.h
@@ -67,16 +67,18 @@ public:
/* Point the current subpath is at - or where the next subpath will start
* if there is no active subpath.
*/
virtual Point CurrentPoint() const;
virtual TemporaryRef<Path> Finish();
+ virtual BackendType GetBackendType() const { return BackendType::RECORDING; }
+
private:
friend class PathRecording;
RefPtr<PathBuilder> mPathBuilder;
FillRule mFillRule;
std::vector<PathOp> mPathOps;
};
--- a/gfx/2d/PathSkia.h
+++ b/gfx/2d/PathSkia.h
@@ -31,16 +31,18 @@ public:
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();
void AppendPath(const SkPath &aPath);
+ virtual BackendType GetBackendType() const { return BackendType::SKIA; }
+
private:
void SetFillRule(FillRule aFillRule);
SkPath mPath;
FillRule mFillRule;
};