aboutsummaryrefslogtreecommitdiffhomepage
path: root/gm/textblobrandomfont.cpp
diff options
context:
space:
mode:
authorGravatar brianosman <brianosman@google.com>2016-04-06 07:38:23 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-04-06 07:38:23 -0700
commit898235c4864df66aa7f6d32bc2a8b8551040ce1e (patch)
tree5fb30f04825c59a970a208cabadd4bad0be283b3 /gm/textblobrandomfont.cpp
parent1817d282cda17cb8c2db0ac6fdc937743c026016 (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 'gm/textblobrandomfont.cpp')
-rw-r--r--gm/textblobrandomfont.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/gm/textblobrandomfont.cpp b/gm/textblobrandomfont.cpp
index ce726f2e86..285ba5b923 100644
--- a/gm/textblobrandomfont.cpp
+++ b/gm/textblobrandomfont.cpp
@@ -100,8 +100,12 @@ protected:
canvas->drawColor(sk_tool_utils::color_to_565(SK_ColorWHITE));
- SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight);
- SkSurfaceProps props(0, kUnknown_SkPixelGeometry);
+ SkImageInfo info = SkImageInfo::MakeN32Premul(kWidth, kHeight,
+ canvas->imageInfo().profileType());
+ SkSurfaceProps canvasProps(SkSurfaceProps::kLegacyFontHost_InitType);
+ uint32_t allowSRGBInputs = canvas->getProps(&canvasProps)
+ ? canvasProps.flags() & SkSurfaceProps::kAllowSRGBInputs_Flag : 0;
+ SkSurfaceProps props(allowSRGBInputs, kUnknown_SkPixelGeometry);
auto surface(canvas->makeSurface(info, &props));
if (surface) {
SkPaint paint;