summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/skia/include/core/SkPathEffect.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/third_party/skia/include/core/SkPathEffect.h')
-rw-r--r--chromium/third_party/skia/include/core/SkPathEffect.h56
1 files changed, 44 insertions, 12 deletions
diff --git a/chromium/third_party/skia/include/core/SkPathEffect.h b/chromium/third_party/skia/include/core/SkPathEffect.h
index ed6d93b7655..562025351e8 100644
--- a/chromium/third_party/skia/include/core/SkPathEffect.h
+++ b/chromium/third_party/skia/include/core/SkPathEffect.h
@@ -31,8 +31,6 @@ class SK_API SkPathEffect : public SkFlattenable {
public:
SK_DECLARE_INST_COUNT(SkPathEffect)
- 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
@@ -106,10 +104,38 @@ public:
const SkStrokeRec&, const SkMatrix&,
const SkRect* cullR) const;
+ /**
+ * If the PathEffect can be represented as a dash pattern, asADash will return kDash_DashType
+ * and None otherwise. If a non NULL info is passed in, the various DashInfo will be filled
+ * in if the PathEffect can be a dash pattern. If passed in info has an fCount equal or
+ * greater to that of the effect, it will memcpy the values of the dash intervals into the
+ * info. Thus the general approach will be call asADash once with default info to get DashType
+ * and fCount. If effect can be represented as a dash pattern, allocate space for the intervals
+ * in info, then call asADash again with the same info and the intervals will get copied in.
+ */
+
+ enum DashType {
+ kNone_DashType, //!< ignores the info parameter
+ kDash_DashType, //!< fills in all of the info parameter
+ };
+
+ struct DashInfo {
+ DashInfo() : fIntervals(NULL), fCount(0), fPhase(0) {}
+
+ SkScalar* fIntervals; //!< Length of on/off intervals for dashed lines
+ // Even values represent ons, and odds offs
+ int32_t fCount; //!< Number of intervals in the dash. Should be even number
+ SkScalar fPhase; //!< Offset into the dashed interval pattern
+ // mod the sum of all intervals
+ };
+
+ virtual DashType asADash(DashInfo* info) const;
+
SK_DEFINE_FLATTENABLE_TYPE(SkPathEffect)
protected:
- SkPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
+ SkPathEffect() {}
+ SkPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
private:
// illegal
@@ -127,12 +153,12 @@ private:
*/
class SkPairPathEffect : public SkPathEffect {
public:
- SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1);
virtual ~SkPairPathEffect();
protected:
- SkPairPathEffect(SkFlattenableReadBuffer&);
- virtual void flatten(SkFlattenableWriteBuffer&) const SK_OVERRIDE;
+ SkPairPathEffect(SkPathEffect* pe0, SkPathEffect* pe1);
+ SkPairPathEffect(SkReadBuffer&);
+ virtual void flatten(SkWriteBuffer&) const SK_OVERRIDE;
// these are visible to our subclasses
SkPathEffect* fPE0, *fPE1;
@@ -153,8 +179,9 @@ public:
The reference counts for outer and inner are both incremented in the constructor,
and decremented in the destructor.
*/
- SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
- : INHERITED(outer, inner) {}
+ static SkComposePathEffect* Create(SkPathEffect* outer, SkPathEffect* inner) {
+ return SkNEW_ARGS(SkComposePathEffect, (outer, inner));
+ }
virtual bool filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
@@ -162,7 +189,9 @@ public:
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkComposePathEffect)
protected:
- SkComposePathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
+ SkComposePathEffect(SkPathEffect* outer, SkPathEffect* inner)
+ : INHERITED(outer, inner) {}
+ explicit SkComposePathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
private:
// illegal
@@ -184,8 +213,9 @@ public:
The reference counts for first and second are both incremented in the constructor,
and decremented in the destructor.
*/
- SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
- : INHERITED(first, second) {}
+ static SkSumPathEffect* Create(SkPathEffect* first, SkPathEffect* second) {
+ return SkNEW_ARGS(SkSumPathEffect, (first, second));
+ }
virtual bool filterPath(SkPath* dst, const SkPath& src,
SkStrokeRec*, const SkRect*) const SK_OVERRIDE;
@@ -193,7 +223,9 @@ public:
SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(SkSumPathEffect)
protected:
- SkSumPathEffect(SkFlattenableReadBuffer& buffer) : INHERITED(buffer) {}
+ SkSumPathEffect(SkPathEffect* first, SkPathEffect* second)
+ : INHERITED(first, second) {}
+ explicit SkSumPathEffect(SkReadBuffer& buffer) : INHERITED(buffer) {}
private:
// illegal