diff options
author | 2016-04-06 07:38:23 -0700 | |
---|---|---|
committer | 2016-04-06 07:38:23 -0700 | |
commit | 898235c4864df66aa7f6d32bc2a8b8551040ce1e (patch) | |
tree | 5fb30f04825c59a970a208cabadd4bad0be283b3 /dm | |
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 'dm')
-rw-r--r-- | dm/DM.cpp | 7 | ||||
-rw-r--r-- | dm/DMGpuSupport.h | 3 |
2 files changed, 6 insertions, 4 deletions
@@ -822,8 +822,8 @@ static Sink* create_sink(const SkCommandLineConfig* config) { contextOptions = static_cast<GrContextFactory::ContextOptions>( contextOptions | GrContextFactory::kEnableNVPR_ContextOptions); } - if (kSRGB_SkColorProfileType == gpuConfig->getProfileType() || - kRGBA_F16_SkColorType == gpuConfig->getColorType()) { + if (SkColorAndProfileAreGammaCorrect(gpuConfig->getColorType(), + gpuConfig->getProfileType())) { contextOptions = static_cast<GrContextFactory::ContextOptions>( contextOptions | GrContextFactory::kRequireSRGBSupport_ContextOptions); } @@ -1169,8 +1169,7 @@ struct Task { const SkBitmap* bitmap) { bool gammaCorrect = false; if (bitmap) { - gammaCorrect = bitmap->profileType() == kSRGB_SkColorProfileType - || bitmap-> colorType() == kRGBA_F16_SkColorType; + gammaCorrect = SkImageInfoIsGammaCorrect(bitmap->info()); } JsonWriter::BitmapResult result; diff --git a/dm/DMGpuSupport.h b/dm/DMGpuSupport.h index 2352f83ae4..42c5eb30ae 100644 --- a/dm/DMGpuSupport.h +++ b/dm/DMGpuSupport.h @@ -36,6 +36,9 @@ static inline sk_sp<SkSurface> NewGpuSurface( int samples, bool useDIText) { uint32_t flags = useDIText ? SkSurfaceProps::kUseDeviceIndependentFonts_Flag : 0; + if (SkImageInfoIsGammaCorrect(info)) { + flags |= SkSurfaceProps::kAllowSRGBInputs_Flag; + } SkSurfaceProps props(flags, SkSurfaceProps::kLegacyFontHost_InitType); return SkSurface::MakeRenderTarget(grFactory->get(type, options), SkBudgeted::kNo, info, samples, &props); |