aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/shaders
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-02-01 15:49:54 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-02 18:21:59 +0000
commit7a9263906c677c0fa5636521e3cc58ba60837720 (patch)
tree0eba3834734ec9415fcd703fb40c805003f2989a /src/shaders
parent68c5632d9216c2318aafadc91035a25cb94ca63a (diff)
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>
Diffstat (limited to 'src/shaders')
-rw-r--r--src/shaders/gradients/SkGradientShader.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/shaders/gradients/SkGradientShader.cpp b/src/shaders/gradients/SkGradientShader.cpp
index 3367d9e33b..871c7ba55e 100644
--- a/src/shaders/gradients/SkGradientShader.cpp
+++ b/src/shaders/gradients/SkGradientShader.cpp
@@ -591,6 +591,7 @@ void SkGradientShaderBase::getGradientTableBitmap(SkBitmap* bitmap,
bitmap->allocPixels(info);
this->initLinearBitmap(bitmap, bitmapType);
+ bitmap->setImmutable();
gCache->add(storage.get(), size, *bitmap);
}
}
@@ -1275,7 +1276,7 @@ GrGradientEffect::GrGradientEffect(ClassID classID, const CreateArgs& args, bool
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 @@ GrGradientEffect::GrGradientEffect(ClassID classID, const CreateArgs& args, bool
// 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;