gfx/2d/PathSkia.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
michael@0 2 * This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #ifndef MOZILLA_GFX_PATH_SKIA_H_
michael@0 7 #define MOZILLA_GFX_PATH_SKIA_H_
michael@0 8
michael@0 9 #include "2D.h"
michael@0 10 #include "skia/SkPath.h"
michael@0 11
michael@0 12 namespace mozilla {
michael@0 13 namespace gfx {
michael@0 14
michael@0 15 class PathSkia;
michael@0 16
michael@0 17 class PathBuilderSkia : public PathBuilder
michael@0 18 {
michael@0 19 public:
michael@0 20 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathBuilderSkia)
michael@0 21 PathBuilderSkia(const Matrix& aTransform, const SkPath& aPath, FillRule aFillRule);
michael@0 22 PathBuilderSkia(FillRule aFillRule);
michael@0 23
michael@0 24 virtual void MoveTo(const Point &aPoint);
michael@0 25 virtual void LineTo(const Point &aPoint);
michael@0 26 virtual void BezierTo(const Point &aCP1,
michael@0 27 const Point &aCP2,
michael@0 28 const Point &aCP3);
michael@0 29 virtual void QuadraticBezierTo(const Point &aCP1,
michael@0 30 const Point &aCP2);
michael@0 31 virtual void Close();
michael@0 32 virtual void Arc(const Point &aOrigin, float aRadius, float aStartAngle,
michael@0 33 float aEndAngle, bool aAntiClockwise = false);
michael@0 34 virtual Point CurrentPoint() const;
michael@0 35 virtual TemporaryRef<Path> Finish();
michael@0 36
michael@0 37 void AppendPath(const SkPath &aPath);
michael@0 38
michael@0 39 private:
michael@0 40
michael@0 41 void SetFillRule(FillRule aFillRule);
michael@0 42
michael@0 43 SkPath mPath;
michael@0 44 FillRule mFillRule;
michael@0 45 };
michael@0 46
michael@0 47 class PathSkia : public Path
michael@0 48 {
michael@0 49 public:
michael@0 50 MOZ_DECLARE_REFCOUNTED_VIRTUAL_TYPENAME(PathSkia)
michael@0 51 PathSkia(SkPath& aPath, FillRule aFillRule)
michael@0 52 : mFillRule(aFillRule)
michael@0 53 {
michael@0 54 mPath.swap(aPath);
michael@0 55 }
michael@0 56
michael@0 57 virtual BackendType GetBackendType() const { return BackendType::SKIA; }
michael@0 58
michael@0 59 virtual TemporaryRef<PathBuilder> CopyToBuilder(FillRule aFillRule = FillRule::FILL_WINDING) const;
michael@0 60 virtual TemporaryRef<PathBuilder> TransformedCopyToBuilder(const Matrix &aTransform,
michael@0 61 FillRule aFillRule = FillRule::FILL_WINDING) const;
michael@0 62
michael@0 63 virtual bool ContainsPoint(const Point &aPoint, const Matrix &aTransform) const;
michael@0 64
michael@0 65 virtual bool StrokeContainsPoint(const StrokeOptions &aStrokeOptions,
michael@0 66 const Point &aPoint,
michael@0 67 const Matrix &aTransform) const;
michael@0 68
michael@0 69 virtual Rect GetBounds(const Matrix &aTransform = Matrix()) const;
michael@0 70
michael@0 71 virtual Rect GetStrokedBounds(const StrokeOptions &aStrokeOptions,
michael@0 72 const Matrix &aTransform = Matrix()) const;
michael@0 73
michael@0 74 virtual void StreamToSink(PathSink *aSink) const;
michael@0 75
michael@0 76 virtual FillRule GetFillRule() const { return mFillRule; }
michael@0 77
michael@0 78 const SkPath& GetPath() const { return mPath; }
michael@0 79
michael@0 80 private:
michael@0 81 friend class DrawTargetSkia;
michael@0 82
michael@0 83 SkPath mPath;
michael@0 84 FillRule mFillRule;
michael@0 85 };
michael@0 86
michael@0 87 }
michael@0 88 }
michael@0 89
michael@0 90 #endif /* MOZILLA_GFX_PATH_SKIA_H_ */

mercurial