Plumb dst color space in many places, rather than "mode"
This is less to type in most cases, and gives us more information
(for things like picture-backed images, where we need to know all
about the destination surface).
Additionally, strip out the plumbing entirely for bitmap sources,
where we don't need to know anything.
BUG=skia:
Change-Id: I4deff6c7c345fcf62eb08b2aff0560adae4313da
Reviewed-on: https://skia-review.googlesource.com/5748
Reviewed-by: Mike Klein <mtklein@chromium.org>
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/src/core/SkSpecialImage.cpp b/src/core/SkSpecialImage.cpp
index fefe5c2..2567bf1 100644
--- a/src/core/SkSpecialImage.cpp
+++ b/src/core/SkSpecialImage.cpp
@@ -102,8 +102,7 @@
}
sk_sp<GrTexture> resultTex(
- GrRefCachedBitmapTexture(context, bmp, GrSamplerParams::ClampNoFilter(),
- SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
+ GrRefCachedBitmapTexture(context, bmp, GrSamplerParams::ClampNoFilter()));
if (!resultTex) {
return nullptr;
}
@@ -181,7 +180,7 @@
sk_sp<SkSpecialImage> SkSpecialImage::MakeFromImage(const SkIRect& subset,
sk_sp<SkImage> image,
- SkDestinationSurfaceColorMode colorMode,
+ SkColorSpace* dstColorSpace,
const SkSurfaceProps* props) {
SkASSERT(rect_fits(subset, image->width(), image->height()));
@@ -193,7 +192,7 @@
#endif
{
SkBitmap bm;
- if (as_IB(image)->getROPixels(&bm, colorMode)) {
+ if (as_IB(image)->getROPixels(&bm, dstColorSpace)) {
return MakeFromRaster(subset, bm, props);
}
}
@@ -242,8 +241,7 @@
sk_sp<GrTexture> onAsTextureRef(GrContext* context) const override {
if (context) {
return sk_ref_sp(
- GrRefCachedBitmapTexture(context, fBitmap, GrSamplerParams::ClampNoFilter(),
- SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware));
+ GrRefCachedBitmapTexture(context, fBitmap, GrSamplerParams::ClampNoFilter()));
}
return nullptr;
@@ -252,10 +250,7 @@
sk_sp<GrTextureProxy> onAsTextureProxy(GrContext* context) const override {
if (context) {
sk_sp<GrTexture> tex(sk_ref_sp(GrRefCachedBitmapTexture(
- context,
- fBitmap,
- GrSamplerParams::ClampNoFilter(),
- SkDestinationSurfaceColorMode::kGammaAndColorSpaceAware)));
+ context, fBitmap, GrSamplerParams::ClampNoFilter())));
sk_sp<GrSurfaceProxy> sProxy = GrSurfaceProxy::MakeWrapped(std::move(tex));
return sk_ref_sp(sProxy->asTextureProxy());
}