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

Unified Diff: include/core/SkPathRef.h

Issue 115323004: Improved SkPathRef interface security (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Fix private pathref test pattern Created 7 years 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/SkPathRef.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 12667)
+++ include/core/SkPathRef.h (working copy)
@@ -49,7 +49,8 @@
/**
* Returns the array of points.
*/
- SkPoint* points() { return fPathRef->fPoints; }
+ SkPoint* points() { return fPathRef->getPoints(); }
+ const SkPoint* points() const { return fPathRef->points(); }
/**
* Gets the ith point. Shortcut for this->points() + i
@@ -58,6 +59,10 @@
SkASSERT((unsigned) i < (unsigned) fPathRef->fPointCnt);
return this->points() + i;
};
+ const SkPoint* atPoint(int i) const {
+ SkASSERT((unsigned) i < (unsigned) fPathRef->fPointCnt);
+ return this->points() + i;
+ };
/**
* Adds the verb and allocates space for the number of points indicated by the verb. The
@@ -89,6 +94,7 @@
void resetToSize(int newVerbCnt, int newPointCnt, int newConicCount) {
fPathRef->resetToSize(newVerbCnt, newPointCnt, newConicCount);
}
+
/**
* Gets the path ref that is wrapped in the Editor.
*/
@@ -96,6 +102,8 @@
void setIsOval(bool isOval) { fPathRef->setIsOval(isOval); }
+ void setBounds(const SkRect& rect) { fPathRef->setBounds(rect); }
+
private:
SkPathRef* fPathRef;
};
@@ -158,13 +166,6 @@
return fBounds;
}
- void setBounds(const SkRect& rect) {
- SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom);
- fBounds = rect;
- fBoundsIsDirty = false;
- fIsFinite = fBounds.isFinite();
- }
-
/**
* Transforms a path ref by a matrix, allocating a new one only if necessary.
*/
@@ -299,6 +300,13 @@
fBoundsIsDirty = false;
}
+ void setBounds(const SkRect& rect) {
+ SkASSERT(rect.fLeft <= rect.fRight && rect.fTop <= rect.fBottom);
+ fBounds = rect;
+ fBoundsIsDirty = false;
+ fIsFinite = fBounds.isFinite();
+ }
+
/** Makes additional room but does not change the counts or change the genID */
void incReserve(int additionalVerbs, int additionalPoints) {
SkDEBUGCODE(this->validate();)
@@ -418,6 +426,12 @@
void setIsOval(bool isOval) { fIsOval = isOval; }
+ SkPoint* getPoints() {
+ SkDEBUGCODE(this->validate();)
+ fIsOval = false;
+ return fPoints;
+ }
+
enum {
kMinSize = 256,
};
@@ -441,6 +455,7 @@
mutable uint32_t fGenerationID;
SkDEBUGCODE(int32_t fEditorsAttached;) // assert that only one editor in use at any time.
+ friend class PathRefTest_Private;
typedef SkRefCnt INHERITED;
};
« no previous file with comments | « include/core/SkPath.h ('k') | src/core/SkPathRef.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698