aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPath.cpp
diff options
context:
space:
mode:
authorGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-04-15 13:41:26 +0000
committerGravatar djsollen@google.com <djsollen@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2011-04-15 13:41:26 +0000
commitf5dbe2f00f853c6a1719924bdd0c33335a53423a (patch)
tree4244625eb50b4615a8f9016ee17ae2afb09e57f3 /src/core/SkPath.cpp
parent61eb040e2f18d367c66c0bfc08d2707dc75f7cf2 (diff)
Upstream android changes.
reviewed by: reed git-svn-id: http://skia.googlecode.com/svn/trunk@1134 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPath.cpp')
-rw-r--r--src/core/SkPath.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp
index 6aed6691c7..5ddc31ddad 100644
--- a/src/core/SkPath.cpp
+++ b/src/core/SkPath.cpp
@@ -97,11 +97,18 @@ static void compute_pt_bounds(SkRect* bounds, const SkTDArray<SkPoint>& pts) {
SkPath::SkPath() : fBoundsIsDirty(true), fFillType(kWinding_FillType) {
fIsConvex = false; // really should be kUnknown
+#ifdef ANDROID
+ fGenerationID = 0;
+#endif
}
SkPath::SkPath(const SkPath& src) {
SkDEBUGCODE(src.validate();)
*this = src;
+#ifdef ANDROID
+ // the assignment operator above increments the ID so correct for that here
+ fGenerationID--;
+#endif
}
SkPath::~SkPath() {
@@ -118,6 +125,7 @@ SkPath& SkPath::operator=(const SkPath& src) {
fFillType = src.fFillType;
fBoundsIsDirty = src.fBoundsIsDirty;
fIsConvex = src.fIsConvex;
+ GEN_ID_INC;
}
SkDEBUGCODE(this->validate();)
return *this;
@@ -140,14 +148,22 @@ void SkPath::swap(SkPath& other) {
SkTSwap<uint8_t>(fFillType, other.fFillType);
SkTSwap<uint8_t>(fBoundsIsDirty, other.fBoundsIsDirty);
SkTSwap<uint8_t>(fIsConvex, other.fIsConvex);
+ GEN_ID_INC;
}
}
+#ifdef ANDROID
+uint32_t SkPath::getGenerationID() const {
+ return fGenerationID;
+}
+#endif
+
void SkPath::reset() {
SkDEBUGCODE(this->validate();)
fPts.reset();
fVerbs.reset();
+ GEN_ID_INC;
fBoundsIsDirty = true;
fIsConvex = false; // really should be kUnknown
}
@@ -157,6 +173,7 @@ void SkPath::rewind() {
fPts.rewind();
fVerbs.rewind();
+ GEN_ID_INC;
fBoundsIsDirty = true;
fIsConvex = false; // really should be kUnknown
}
@@ -214,6 +231,7 @@ void SkPath::setLastPt(SkScalar x, SkScalar y) {
this->moveTo(x, y);
} else {
fPts[count - 1].set(x, y);
+ GEN_ID_INC;
}
}
@@ -251,6 +269,7 @@ void SkPath::moveTo(SkScalar x, SkScalar y) {
}
pt->set(x, y);
+ GEN_ID_INC;
fBoundsIsDirty = true;
}
@@ -270,6 +289,7 @@ void SkPath::lineTo(SkScalar x, SkScalar y) {
fPts.append()->set(x, y);
*fVerbs.append() = kLine_Verb;
+ GEN_ID_INC;
fBoundsIsDirty = true;
}
@@ -292,6 +312,7 @@ void SkPath::quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2) {
pts[1].set(x2, y2);
*fVerbs.append() = kQuad_Verb;
+ GEN_ID_INC;
fBoundsIsDirty = true;
}
@@ -315,6 +336,7 @@ void SkPath::cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2,
pts[2].set(x3, y3);
*fVerbs.append() = kCubic_Verb;
+ GEN_ID_INC;
fBoundsIsDirty = true;
}
@@ -336,6 +358,7 @@ void SkPath::close() {
case kQuad_Verb:
case kCubic_Verb:
*fVerbs.append() = kClose_Verb;
+ GEN_ID_INC;
break;
default:
// don't add a close if the prev wasn't a primitive
@@ -953,6 +976,7 @@ void SkPath::transform(const SkMatrix& matrix, SkPath* dst) const {
matrix.mapRect(&dst->fBounds, fBounds);
dst->fBoundsIsDirty = false;
} else {
+ GEN_ID_PTR_INC(dst);
dst->fBoundsIsDirty = true;
}
@@ -1260,6 +1284,7 @@ void SkPath::unflatten(SkFlattenableReadBuffer& buffer) {
buffer.read(fPts.begin(), sizeof(SkPoint) * fPts.count());
buffer.read(fVerbs.begin(), fVerbs.count());
+ GEN_ID_INC;
fBoundsIsDirty = true;
SkDEBUGCODE(this->validate();)