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

Unified Diff: src/image/SkImage_Raster.cpp

Issue 791473006: fix images in multi-thread by doing shallow-copies (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 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 | « src/core/SkMultiPictureDraw.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/image/SkImage_Raster.cpp
diff --git a/src/image/SkImage_Raster.cpp b/src/image/SkImage_Raster.cpp
index 24b971ad8491be40a909106a70895a138598c2b0..a06cca6e9bb4e86ce0b4b5a2b15414e000be3da8 100644
--- a/src/image/SkImage_Raster.cpp
+++ b/src/image/SkImage_Raster.cpp
@@ -131,12 +131,14 @@ SkShader* SkImage_Raster::onNewShader(SkShader::TileMode tileX, SkShader::TileMo
}
void SkImage_Raster::onDraw(SkCanvas* canvas, SkScalar x, SkScalar y, const SkPaint* paint) const {
- canvas->drawBitmap(fBitmap, x, y, paint);
+ SkBitmap shallowCopy(fBitmap);
+ canvas->drawBitmap(shallowCopy, x, y, paint);
}
void SkImage_Raster::onDrawRect(SkCanvas* canvas, const SkRect* src, const SkRect& dst,
const SkPaint* paint) const {
- canvas->drawBitmapRectToRect(fBitmap, src, dst, paint);
+ SkBitmap shallowCopy(fBitmap);
+ canvas->drawBitmapRectToRect(shallowCopy, src, dst, paint);
}
SkSurface* SkImage_Raster::onNewSurface(const SkImageInfo& info, const SkSurfaceProps& props) const {
@@ -145,7 +147,8 @@ SkSurface* SkImage_Raster::onNewSurface(const SkImageInfo& info, const SkSurface
bool SkImage_Raster::onReadPixels(const SkImageInfo& dstInfo, void* dstPixels, size_t dstRowBytes,
int srcX, int srcY) const {
- return fBitmap.readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY);
+ SkBitmap shallowCopy(fBitmap);
+ return shallowCopy.readPixels(dstInfo, dstPixels, dstRowBytes, srcX, srcY);
}
const void* SkImage_Raster::onPeekPixels(SkImageInfo* infoPtr, size_t* rowBytesPtr) const {
« no previous file with comments | « src/core/SkMultiPictureDraw.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698