diff options
author | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-06-03 02:35:01 +0000 |
---|---|---|
committer | reed@android.com <reed@android.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2009-06-03 02:35:01 +0000 |
commit | 6b82d1adc6a4726e36674e468ff1157e0b75373f (patch) | |
tree | b54346ec55abc1e2ed1986883ea5e6931287a6ba /src/core | |
parent | 4a7fd2bd275446ecad0e70aff2b9fd31d2bc8e95 (diff) |
add isConvex() hit to SkPath, to be used to speed up fills and opengl
set linewidth in gldevice for hair rects
remove some cruft from samples
add more gl-unimpl messages
git-svn-id: http://skia.googlecode.com/svn/trunk@199 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkMemory_stdlib.cpp | 6 | ||||
-rw-r--r-- | src/core/SkPath.cpp | 22 |
2 files changed, 16 insertions, 12 deletions
diff --git a/src/core/SkMemory_stdlib.cpp b/src/core/SkMemory_stdlib.cpp index f1ac36beb0..6952ae89b1 100644 --- a/src/core/SkMemory_stdlib.cpp +++ b/src/core/SkMemory_stdlib.cpp @@ -156,17 +156,11 @@ private: } }; -void Dump() -{ - SkBlockHeader::Dump(); -} - void ValidateHeap() { SkBlockHeader::Validate(); } #else -void Dump() {} void ValidateHeap() {} #endif diff --git a/src/core/SkPath.cpp b/src/core/SkPath.cpp index 0cb50fb551..2127bb4581 100644 --- a/src/core/SkPath.cpp +++ b/src/core/SkPath.cpp @@ -28,6 +28,9 @@ It captures some state about the path up front (i.e. if it already has a cached bounds), and the if it can, it updates the cache bounds explicitly, avoiding the need to revisit all of the points in getBounds(). + + It also notes if the path was originally empty, and if so, sets isConvex + to true. Thus it can only be used if the contour being added is convex. */ class SkAutoPathBoundsUpdate { public: @@ -42,6 +45,7 @@ public: } ~SkAutoPathBoundsUpdate() { + fPath->setIsConvex(fEmpty); if (fEmpty) { fPath->fBounds = fRect; fPath->fBoundsIsDirty = false; @@ -52,13 +56,13 @@ public: } private: - const SkPath* fPath; - SkRect fRect; - bool fDirty; - bool fEmpty; + SkPath* fPath; + SkRect fRect; + bool fDirty; + bool fEmpty; // returns true if we should proceed - void init(const SkPath* path) { + void init(SkPath* path) { fPath = path; fDirty = path->fBoundsIsDirty; fEmpty = path->isEmpty(); @@ -91,7 +95,9 @@ static void compute_pt_bounds(SkRect* bounds, const SkTDArray<SkPoint>& pts) { //////////////////////////////////////////////////////////////////////////// -SkPath::SkPath() : fBoundsIsDirty(true), fFillType(kWinding_FillType) {} +SkPath::SkPath() : fBoundsIsDirty(true), fFillType(kWinding_FillType) { + fIsConvex = false; +} SkPath::SkPath(const SkPath& src) { SkDEBUGCODE(src.validate();) @@ -111,12 +117,15 @@ SkPath& SkPath::operator=(const SkPath& src) { fVerbs = src.fVerbs; fFillType = src.fFillType; fBoundsIsDirty = src.fBoundsIsDirty; + fIsConvex = src.fIsConvex; } SkDEBUGCODE(this->validate();) return *this; } bool operator==(const SkPath& a, const SkPath& b) { + // note: don't need to look at isConvex or bounds, since just comparing the + // raw data is sufficient. return &a == &b || (a.fFillType == b.fFillType && a.fVerbs == b.fVerbs && a.fPts == b.fPts); } @@ -130,6 +139,7 @@ void SkPath::swap(SkPath& other) { fVerbs.swap(other.fVerbs); SkTSwap<uint8_t>(fFillType, other.fFillType); SkTSwap<uint8_t>(fBoundsIsDirty, other.fBoundsIsDirty); + SkTSwap<uint8_t>(fIsConvex, other.fIsConvex); } } |