Reland "Add back missing unique key checks when creating CachedBitmap/Image Proxies"
This reverts commit 4f57eb8002a0488cfbf08717b25af93fae37a39a.
Reason for revert: Doesn't look to be cause of chrome roll failures
Original change's description:
> Revert "Add back missing unique key checks when creating CachedBitmap/Image Proxies"
>
> This reverts commit b78dd5d01eb16ae3cb9104ce8c0fa7e861431259.
>
> Reason for revert: possibly breaking chrome roll
>
> Original change's description:
> > Add back missing unique key checks when creating CachedBitmap/Image Proxies
> >
> > Its possible that this could fix perf regression in Chrome.
> >
> > Bug: 811452
> > Change-Id: I2d4f7827092b361469586580f0c7c843ab2d5cec
> > Reviewed-on: https://skia-review.googlesource.com/114280
> > Commit-Queue: Greg Daniel <egdaniel@google.com>
> > Reviewed-by: Brian Salomon <bsalomon@google.com>
> > Reviewed-by: Robert Phillips <robertphillips@google.com>
>
> TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
>
> Change-Id: I71646befd07bf28442ac3b9225c021cd141bf398
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Bug: 811452
> Reviewed-on: https://skia-review.googlesource.com/114422
> Reviewed-by: Greg Daniel <egdaniel@google.com>
> Commit-Queue: Greg Daniel <egdaniel@google.com>
TBR=egdaniel@google.com,bsalomon@google.com,robertphillips@google.com
Change-Id: I957d66123bce150387a1ce6a80bcfc06c82d5fa1
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 811452
Reviewed-on: https://skia-review.googlesource.com/114426
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/SkGr.cpp b/src/gpu/SkGr.cpp
index 4701483..195d036 100644
--- a/src/gpu/SkGr.cpp
+++ b/src/gpu/SkGr.cpp
@@ -178,9 +178,11 @@
}
if (const SkBitmap* bm = as_IB(image)->onPeekBitmap()) {
- SkIPoint origin = bm->pixelRefOrigin();
- SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bm->width(), bm->height());
- GrMakeKeyFromImageID(result, bm->getGenerationID(), subset);
+ if (!bm->isVolatile()) {
+ SkIPoint origin = bm->pixelRefOrigin();
+ SkIRect subset = SkIRect::MakeXYWH(origin.fX, origin.fY, bm->width(), bm->height());
+ GrMakeKeyFromImageID(result, bm->getGenerationID(), subset);
+ }
return;
}
@@ -199,10 +201,13 @@
proxy = proxyProvider->findOrCreateProxyByUniqueKey(originalKey, kTopLeft_GrSurfaceOrigin);
}
if (!proxy) {
- proxy = proxyProvider->createTextureProxy(std::move(srcImage), kNone_GrSurfaceFlags, 1,
+ proxy = proxyProvider->createTextureProxy(srcImage, kNone_GrSurfaceFlags, 1,
SkBudgeted::kYes, fit);
if (proxy && originalKey.isValid()) {
proxyProvider->assignUniqueKeyToProxy(originalKey, proxy.get());
+ if (const SkBitmap* bm = as_IB(srcImage.get())->onPeekBitmap()) {
+ GrInstallBitmapUniqueKeyInvalidator(originalKey, bm->pixelRef());
+ }
}
}