Disable texture strip atlasing for DDL
Ultimately we will want to perform inline and ASAP uploads for the
texture strip atlas. Unfortunately, that functionality relies on the
existance of the flushState (which we don't have for the opList-based
DDL implementation). For now we will punt and try storing the individual
texture strips in their own image-based texture proxy for DDLs.
Change-Id: Ic2ee0deb230172bda4a5d4b69cc802dbe84ad7ac
Reviewed-on: https://skia-review.googlesource.com/102464
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index 3367d9e..871c7ba 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -591,6 +591,7 @@
bitmap->allocPixels(info);
this->initLinearBitmap(bitmap, bitmapType);
+ bitmap->setImmutable();
gCache->add(storage.get(), size, *bitmap);
}
}
@@ -1275,7 +1276,7 @@
GrTextureStripAtlas::Desc desc;
desc.fWidth = bitmap.width();
desc.fHeight = 32;
- desc.fRowHeight = bitmap.height();
+ desc.fRowHeight = bitmap.height(); // always 1 here
desc.fContext = args.fContext;
desc.fConfig = SkImageInfo2GrPixelConfig(bitmap.info(), *args.fContext->caps());
fAtlas = GrTextureStripAtlas::GetAtlas(desc);
@@ -1297,11 +1298,18 @@
// and the proxy is:
// exact fit, power of two in both dimensions
// Only the x-tileMode is unknown. However, given all the other knowns we know
- // that GrMakeCachedBitmapProxy is sufficient (i.e., it won't need to be
+ // that GrMakeCachedImageProxy is sufficient (i.e., it won't need to be
// extracted to a subset or mipmapped).
- sk_sp<GrTextureProxy> proxy = GrMakeCachedBitmapProxy(
+
+ SkASSERT(bitmap.isImmutable());
+ sk_sp<SkImage> srcImage = SkImage::MakeFromBitmap(bitmap);
+ if (!srcImage) {
+ return;
+ }
+
+ sk_sp<GrTextureProxy> proxy = GrMakeCachedImageProxy(
args.fContext->contextPriv().proxyProvider(),
- bitmap);
+ std::move(srcImage));
if (!proxy) {
SkDebugf("Gradient won't draw. Could not create texture.");
return;