From f5dbe2f00f853c6a1719924bdd0c33335a53423a Mon Sep 17 00:00:00 2001 From: "djsollen@google.com" Date: Fri, 15 Apr 2011 13:41:26 +0000 Subject: Upstream android changes. reviewed by: reed git-svn-id: http://skia.googlecode.com/svn/trunk@1134 2bbb7eff-a529-9590-31e7-b0007b416f81 --- src/core/SkPath.cpp | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/core/SkPath.cpp') 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& 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(fFillType, other.fFillType); SkTSwap(fBoundsIsDirty, other.fBoundsIsDirty); SkTSwap(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();) -- cgit v1.2.3