Index: src/gpu/GrStrokeInfo.h |
diff --git a/src/gpu/GrStrokeInfo.h b/src/gpu/GrStrokeInfo.h |
index d1eb14f62940f4577034ee36b8899538af694249..ebf4b45daeee4c4d71fedda4f4b4df38bac0c730 100644 |
--- a/src/gpu/GrStrokeInfo.h |
+++ b/src/gpu/GrStrokeInfo.h |
@@ -11,6 +11,8 @@ |
#include "SkStrokeRec.h" |
#include "SkPathEffect.h" |
+class GrUniqueKey; |
+ |
/* |
* GrStrokeInfo encapsulates all the pertinent infomation regarding the stroke. The SkStrokeRec |
* which holds information on fill style, width, miter, cap, and join. It also holds information |
@@ -60,6 +62,21 @@ public: |
return *this; |
} |
+ bool hasEqualEffect(const GrStrokeInfo& other) const { |
+ if (this->isDashed() != other.isDashed()) { |
+ return false; |
+ } |
+ if (this->isDashed()) { |
+ if (fDashPhase != other.fDashPhase || |
+ fIntervals.count() != other.fIntervals.count() || |
+ memcmp(fIntervals.get(), other.fIntervals.get(), |
+ fIntervals.count() * sizeof(SkScalar)) != 0) { |
+ return false; |
+ } |
+ } |
+ return this->INHERITED::hasEqualEffect(other); |
+ } |
+ |
/* |
* This functions takes in a patheffect and updates the dashing information if the path effect |
* is a Dash type. Returns true if the path effect is a dashed effect and we are stroking, |
@@ -127,6 +144,18 @@ public: |
*/ |
bool applyDashToPath(SkPath* dst, GrStrokeInfo* dstStrokeInfo, const SkPath& src) const; |
+ |
+ int computeUniqueKeyFragmentData32Cnt() const { |
egdaniel
2015/05/15 15:28:53
This function definitely needs some comments
Kimmo Kinnunen
2015/05/18 06:48:40
Done.
|
+ const int kSkScalarData32Cnt = sizeof(SkScalar) / sizeof(uint32_t); |
+ int strokeKeyData32Cnt = 1 + 2 * kSkScalarData32Cnt; |
egdaniel
2015/05/15 15:28:53
Is this trying to account for values that are is S
Kimmo Kinnunen
2015/05/18 06:48:40
Yeah. I'll add the comments
|
+ if (this->isDashed()) { |
+ strokeKeyData32Cnt += (1 + this->getDashCount()) * kSkScalarData32Cnt; |
egdaniel
2015/05/15 15:28:53
is the 1 for the phase here?
Kimmo Kinnunen
2015/05/18 06:48:40
Yeah
|
+ } |
+ return strokeKeyData32Cnt; |
+ } |
+ |
+ void asUniqueKeyFragment(uint32_t*) const; |
+ |
private: |
void init(const SkPaint& paint) { |
@@ -134,9 +163,6 @@ private: |
this->setDashInfo(pe); |
} |
- bool operator==(const SkStrokeRec& other) const; |
- bool operator!=(const SkStrokeRec& other) const; |
- |
SkPathEffect::DashType fDashType; |
SkScalar fDashPhase; |
SkAutoSTArray<2, SkScalar> fIntervals; |