diff options
author | brianosman <brianosman@google.com> | 2016-04-06 07:38:23 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-06 07:38:23 -0700 |
commit | 898235c4864df66aa7f6d32bc2a8b8551040ce1e (patch) | |
tree | 5fb30f04825c59a970a208cabadd4bad0be283b3 /src/core/SkImageFilter.cpp | |
parent | 1817d282cda17cb8c2db0ac6fdc937743c026016 (diff) |
SkSurfaceProps now has a gamma-correct ("AllowSRGBInputs") flag. That's propagated in a few places so that the backend can do the right thing for L32 vs S32 mode.
Also added SkSurfaceProps to SkSpecialImage, so that Image -> Surface conversion can preserve the desired behavior during filtering.
Many small changes, including a bunch of comments about places where we may be losing information right now. My approach was to ensure that if anything fails, it will always fall back to "legacy" mode - gamma-correctness is opt-in, so I'll just have to feed things through as missing cases are exposed.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1838953007
Review URL: https://codereview.chromium.org/1845283003
Diffstat (limited to 'src/core/SkImageFilter.cpp')
-rw-r--r-- | src/core/SkImageFilter.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp index 0e0df3625f..743dc2ad1a 100644 --- a/src/core/SkImageFilter.cpp +++ b/src/core/SkImageFilter.cpp @@ -295,7 +295,8 @@ bool SkImageFilter::filterInputDeprecated(int index, Proxy* proxy, const SkBitma return true; } - sk_sp<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src)); + // SRGBTODO: Don't handle sRGB here, in anticipation of this code path being deleted. + sk_sp<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src, nullptr)); if (!specialSrc) { return false; } @@ -377,7 +378,7 @@ sk_sp<SkSpecialImage> SkImageFilter::onFilterImage(SkSpecialImage* src, const Co return nullptr; } - return SkSpecialImage::internal_fromBM(src->internal_getProxy(), resultBM); + return SkSpecialImage::internal_fromBM(src->internal_getProxy(), resultBM, &src->props()); } bool SkImageFilter::canFilterImageGPU() const { @@ -418,6 +419,7 @@ bool SkImageFilter::filterImageGPUDeprecated(Proxy* proxy, const SkBitmap& src, SkMatrix matrix(ctx.ctm()); matrix.postTranslate(SkIntToScalar(-bounds.left()), SkIntToScalar(-bounds.top())); GrPaint paint; + // SRGBTODO: Don't handle sRGB here, in anticipation of this code path being deleted. if (this->asFragmentProcessor(&fp, srcTexture, matrix, bounds)) { SkASSERT(fp); paint.addColorFragmentProcessor(fp)->unref(); @@ -620,7 +622,8 @@ bool SkImageFilter::filterInputGPUDeprecated(int index, SkImageFilter::Proxy* pr return true; } - sk_sp<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src)); + // SRGBTODO: Don't handle sRGB here, in anticipation of this code path being deleted. + sk_sp<SkSpecialImage> specialSrc(SkSpecialImage::internal_fromBM(proxy, src, nullptr)); if (!specialSrc) { return false; } |