diff options
author | Chris Craik <ccraik@android.com> | 2014-05-30 17:56:42 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-05-30 17:56:42 +0000 |
commit | ce7fa780cdee2730b570cc34066f15c74d44e6ef (patch) | |
tree | 08eab165fd3354563bc89af25a18292ec888f0cd | |
parent | bd4d320344833ce67dad3a4e10a61d0502a81d0e (diff) | |
parent | 7061f7d7910fdf1189ea7bf1398f6cf8b9bd0104 (diff) | |
download | base-ce7fa780cdee2730b570cc34066f15c74d44e6ef.tar.gz |
Merge "Fix a resource race bug in PathCache"
-rw-r--r-- | libs/hwui/PathCache.cpp | 4 | ||||
-rw-r--r-- | libs/hwui/PathCache.h | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/libs/hwui/PathCache.cpp b/libs/hwui/PathCache.cpp index cf8adf8772f3..0794aecaceb6 100644 --- a/libs/hwui/PathCache.cpp +++ b/libs/hwui/PathCache.cpp @@ -346,7 +346,7 @@ void PathCache::PathProcessor::onProcess(const sp<Task<SkBitmap*> >& task) { float left, top, offset; uint32_t width, height; - PathCache::computePathBounds(t->path, t->paint, left, top, offset, width, height); + PathCache::computePathBounds(t->path, &t->paint, left, top, offset, width, height); PathTexture* texture = t->texture; texture->left = left; @@ -357,7 +357,7 @@ void PathCache::PathProcessor::onProcess(const sp<Task<SkBitmap*> >& task) { if (width <= mMaxTextureSize && height <= mMaxTextureSize) { SkBitmap* bitmap = new SkBitmap(); - drawPath(t->path, t->paint, *bitmap, left, top, offset, width, height); + drawPath(t->path, &t->paint, *bitmap, left, top, offset, width, height); t->setResult(bitmap); } else { texture->width = 0; diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h index 16d20a81c199..24f88f1d0535 100644 --- a/libs/hwui/PathCache.h +++ b/libs/hwui/PathCache.h @@ -293,7 +293,7 @@ private: class PathTask: public Task<SkBitmap*> { public: PathTask(SkPath* path, SkPaint* paint, PathTexture* texture): - path(path), paint(paint), texture(texture) { + path(path), paint(*paint), texture(texture) { } ~PathTask() { @@ -301,7 +301,8 @@ private: } SkPath* path; - SkPaint* paint; + //copied, since input paint may not be immutable + SkPaint paint; PathTexture* texture; }; |