diff options
author | Matt Sarett <msarett@google.com> | 2017-05-02 16:19:51 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-02 21:05:51 +0000 |
commit | 733340a6997762dc2fe5048cfe5af33bf8293d93 (patch) | |
tree | 5ded5a1cfdfedac13a6de0156f459cde82ba0d92 /gm/readpixels.cpp | |
parent | 26b44df2333d5e8cec8aef11ab598d63b4ee05c7 (diff) |
Support numerical transfer functions in readPixels()
Let's do this because:
(1) We can.
(2) Android and Chrome have asked for it.
(3) It will simplify the implementation of SkImage::makeColorSpace().
Bug: skia:
Change-Id: Ia3c322b8a58c79ad67cdebe744e0623bd59dcffd
Reviewed-on: https://skia-review.googlesource.com/15148
Reviewed-by: Mike Klein <mtklein@chromium.org>
Commit-Queue: Matt Sarett <msarett@google.com>
Diffstat (limited to 'gm/readpixels.cpp')
-rw-r--r-- | gm/readpixels.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/gm/readpixels.cpp b/gm/readpixels.cpp index f757a497b8..69d22bb7f2 100644 --- a/gm/readpixels.cpp +++ b/gm/readpixels.cpp @@ -91,10 +91,12 @@ static sk_sp<SkImage> make_picture_image() { SkColorSpace::MakeSRGB()); } -static sk_sp<SkColorSpace> make_srgb_transfer_fn(const SkColorSpacePrimaries& primaries) { +static sk_sp<SkColorSpace> make_parametric_transfer_fn(const SkColorSpacePrimaries& primaries) { SkMatrix44 toXYZD50(SkMatrix44::kUninitialized_Constructor); SkAssertResult(primaries.toXYZD50(&toXYZD50)); - return SkColorSpace::MakeRGB(SkColorSpace::kSRGB_RenderTargetGamma, toXYZD50); + SkColorSpaceTransferFn fn; + fn.fA = 1.f; fn.fB = 0.f; fn.fC = 0.f; fn.fD = 0.f; fn.fE = 0.f; fn.fF = 0.f; fn.fG = 1.8f; + return SkColorSpace::MakeRGB(fn, toXYZD50); } static sk_sp<SkColorSpace> make_wide_gamut() { @@ -108,7 +110,7 @@ static sk_sp<SkColorSpace> make_wide_gamut() { primaries.fBY = 0.0001f; primaries.fWX = 0.34567f; primaries.fWY = 0.35850f; - return make_srgb_transfer_fn(primaries); + return make_parametric_transfer_fn(primaries); } static sk_sp<SkColorSpace> make_small_gamut() { @@ -121,7 +123,7 @@ static sk_sp<SkColorSpace> make_small_gamut() { primaries.fBY = 0.16f; primaries.fWX = 0.3127f; primaries.fWY = 0.3290f; - return make_srgb_transfer_fn(primaries); + return make_parametric_transfer_fn(primaries); } static void draw_image(SkCanvas* canvas, SkImage* image, SkColorType dstColorType, |