LCOV - code coverage report
Current view: top level - gfx/2d - PathCairo.h (source / functions) Hit Total Coverage
Test: output.info Lines: 0 6 0.0 %
Date: 2017-07-14 16:53:18 Functions: 0 9 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
       2             :  * This Source Code Form is subject to the terms of the Mozilla Public
       3             :  * License, v. 2.0. If a copy of the MPL was not distributed with this
       4             :  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
       5             : 
       6             : #ifndef MOZILLA_GFX_PATH_CAIRO_H_
       7             : #define MOZILLA_GFX_PATH_CAIRO_H_
       8             : 
       9             : #include "2D.h"
      10             : #include "cairo.h"
      11             : #include <vector>
      12             : 
      13             : namespace mozilla {
      14             : namespace gfx {
      15             : 
      16             : class PathCairo;
      17             : 
      18           0 : class PathBuilderCairo : public PathBuilder
      19             : {
      20             : public:
      21           0 :   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathBuilderCairo)
      22             :   explicit PathBuilderCairo(FillRule aFillRule);
      23             : 
      24             :   virtual void MoveTo(const Point &aPoint);
      25             :   virtual void LineTo(const Point &aPoint);
      26             :   virtual void BezierTo(const Point &aCP1,
      27             :                         const Point &aCP2,
      28             :                         const Point &aCP3);
      29             :   virtual void QuadraticBezierTo(const Point &aCP1,
      30             :                                  const Point &aCP2);
      31             :   virtual void Close();
      32             :   virtual void Arc(const Point &aOrigin, float aRadius, float aStartAngle,
      33             :                    float aEndAngle, bool aAntiClockwise = false);
      34             :   virtual Point CurrentPoint() const;
      35             :   virtual already_AddRefed<Path> Finish();
      36             : 
      37           0 :   virtual BackendType GetBackendType() const { return BackendType::CAIRO; }
      38             : 
      39             : private: // data
      40             :   friend class PathCairo;
      41             : 
      42             :   FillRule mFillRule;
      43             :   std::vector<cairo_path_data_t> mPathData;
      44             :   // It's easiest to track this here, parsing the path data to find the current
      45             :   // point is a little tricky.
      46             :   Point mCurrentPoint;
      47             :   Point mBeginPoint;
      48             : };
      49             : 
      50             : class PathCairo : public Path
      51             : {
      52             : public:
      53           0 :   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathCairo)
      54             :   PathCairo(FillRule aFillRule, std::vector<cairo_path_data_t> &aPathData, const Point &aCurrentPoint);
      55             :   explicit PathCairo(cairo_t *aContext);
      56             :   ~PathCairo();
      57             : 
      58           0 :   virtual BackendType GetBackendType() const { return BackendType::CAIRO; }
      59             : 
      60             :   virtual already_AddRefed<PathBuilder> CopyToBuilder(FillRule aFillRule) const;
      61             :   virtual already_AddRefed<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
      62             :                                                              FillRule aFillRule) const;
      63             : 
      64             :   virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const;
      65             : 
      66             :   virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions,
      67             :                                    const Point &aPoint,
      68             :                                    const Matrix &aTransform) const;
      69             : 
      70             :   virtual Rect GetBounds(const Matrix &aTransform = Matrix()) const;
      71             : 
      72             :   virtual Rect GetStrokedBounds(const StrokeOptions &aStrokeOptions,
      73             :                                 const Matrix &aTransform = Matrix()) const;
      74             : 
      75             :   virtual void StreamToSink(PathSink *aSink) const;
      76             : 
      77           0 :   virtual FillRule GetFillRule() const { return mFillRule; }
      78             : 
      79             :   void SetPathOnContext(cairo_t *aContext) const;
      80             : 
      81             :   void AppendPathToBuilder(PathBuilderCairo *aBuilder, const Matrix *aTransform = nullptr) const;
      82             : private:
      83             :   void EnsureContainingContext(const Matrix &aTransform) const;
      84             : 
      85             :   FillRule mFillRule;
      86             :   std::vector<cairo_path_data_t> mPathData;
      87             :   mutable cairo_t *mContainingContext;
      88             :   mutable Matrix mContainingTransform;
      89             :   Point mCurrentPoint;
      90             : };
      91             : 
      92             : } // namespace gfx
      93             : } // namespace mozilla
      94             : 
      95             : #endif /* MOZILLA_GFX_PATH_CAIRO_H_ */

Generated by: LCOV version 1.13