diff options
author | 2016-12-02 12:10:36 -0500 | |
---|---|---|
committer | 2016-12-07 18:28:34 +0000 | |
commit | fc2e7e057d6ae49ba935c2580197bd8f9f316eec (patch) | |
tree | 03a7c203c2ea5848bcb07d45aa066265c2d70afe /samplecode | |
parent | 851c2386bad44fb6c453744d970237e681e693f0 (diff) |
Add NarrowRGB gamut mode to SampleApp
Helpful for reproducing DM failures from this config, and
comparing the results of out-of-gamut colors between gpu
and raster.
BUG=skia:
Change-Id: I6f091ea47c40ac594bc9e1254bbdd01ac13796d2
Reviewed-on: https://skia-review.googlesource.com/5510
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
Diffstat (limited to 'samplecode')
-rw-r--r-- | samplecode/SampleApp.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/samplecode/SampleApp.cpp b/samplecode/SampleApp.cpp index b9f3cb4712..776844ca76 100644 --- a/samplecode/SampleApp.cpp +++ b/samplecode/SampleApp.cpp @@ -59,6 +59,7 @@ class GrContext; enum OutputColorSpace { kLegacy_OutputColorSpace, kSRGB_OutputColorSpace, + kNarrow_OutputColorSpace, kMonitor_OutputColorSpace, }; @@ -70,6 +71,7 @@ const struct { { kN32_SkColorType, kLegacy_OutputColorSpace, "L32" }, { kN32_SkColorType, kSRGB_OutputColorSpace, "S32" }, { kRGBA_F16_SkColorType, kSRGB_OutputColorSpace, "F16" }, + { kRGBA_F16_SkColorType, kNarrow_OutputColorSpace, "F16 Narrow" }, { kRGBA_F16_SkColorType, kMonitor_OutputColorSpace, "F16 Device" }, }; @@ -327,7 +329,8 @@ public: fActualColorBits > 24) { // We made/have an off-screen surface. Get the contents as an SkImage: SkImageInfo offscreenInfo = win->info(); - if (kMonitor_OutputColorSpace == gConfig[win->getColorConfigIndex()].fColorSpace) { + if (kMonitor_OutputColorSpace == gConfig[win->getColorConfigIndex()].fColorSpace || + kNarrow_OutputColorSpace == gConfig[win->getColorConfigIndex()].fColorSpace) { // This is a big hack. We want our final output to be color "correct". If we snap // an image in the gamut of the monitor, and then render to FBO0 (which we've tagged // as sRGB), then we end up doing round-trip gamut conversion, and still seeing the @@ -909,6 +912,7 @@ SampleWindow::SampleWindow(void* hwnd, int argc, char** argv, DeviceManager* dev gConfig[1].fName, gConfig[2].fName, gConfig[3].fName, + gConfig[4].fName, nullptr); fAppMenu->assignKeyEquivalentToItem(itemID, 'C'); @@ -1659,6 +1663,21 @@ bool SampleWindow::onEvent(const SkEvent& evt) { case kSRGB_OutputColorSpace: colorSpace = SkColorSpace::MakeNamed(SkColorSpace::kSRGB_Named); break; + case kNarrow_OutputColorSpace: + { + // NarrowGamut RGB (an artifically smaller than sRGB gamut) + SkColorSpacePrimaries primaries ={ + 0.54f, 0.33f, // Rx, Ry + 0.33f, 0.50f, // Gx, Gy + 0.25f, 0.20f, // Bx, By + 0.3127f, 0.3290f, // Wx, Wy + }; + SkMatrix44 narrowGamutRGBMatrix(SkMatrix44::kUninitialized_Constructor); + primaries.toXYZD50(&narrowGamutRGBMatrix); + colorSpace = SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma, + narrowGamutRGBMatrix); + } + break; case kMonitor_OutputColorSpace: colorSpace = getMonitorColorSpace(); if (!colorSpace) { |