LCOV - code coverage report
Current view: top level - gfx/2d - PathSkia.h (source / functions) Hit Total Coverage
Test: output.info Lines: 10 12 83.3 %
Date: 2017-07-14 16:53:18 Functions: 11 13 84.6 %
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_SKIA_H_
       7             : #define MOZILLA_GFX_PATH_SKIA_H_
       8             : 
       9             : #include "2D.h"
      10             : #include "skia/include/core/SkPath.h"
      11             : 
      12             : namespace mozilla {
      13             : namespace gfx {
      14             : 
      15             : class PathSkia;
      16             : 
      17         336 : class PathBuilderSkia : public PathBuilder
      18             : {
      19             : public:
      20         336 :   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathBuilderSkia)
      21             :   PathBuilderSkia(const Matrix& aTransform, const SkPath& aPath, FillRule aFillRule);
      22             :   explicit PathBuilderSkia(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             :   void AppendPath(const SkPath &aPath);
      38             : 
      39           0 :   virtual BackendType GetBackendType() const { return BackendType::SKIA; }
      40             : 
      41             : private:
      42             : 
      43             :   void SetFillRule(FillRule aFillRule);
      44             : 
      45             :   SkPath mPath;
      46             :   FillRule mFillRule;
      47             : };
      48             : 
      49         204 : class PathSkia : public Path
      50             : {
      51             : public:
      52        1120 :   MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathSkia)
      53         112 :   PathSkia(SkPath& aPath, FillRule aFillRule)
      54         112 :     : mFillRule(aFillRule)
      55             :   {
      56         112 :     mPath.swap(aPath);
      57         112 :   }
      58             :   
      59         138 :   virtual BackendType GetBackendType() const { return BackendType::SKIA; }
      60             : 
      61             :   virtual already_AddRefed<PathBuilder> CopyToBuilder(FillRule aFillRule) const;
      62             :   virtual already_AddRefed<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
      63             :                                                              FillRule aFillRule) const;
      64             : 
      65             :   virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const;
      66             :   
      67             :   virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions,
      68             :                                    const Point &aPoint,
      69             :                                    const Matrix &aTransform) const;
      70             : 
      71             :   virtual Rect GetBounds(const Matrix &aTransform = Matrix()) const;
      72             :   
      73             :   virtual Rect GetStrokedBounds(const StrokeOptions &aStrokeOptions,
      74             :                                 const Matrix &aTransform = Matrix()) const;
      75             : 
      76             :   virtual void StreamToSink(PathSink *aSink) const;
      77             : 
      78           0 :   virtual FillRule GetFillRule() const { return mFillRule; }
      79             : 
      80         161 :   const SkPath& GetPath() const { return mPath; }
      81             : 
      82             : private:
      83             :   friend class DrawTargetSkia;
      84             :   
      85             :   SkPath mPath;
      86             :   FillRule mFillRule;
      87             : };
      88             : 
      89             : } // namespace gfx
      90             : } // namespace mozilla
      91             : 
      92             : #endif /* MOZILLA_GFX_PATH_SKIA_H_ */

Generated by: LCOV version 1.13