diff options
author | Romain Guy <romainguy@google.com> | 2011-03-18 16:24:19 -0700 |
---|---|---|
committer | Romain Guy <romainguy@google.com> | 2011-03-18 16:24:19 -0700 |
commit | b29cfbf768eab959b31410aafc0a99e20249e9d7 (patch) | |
tree | 4032e18bfa7346a0338609f1cf665523a2cd68ce | |
parent | 40667676e542a9daeafeac9904c30004e8706fd3 (diff) | |
download | frameworks_base-b29cfbf768eab959b31410aafc0a99e20249e9d7.zip frameworks_base-b29cfbf768eab959b31410aafc0a99e20249e9d7.tar.gz frameworks_base-b29cfbf768eab959b31410aafc0a99e20249e9d7.tar.bz2 |
Fix paths rendering issues.
See ApiDemos, PathEffect and PathFillTypes.
Change-Id: I9f9593c1da33d0d013b5b89c86bc5bd71128a192
-rw-r--r-- | libs/hwui/DisplayListRenderer.cpp | 17 | ||||
-rw-r--r-- | libs/hwui/DisplayListRenderer.h | 17 | ||||
-rw-r--r-- | libs/hwui/PathCache.h | 4 | ||||
-rw-r--r-- | libs/hwui/ShapeCache.h | 9 |
4 files changed, 10 insertions, 37 deletions
diff --git a/libs/hwui/DisplayListRenderer.cpp b/libs/hwui/DisplayListRenderer.cpp index 868290b..f2f983f 100644 --- a/libs/hwui/DisplayListRenderer.cpp +++ b/libs/hwui/DisplayListRenderer.cpp @@ -95,10 +95,6 @@ void DisplayList::clearResources() { delete mPaths.itemAt(i); } mPaths.clear(); - for (size_t i = 0; i < mOriginalPaths.size(); i++) { - caches.resourceCache.decrementRefcount(mOriginalPaths.itemAt(i)); - } - mOriginalPaths.clear(); for (size_t i = 0; i < mMatrices.size(); i++) { delete mMatrices.itemAt(i); @@ -150,13 +146,6 @@ void DisplayList::initFromDisplayListRenderer(const DisplayListRenderer& recorde mPaths.add(paths.itemAt(i)); } - const Vector<SkPath*> &originalPaths = recorder.getOriginalPaths(); - for (size_t i = 0; i < originalPaths.size(); i++) { - SkPath* path = originalPaths.itemAt(i); - mOriginalPaths.add(path); - caches.resourceCache.incrementRefcount(path); - } - const Vector<SkMatrix*> &matrices = recorder.getMatrices(); for (size_t i = 0; i < matrices.size(); i++) { mMatrices.add(matrices.itemAt(i)); @@ -533,12 +522,6 @@ void DisplayListRenderer::reset() { } mBitmapResources.clear(); - for (size_t i = 0; i < mOriginalPaths.size(); i++) { - SkPath* resource = mOriginalPaths.itemAt(i); - caches.resourceCache.decrementRefcount(resource); - } - mOriginalPaths.clear(); - for (size_t i = 0; i < mShaders.size(); i++) { caches.resourceCache.decrementRefcount(mShaders.itemAt(i)); } diff --git a/libs/hwui/DisplayListRenderer.h b/libs/hwui/DisplayListRenderer.h index 6fc315c..8773cb5 100644 --- a/libs/hwui/DisplayListRenderer.h +++ b/libs/hwui/DisplayListRenderer.h @@ -193,7 +193,6 @@ private: Vector<SkPaint*> mPaints; Vector<SkPath*> mPaths; - Vector<SkPath*> mOriginalPaths; Vector<SkMatrix*> mMatrices; Vector<SkiaShader*> mShaders; @@ -298,10 +297,6 @@ public: return mPaths; } - const Vector<SkPath*>& getOriginalPaths() const { - return mOriginalPaths; - } - const Vector<SkMatrix*>& getMatrices() const { return mMatrices; } @@ -383,16 +378,9 @@ private: SkPath* pathCopy = mPathMap.valueFor(path); if (pathCopy == NULL || pathCopy->getGenerationID() != path->getGenerationID()) { - if (pathCopy == NULL) { - pathCopy = path; - mOriginalPaths.add(path); - Caches& caches = Caches::getInstance(); - caches.resourceCache.incrementRefcount(path); - } else { - pathCopy = new SkPath(*path); - mPaths.add(pathCopy); - } + pathCopy = new SkPath(*path); mPathMap.add(path, pathCopy); + mPaths.add(pathCopy); } addInt((int) pathCopy); @@ -469,7 +457,6 @@ private: Vector<SkPaint*> mPaints; DefaultKeyedVector<SkPaint*, SkPaint*> mPaintMap; - Vector<SkPath*> mOriginalPaths; Vector<SkPath*> mPaths; DefaultKeyedVector<SkPath*, SkPath*> mPathMap; diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h index dc67e16..7ff8b74 100644 --- a/libs/hwui/PathCache.h +++ b/libs/hwui/PathCache.h @@ -41,8 +41,7 @@ struct PathCacheEntry: public ShapeCacheEntry { path = NULL; } - PathCacheEntry(const PathCacheEntry& entry): - ShapeCacheEntry(entry) { + PathCacheEntry(const PathCacheEntry& entry): ShapeCacheEntry(entry) { path = entry.path; } @@ -55,6 +54,7 @@ struct PathCacheEntry: public ShapeCacheEntry { } SkPath* path; + }; // PathCacheEntry /** diff --git a/libs/hwui/ShapeCache.h b/libs/hwui/ShapeCache.h index 4c626dd..859e503 100644 --- a/libs/hwui/ShapeCache.h +++ b/libs/hwui/ShapeCache.h @@ -96,7 +96,7 @@ struct ShapeCacheEntry { ShapeCacheEntry(const ShapeCacheEntry& entry): shapeType(entry.shapeType), join(entry.join), cap(entry.cap), style(entry.style), miter(entry.miter), - strokeWidth(entry.strokeWidth) { + strokeWidth(entry.strokeWidth), pathEffect(entry.pathEffect) { } ShapeCacheEntry(ShapeType type, SkPaint* paint) { @@ -108,18 +108,19 @@ struct ShapeCacheEntry { v = paint->getStrokeWidth(); strokeWidth = *(uint32_t*) &v; style = paint->getStyle(); + pathEffect = paint->getPathEffect(); } virtual ~ShapeCacheEntry() { } - // shapeType must be checked in subclasses operator< ShapeType shapeType; SkPaint::Join join; SkPaint::Cap cap; SkPaint::Style style; uint32_t miter; uint32_t strokeWidth; + SkPathEffect* pathEffect; bool operator<(const ShapeCacheEntry& rhs) const { LTE_INT(shapeType) { @@ -128,7 +129,9 @@ struct ShapeCacheEntry { LTE_INT(style) { LTE_INT(miter) { LTE_INT(strokeWidth) { - return lessThan(rhs); + LTE_INT(pathEffect) { + return lessThan(rhs); + } } } } |