From 898235c4864df66aa7f6d32bc2a8b8551040ce1e Mon Sep 17 00:00:00 2001 From: brianosman Date: Wed, 6 Apr 2016 07:38:23 -0700 Subject: 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 --- gm/textblobmixedsizes.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'gm/textblobmixedsizes.cpp') diff --git a/gm/textblobmixedsizes.cpp b/gm/textblobmixedsizes.cpp index 82a0dbbd2a..6041e521fd 100644 --- a/gm/textblobmixedsizes.cpp +++ b/gm/textblobmixedsizes.cpp @@ -103,8 +103,12 @@ protected: #if SK_SUPPORT_GPU // Create a new Canvas to enable DFT GrContext* ctx = inputCanvas->getGrContext(); - SkImageInfo info = SkImageInfo::MakeN32Premul(onISize()); - SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag, + SkImageInfo info = SkImageInfo::MakeN32Premul(onISize(), + inputCanvas->imageInfo().profileType()); + SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType); + uint32_t allowSRGBInputs = inputCanvas->getProps(&canvasProps) + ? canvasProps.flags() & SkSurfaceProps::kAllowSRGBInputs_Flag : 0; + SkSurfaceProps props(SkSurfaceProps::kUseDeviceIndependentFonts_Flag | allowSRGBInputs, SkSurfaceProps::kLegacyFontHost_InitType); surface = SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props); canvas = surface.get() ? surface->getCanvas() : inputCanvas; -- cgit v1.2.3