aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/image/SkImage_Lazy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/image/SkImage_Lazy.cpp')
-rw-r--r--src/image/SkImage_Lazy.cpp16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/image/SkImage_Lazy.cpp b/src/image/SkImage_Lazy.cpp
index aff19f8d79..14c8e199be 100644
--- a/src/image/SkImage_Lazy.cpp
+++ b/src/image/SkImage_Lazy.cpp
@@ -703,12 +703,16 @@ static void set_key_on_proxy(GrResourceProvider* resourceProvider,
}
sk_sp<SkColorSpace> SkImage_Lazy::getColorSpace(GrContext* ctx, SkColorSpace* dstColorSpace) {
- // TODO: This isn't always correct. Picture generator currently produces textures in N32,
- // and will (soon) emit them in an arbitrary (destination) space. We will need to stash that
- // information in/on the key so we can return the correct space in case #1 of lockTexture.
- CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->caps());
- SkImageInfo cacheInfo = this->buildCacheInfo(format);
- return sk_ref_sp(cacheInfo.colorSpace());
+ if (!dstColorSpace) {
+ // In legacy mode, we do no modification to the image's color space or encoding.
+ // Subsequent legacy drawing is likely to ignore the color space, but some clients
+ // may want to know what space the image data is in, so return it.
+ return fInfo.refColorSpace();
+ } else {
+ CachedFormat format = this->chooseCacheFormat(dstColorSpace, ctx->caps());
+ SkImageInfo cacheInfo = this->buildCacheInfo(format);
+ return cacheInfo.refColorSpace();
+ }
}
/*