aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-24 20:32:22 +0000
committerreed@google.com <reed@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2012-05-24 20:32:22 +0000
commitd3521f1a8dc07fe84d6a8f2151b0c176ff1ec8ca (patch)
tree7f04020f99f01833c1d8e63b910c8490b0ae0e34 /include
parent9797272edfc73f18b4807751377518317991b880 (diff)
downloadskia-d3521f1a8dc07fe84d6a8f2151b0c176ff1ec8ca.tar.gz
revert 4046 -- GM:pathfill failed on one bot, maybe uninitialized memory somewhere?
git-svn-id: http://skia.googlecode.com/svn/trunk@4047 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'include')
-rw-r--r--include/core/SkPathEffect.h106
-rw-r--r--include/effects/Sk1DPathEffect.h6
-rw-r--r--include/effects/Sk2DPathEffect.h2
-rw-r--r--include/effects/SkCornerPathEffect.h2
-rw-r--r--include/effects/SkDashPathEffect.h4
-rw-r--r--include/effects/SkDiscretePathEffect.h4
6 files changed, 24 insertions, 100 deletions
diff --git a/include/core/SkPathEffect.h b/include/core/SkPathEffect.h
index edf749b44c..c4a60d23fe 100644
--- a/include/core/SkPathEffect.h
+++ b/include/core/SkPathEffect.h
@@ -11,85 +11,9 @@
#define SkPathEffect_DEFINED
#include "SkFlattenable.h"
-#include "SkPaint.h"
class SkPath;
-class SkStrokeRec {
-public:
- enum InitStyle {
- kHairline_InitStyle,
- kFill_InitStyle
- };
- SkStrokeRec(InitStyle style);
-
- SkStrokeRec(const SkStrokeRec&);
- explicit SkStrokeRec(const SkPaint&);
-
- enum Style {
- kHairline_Style,
- kFill_Style,
- kStroke_Style,
- kStrokeAndFill_Style
- };
-
- Style getStyle() const;
- SkScalar getWidth() const { return fWidth; }
- SkScalar getMiter() const { return fWidth; }
- SkPaint::Cap getCap() const { return fCap; }
- SkPaint::Join getJoin() const { return fJoin; }
-
- bool isHairlineStyle() const {
- return kHairline_Style == this->getStyle();
- }
-
- bool isFillStyle() const {
- return kFill_Style == this->getStyle();
- }
-
- void setFillStyle() { fWidth = -SK_Scalar1; }
- void setHairlineStyle() { fWidth = 0; }
-
- void setStrokeStyle(SkScalar width, bool strokeAndFill = false) {
- fWidth = width;
- fStrokeAndFill = strokeAndFill;
- }
-
- void setStrokeParams(SkPaint::Cap cap, SkPaint::Join join, SkScalar miterLimit) {
- fCap = cap;
- fJoin = join;
- fMiterLimit = miterLimit;
- }
-
- /**
- * Returns true if this specifes any thick stroking, i.e. applyToPath()
- * will return true.
- */
- bool needToApply() const {
- Style style = this->getStyle();
- return (kStroke_Style == style) || (kStrokeAndFill_Style == style);
- }
-
- /**
- * Apply these stroke parameters to the src path, returning the result
- * in dst.
- *
- * If there was no change (i.e. style == hairline or fill) this returns
- * false and dst is unchanged. Otherwise returns true and the result is
- * stored in dst.
- *
- * src and dst may be the same path.
- */
- bool applyToPath(SkPath* dst, const SkPath& src) const;
-
-private:
- SkScalar fWidth;
- SkScalar fMiterLimit;
- SkPaint::Cap fCap;
- SkPaint::Join fJoin;
- bool fStrokeAndFill;
-};
-
/** \class SkPathEffect
SkPathEffect is the base class for objects in the SkPaint that affect
@@ -102,22 +26,13 @@ class SK_API SkPathEffect : public SkFlattenable {
public:
SkPathEffect() {}
- /**
- * Given a src path (input) and a stroke-rec (input and output), apply
- * this effect to the src path, returning the new path in dst, and return
- * true. If this effect cannot be applied, return false and ignore dst
- * and stroke-rec.
- *
- * The stroke-rec specifies the initial request for stroking (if any).
- * The effect can treat this as input only, or it can choose to change
- * the rec as well. For example, the effect can decide to change the
- * stroke's width or join, or the effect can change the rec from stroke
- * to fill (or fill to stroke) in addition to returning a new (dst) path.
- *
- * If this method returns true, the caller will apply (as needed) the
- * resulting stroke-rec to dst and then draw.
- */
- virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) = 0;
+ /** Given a src path and a width value, return true if the patheffect
+ has produced a new path (dst) and a new width value. If false is returned,
+ ignore dst and width.
+ On input, width >= 0 means the src should be stroked
+ On output, width >= 0 means the dst should be stroked
+ */
+ virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width) = 0;
/**
* Compute a conservative bounds for its effect, given the src bounds.
@@ -173,7 +88,9 @@ public:
SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
: INHERITED(outer, inner) {}
- virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
+ // overrides
+
+ virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
@@ -203,7 +120,8 @@ public:
SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
: INHERITED(first, second) {}
- virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
+ // overrides
+ virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
diff --git a/include/effects/Sk1DPathEffect.h b/include/effects/Sk1DPathEffect.h
index eafac36b89..25b6ff32d8 100644
--- a/include/effects/Sk1DPathEffect.h
+++ b/include/effects/Sk1DPathEffect.h
@@ -18,7 +18,8 @@ class SkPathMeasure;
// This class is not exported to java.
class Sk1DPathEffect : public SkPathEffect {
public:
- virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
+ // override from SkPathEffect
+ virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
protected:
/** Called at the start of each contour, returns the initial offset
@@ -55,7 +56,8 @@ public:
*/
SkPath1DPathEffect(const SkPath& path, SkScalar advance, SkScalar phase, Style);
- virtual bool filterPath(SkPath*, const SkPath&, SkStrokeRec*) SK_OVERRIDE;
+ // override from SkPathEffect
+ virtual bool filterPath(SkPath*, const SkPath&, SkScalar* width) SK_OVERRIDE;
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkPath1DPathEffect)
diff --git a/include/effects/Sk2DPathEffect.h b/include/effects/Sk2DPathEffect.h
index 724fb8f3a1..30bbe1ab16 100644
--- a/include/effects/Sk2DPathEffect.h
+++ b/include/effects/Sk2DPathEffect.h
@@ -19,7 +19,7 @@ public:
Sk2DPathEffect(const SkMatrix& mat);
// overrides
- virtual bool filterPath(SkPath*, const SkPath&, SkStrokeRec*) SK_OVERRIDE;
+ virtual bool filterPath(SkPath*, const SkPath&, SkScalar* width) SK_OVERRIDE;
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(Sk2DPathEffect)
diff --git a/include/effects/SkCornerPathEffect.h b/include/effects/SkCornerPathEffect.h
index 02fe6d9b9f..01dae7e6f3 100644
--- a/include/effects/SkCornerPathEffect.h
+++ b/include/effects/SkCornerPathEffect.h
@@ -27,7 +27,7 @@ public:
// overrides for SkPathEffect
// This method is not exported to java.
- virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
+ virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkCornerPathEffect)
diff --git a/include/effects/SkDashPathEffect.h b/include/effects/SkDashPathEffect.h
index 87580aa37d..0c9e53cc31 100644
--- a/include/effects/SkDashPathEffect.h
+++ b/include/effects/SkDashPathEffect.h
@@ -41,7 +41,9 @@ public:
SkDashPathEffect(const SkScalar intervals[], int count, SkScalar phase, bool scaleToFit = false);
virtual ~SkDashPathEffect();
- virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
+ // overrides for SkPathEffect
+ // This method is not exported to java.
+ virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
// overrides for SkFlattenable
// This method is not exported to java.
diff --git a/include/effects/SkDiscretePathEffect.h b/include/effects/SkDiscretePathEffect.h
index 29fd3c5242..30d07d3c21 100644
--- a/include/effects/SkDiscretePathEffect.h
+++ b/include/effects/SkDiscretePathEffect.h
@@ -24,7 +24,9 @@ public:
*/
SkDiscretePathEffect(SkScalar segLength, SkScalar deviation);
- virtual bool filterPath(SkPath* dst, const SkPath& src, SkStrokeRec*) SK_OVERRIDE;
+ // overrides for SkPathEffect
+ // This method is not exported to java.
+ virtual bool filterPath(SkPath* dst, const SkPath& src, SkScalar* width);
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkDiscretePathEffect)