Bug 1077544 - Add a GetBackendType() method to PathBuilder. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Sat, 04 Oct 2014 12:13:29 +0100
changeset 232037 3f971d859cfbc4be117cb47fee9fd69fd9f21dd9
parent 232036 b2afb3535ace8584682b5c7965ea14d1e5b80280
child 232038 09935501bd80cc258af02de422c05ec7ef1cbe20
push id4187
push userbhearsum@mozilla.com
push dateFri, 28 Nov 2014 15:29:12 +0000
treeherdermozilla-beta@f23cc6a30c11 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1077544
milestone35.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1077544 - Add a GetBackendType() method to PathBuilder. r=Bas
gfx/2d/2D.h
gfx/2d/PathCG.h
gfx/2d/PathCairo.h
gfx/2d/PathD2D.h
gfx/2d/PathRecording.h
gfx/2d/PathSkia.h
--- 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;
 };