Merge "Fix a resource race bug in PathCache"

This commit is contained in:
Chris Craik
2014-05-30 17:56:42 +00:00
committed by Gerrit Code Review
2 changed files with 5 additions and 4 deletions

View File

@ -346,7 +346,7 @@ void PathCache::PathProcessor::onProcess(const sp<Task<SkBitmap*> >& task) {
float left, top, offset; float left, top, offset;
uint32_t width, height; 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; PathTexture* texture = t->texture;
texture->left = left; texture->left = left;
@ -357,7 +357,7 @@ void PathCache::PathProcessor::onProcess(const sp<Task<SkBitmap*> >& task) {
if (width <= mMaxTextureSize && height <= mMaxTextureSize) { if (width <= mMaxTextureSize && height <= mMaxTextureSize) {
SkBitmap* bitmap = new SkBitmap(); 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); t->setResult(bitmap);
} else { } else {
texture->width = 0; texture->width = 0;

View File

@ -293,7 +293,7 @@ private:
class PathTask: public Task<SkBitmap*> { class PathTask: public Task<SkBitmap*> {
public: public:
PathTask(SkPath* path, SkPaint* paint, PathTexture* texture): PathTask(SkPath* path, SkPaint* paint, PathTexture* texture):
path(path), paint(paint), texture(texture) { path(path), paint(*paint), texture(texture) {
} }
~PathTask() { ~PathTask() {
@ -301,7 +301,8 @@ private:
} }
SkPath* path; SkPath* path;
SkPaint* paint; //copied, since input paint may not be immutable
SkPaint paint;
PathTexture* texture; PathTexture* texture;
}; };