Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: include/core/SkPathRef.h

Issue 146913002: Move fLastMoveToIndex from SkPath to SkPathRef (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: More clean up Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/core/SkPath.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkPathRef.h
===================================================================
--- include/core/SkPathRef.h (revision 13245)
+++ include/core/SkPathRef.h (working copy)
@@ -104,6 +104,13 @@
void setBounds(const SkRect& rect) { fPathRef->setBounds(rect); }
+ // In some cases we need to inject a leading moveTo before we add points
+ // for lineTo, quadTo, conicTo, cubicTo
+ //
+ // SkPath path; path.lineTo(...); <--- need a leading moveTo(0, 0)
+ // SkPath path; ... path.close(); path.lineTo(...) <-- need a moveTo(previous moveTo)
+ void injectMoveToIfNeeded() { fPathRef->injectMoveToIfNeeded(); }
+
private:
SkPathRef* fPathRef;
};
@@ -254,6 +261,9 @@
uint32_t genID() const;
private:
+ // flag to require a moveTo if we begin with something else, like lineTo etc.
+ static const int kINITIAL_LASTMOVETOINDEX_VALUE = ~0;
+
enum SerializationOffsets {
kIsFinite_SerializationShift = 25, // requires 1 bit
kIsOval_SerializationShift = 24, // requires 1 bit
@@ -261,6 +271,7 @@
};
SkPathRef() {
+ fLastMoveToIndex = kINITIAL_LASTMOVETOINDEX_VALUE;
fBoundsIsDirty = true; // this also invalidates fIsFinite
fPointCnt = 0;
fVerbCnt = 0;
@@ -348,6 +359,8 @@
SkDEBUGCODE(this->validate();)
}
+ void injectMoveToIfNeeded();
+
/**
* Increases the verb count by numVbs and point count by the required amount.
* The new points are uninitialized. All the new verbs are set to the specified
@@ -433,6 +446,7 @@
};
mutable SkRect fBounds;
+ int fLastMoveToIndex;
uint8_t fSegmentMask;
mutable uint8_t fBoundsIsDirty;
mutable SkBool8 fIsFinite; // only meaningful if bounds are valid
« no previous file with comments | « include/core/SkPath.h ('k') | src/core/SkPath.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698