diff options
author | Robert Phillips <robertphillips@google.com> | 2018-03-20 16:23:08 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-03-20 21:08:57 +0000 |
commit | 5c4b33bce10be894fd4a99e99663efb867b5e000 (patch) | |
tree | 2314b35a934999fccbd4b949689cb67ea6eae371 /src/gpu/SkGr.cpp | |
parent | 7e86547842e6c5d04d3e0e9b1a644679fd0f9099 (diff) |
Don't add change listeners to pixelRefs in DDL mode
Change-Id: I1ddfec1e0d697dd4ed183c304514b14c89aca11d
Reviewed-on: https://skia-review.googlesource.com/115400
Reviewed-by: Greg Daniel <egdaniel@google.com>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'src/gpu/SkGr.cpp')
-rw-r--r-- | src/gpu/SkGr.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp index 195d036374..27c9b39f5e 100644 --- a/src/gpu/SkGr.cpp +++ b/src/gpu/SkGr.cpp @@ -84,8 +84,8 @@ sk_sp<GrTextureProxy> GrUploadBitmapToTextureProxy(GrProxyProvider* proxyProvide // In non-ddl we will always instantiate right away. Thus we never want to copy the SkBitmap // even if it's mutable. In ddl, if the bitmap is mutable then we must make a copy since the // upload of the data to the gpu can happen at anytime and the bitmap may change by then. - SkCopyPixelsMode cpyMode = proxyProvider->mutableBitmapsNeedCopy() ? kIfMutable_SkCopyPixelsMode - : kNever_SkCopyPixelsMode; + SkCopyPixelsMode cpyMode = proxyProvider->recordingDDL() ? kIfMutable_SkCopyPixelsMode + : kNever_SkCopyPixelsMode; sk_sp<SkImage> image = SkMakeImageFromRasterBitmap(bitmap, cpyMode); return proxyProvider->createTextureProxy(std::move(image), kNone_GrSurfaceFlags, 1, @@ -160,8 +160,8 @@ sk_sp<GrTextureProxy> GrMakeCachedBitmapProxy(GrProxyProvider* proxyProvider, // In non-ddl we will always instantiate right away. Thus we never want to copy the SkBitmap // even if its mutable. In ddl, if the bitmap is mutable then we must make a copy since the // upload of the data to the gpu can happen at anytime and the bitmap may change by then. - SkCopyPixelsMode cpyMode = proxyProvider->mutableBitmapsNeedCopy() ? kIfMutable_SkCopyPixelsMode - : kNever_SkCopyPixelsMode; + SkCopyPixelsMode cpyMode = proxyProvider->recordingDDL() ? kIfMutable_SkCopyPixelsMode + : kNever_SkCopyPixelsMode; sk_sp<SkImage> image = SkMakeImageFromRasterBitmap(bitmap, cpyMode); if (!image) { @@ -205,7 +205,10 @@ sk_sp<GrTextureProxy> GrMakeCachedImageProxy(GrProxyProvider* proxyProvider, SkBudgeted::kYes, fit); if (proxy && originalKey.isValid()) { proxyProvider->assignUniqueKeyToProxy(originalKey, proxy.get()); - if (const SkBitmap* bm = as_IB(srcImage.get())->onPeekBitmap()) { + const SkBitmap* bm = as_IB(srcImage.get())->onPeekBitmap(); + // When recording DDLs we do not want to install change listeners because doing + // so isn't threadsafe. + if (bm && !proxyProvider->recordingDDL()) { GrInstallBitmapUniqueKeyInvalidator(originalKey, bm->pixelRef()); } } |