Index: include/core/SkPathRef.h |
diff --git a/include/core/SkPathRef.h b/include/core/SkPathRef.h |
index c09f6e87e471c1d8320a11156ef9dc64d0dbb92a..3ed0b61bd3b0f4756f5db1f7d9619e9ce14033dd 100644 |
--- a/include/core/SkPathRef.h |
+++ b/include/core/SkPathRef.h |
@@ -11,6 +11,7 @@ |
#include "SkMatrix.h" |
#include "SkPoint.h" |
+#include "SkRRect.h" |
#include "SkRect.h" |
#include "SkRefCnt.h" |
#include "SkTDArray.h" |
@@ -100,12 +101,39 @@ public: |
void setIsOval(bool isOval) { fPathRef->setIsOval(isOval); } |
+ void setIsRRect(bool isRRect) { fPathRef->setIsRRect(isRRect); } |
+ |
void setBounds(const SkRect& rect) { fPathRef->setBounds(rect); } |
private: |
SkPathRef* fPathRef; |
}; |
+ class SK_API Iter { |
+ public: |
+ Iter(); |
+ Iter(const SkPathRef&); |
+ |
robertphillips
2015/11/19 22:27:28
Should this be 'setPathRef' ?
caryclark
2015/11/19 22:36:05
Done.
|
+ void setPath(const SkPathRef&); |
+ |
+ /** Return the next verb in this iteration of the path. When all |
+ segments have been visited, return kDone_Verb. |
+ |
+ @param pts The points representing the current verb and/or segment |
+ This must not be NULL. |
+ @return The verb for the current segment |
+ */ |
+ uint8_t next(SkPoint pts[4]); |
+ |
+ SkScalar conicWeight() const { return *fConicWeights; } |
+ |
+ private: |
+ const SkPoint* fPts; |
+ const uint8_t* fVerbs; |
+ const uint8_t* fVerbStop; |
+ const SkScalar* fConicWeights; |
+ }; |
+ |
public: |
/** |
* Gets a path ref with no verbs or points. |
@@ -148,6 +176,14 @@ public: |
return SkToBool(fIsOval); |
} |
+ bool isRRect(SkRRect* rrect) const { |
+ if (fIsRRect && rrect) { |
robertphillips
2015/11/19 22:27:28
this->getRRect ?
caryclark
2015/11/19 22:36:05
Done.
|
+ *rrect = getRRect(); |
+ } |
+ return SkToBool(fIsRRect); |
+ } |
+ |
+ |
bool hasComputedBounds() const { |
return !fBoundsIsDirty; |
} |
@@ -164,6 +200,8 @@ public: |
return fBounds; |
} |
+ SkRRect getRRect() const; |
+ |
/** |
* Transforms a path ref by a matrix, allocating a new one only if necessary. |
*/ |
@@ -250,6 +288,7 @@ public: |
private: |
enum SerializationOffsets { |
+ kIsRRect_SerializationShift = 26, // requires 1 bit |
kIsFinite_SerializationShift = 25, // requires 1 bit |
kIsOval_SerializationShift = 24, // requires 1 bit |
kSegmentMask_SerializationShift = 0 // requires 4 bits |
@@ -265,6 +304,7 @@ private: |
fGenerationID = kEmptyGenID; |
fSegmentMask = 0; |
fIsOval = false; |
+ fIsRRect = false; |
SkDEBUGCODE(fEditorsAttached = 0;) |
SkDEBUGCODE(this->validate();) |
} |
@@ -312,6 +352,7 @@ private: |
fSegmentMask = 0; |
fIsOval = false; |
+ fIsRRect = false; |
size_t newSize = sizeof(uint8_t) * verbCount + sizeof(SkPoint) * pointCount; |
size_t newReserve = sizeof(uint8_t) * reserveVerbs + sizeof(SkPoint) * reservePoints; |
@@ -411,9 +452,12 @@ private: |
void setIsOval(bool isOval) { fIsOval = isOval; } |
+ void setIsRRect(bool isRRect) { fIsRRect = isRRect; } |
+ |
SkPoint* getPoints() { |
SkDEBUGCODE(this->validate();) |
fIsOval = false; |
+ fIsRRect = false; |
reed1
2015/11/19 19:28:10
do we remember why calling this forces us to wack
caryclark
2015/11/19 20:49:05
This is only called by the editor.
Added a const f
|
return fPoints; |
} |
@@ -428,6 +472,7 @@ private: |
mutable SkBool8 fIsFinite; // only meaningful if bounds are valid |
SkBool8 fIsOval; |
reed1
2015/11/19 19:28:10
we now have 5 bytes in a row, do we want to move a
caryclark
2015/11/19 20:49:05
Done.
|
+ SkBool8 fIsRRect; |
uint8_t fSegmentMask; |
SkPoint* fPoints; // points to begining of the allocation |
@@ -446,6 +491,7 @@ private: |
SkTDArray<GenIDChangeListener*> fGenIDChangeListeners; // pointers are owned |
friend class PathRefTest_Private; |
+ friend class ForceIsRRect_Private; // unit test isRRect |
typedef SkRefCnt INHERITED; |
}; |