Index: include/core/SkPath.h |
=================================================================== |
--- include/core/SkPath.h (revision 11438) |
+++ include/core/SkPath.h (working copy) |
@@ -187,12 +187,7 @@ |
* Returns true if all of the points in this path are finite, meaning there |
* are no infinities and no NaNs. |
*/ |
- bool isFinite() const { |
- if (fBoundsIsDirty) { |
- this->computeBounds(); |
- } |
- return SkToBool(fIsFinite); |
- } |
+ bool isFinite() const; |
/** Test a line for zero length |
@@ -280,12 +275,7 @@ |
Note: this bounds may be larger than the actual shape, since curves |
do not extend as far as their control points. |
*/ |
- const SkRect& getBounds() const { |
- if (fBoundsIsDirty) { |
- this->computeBounds(); |
- } |
- return fBounds; |
- } |
+ const SkRect& getBounds() const; |
/** Calling this will, if the internal cache of the bounds is out of date, |
update it so that subsequent calls to getBounds will be instantaneous. |
@@ -932,24 +922,27 @@ |
private: |
enum SerializationOffsets { |
+#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TOO |
+ kNewFormat_SerializationShift = 28, // requires 1 bit |
+#endif |
kDirection_SerializationShift = 26, // requires 2 bits |
- kIsFinite_SerializationShift = 25, // requires 1 bit |
+#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TOO |
+ // rename to kUnused_SerializationShift |
+ kOldIsFinite_SerializationShift = 25, // 1 bit |
+#endif |
kIsOval_SerializationShift = 24, // requires 1 bit |
- kConvexity_SerializationShift = 16, // requires 2 bits |
- kFillType_SerializationShift = 8, // requires 2 bits |
+ kConvexity_SerializationShift = 16, // requires 8 bits |
+ kFillType_SerializationShift = 8, // requires 8 bits |
kSegmentMask_SerializationShift = 0 // requires 4 bits |
}; |
SkAutoTUnref<SkPathRef> fPathRef; |
- mutable SkRect fBounds; |
int fLastMoveToIndex; |
uint8_t fFillType; |
uint8_t fSegmentMask; |
- mutable uint8_t fBoundsIsDirty; |
mutable uint8_t fConvexity; |
mutable uint8_t fDirection; |
- mutable SkBool8 fIsFinite; // only meaningful if bounds are valid |
mutable SkBool8 fIsOval; |
#ifdef SK_BUILD_FOR_ANDROID |
uint32_t fGenerationID; |
@@ -968,9 +961,6 @@ |
*/ |
void copyFields(const SkPath& that); |
- // called, if dirty, by getBounds() |
- void computeBounds() const; |
- |
friend class Iter; |
friend class SkPathStroker; |
@@ -1001,6 +991,17 @@ |
bool isRectContour(bool allowPartial, int* currVerb, const SkPoint** pts, |
bool* isClosed, Direction* direction) const; |
+ /** Returns if the path can return a bound at no cost (true) or will have to |
+ perform some computation (false). |
+ */ |
+ bool hasComputedBounds() const; |
+ |
+ // 'rect' needs to be sorted |
+ void setBounds(const SkRect& rect); |
bsalomon
2013/09/23 18:39:39
Eek... I didn't realize we let clients set the bou
robertphillips
2013/09/23 18:56:42
This is only used in SkAutoPathBoundsUpdate to avo
|
+ |
+#ifndef DELETE_THIS_CODE_WHEN_SKPS_ARE_REBUILT_AT_V14_AND_ALL_OTHER_INSTANCES_TOO |
+ friend class SkPathRef; // just for SerializationOffsets |
+#endif |
friend class SkAutoPathBoundsUpdate; |
friend class SkAutoDisableOvalCheck; |
friend class SkAutoDisableDirectionCheck; |