diff options
author | 2016-09-23 13:04:05 -0700 | |
---|---|---|
committer | 2016-09-23 13:04:05 -0700 | |
commit | eed6b0e1d865a1f93143c09961debba0aca592ca (patch) | |
tree | 961a464d586a0f11007b8a9a482df912e8c5d305 /src/effects/SkDisplacementMapEffect.cpp | |
parent | 49da334086c4a2c0bc4cb99e97965600dcb72f73 (diff) |
Change SkSpecialImage::makeSurface and makeTightSurface to take output
properties (color space), bounds, and (optional) alphaType.
We were being pretty inconsistent before. Raster was honoring all
components of the info. GPU was using the supplied color type, but
propagating the source's color space. All call sites were saying N32.
What we want to do is propagate the original device's color space, and
pick a good format from that. Rather than force all the clients to
jump through hoops constructing an SkImageInfo that meets our criteria,
just have them supply the few bits we care about, and do everything else
internally.
This also lets us always use RGBA on GPU, but N32 on raster.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2349373004
Committed: https://skia.googlesource.com/skia/+/53c38087949252d27cde668368a3eeb59cc2eb00
Review-Url: https://codereview.chromium.org/2349373004
Diffstat (limited to 'src/effects/SkDisplacementMapEffect.cpp')
-rw-r--r-- | src/effects/SkDisplacementMapEffect.cpp | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/effects/SkDisplacementMapEffect.cpp b/src/effects/SkDisplacementMapEffect.cpp index 8d068072a7..4f6386d92e 100644 --- a/src/effects/SkDisplacementMapEffect.cpp +++ b/src/effects/SkDisplacementMapEffect.cpp @@ -279,7 +279,18 @@ sk_sp<SkSpecialImage> SkDisplacementMapEffect::onFilterImage(SkSpecialImage* sou } SkIPoint displOffset = SkIPoint::Make(0, 0); - sk_sp<SkSpecialImage> displ(this->filterInput(0, source, ctx, &displOffset)); + // Creation of the displacement map should happen in a non-colorspace aware context. This + // texture is a purely mathematical construct, so we want to just operate on the stored + // values. Consider: + // User supplies an sRGB displacement map. If we're rendering to a wider gamut, then we could + // end up filtering the displacement map into that gamut, which has the effect of reducing + // the amount of displacement that it represents (as encoded values move away from the + // primaries). + // With a more complex DAG attached to this input, it's not clear that working in ANY specific + // color space makes sense, so we ignore color spaces (and gamma) entirely. This may not be + // ideal, but it's at least consistent and predictable. + Context displContext(ctx.ctm(), ctx.clipBounds(), ctx.cache(), OutputProperties(nullptr)); + sk_sp<SkSpecialImage> displ(this->filterInput(0, source, displContext, &displOffset)); if (!displ) { return nullptr; } |