aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/dftext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'gm/dftext.cpp')
-rw-r--r--gm/dftext.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/gm/dftext.cpp b/gm/dftext.cpp
index 0d5b1ff4e9..c66064a8d4 100644
--- a/gm/dftext.cpp
+++ b/gm/dftext.cpp
@@ -48,8 +48,12 @@ protected:
// set up offscreen rendering with distance field text
#if SK_SUPPORT_GPU
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);
auto surface(SkSurface::MakeRenderTarget(ctx, SkBudgeted::kNo, info, 0, &props));
SkCanvas* canvas = surface ? surface->getCanvas() : inputCanvas;