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>
This commit is contained in:
Greg Daniel 2018-03-14 09:35:50 -04:00 committed by Skia Commit-Bot
parent 0bf59e4597
commit b78dd5d01e

View File

@ -178,9 +178,11 @@ static void create_unique_key_for_image(const SkImage* image, GrUniqueKey* resul
}
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 @@ sk_sp<GrTextureProxy> GrMakeCachedImageProxy(GrProxyProvider* proxyProvider,
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());
}
}
}