aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/NonlinearBlendingTest.cpp
diff options
context:
space:
mode:
authorGravatar Mike Klein <mtklein@chromium.org>2018-05-29 12:22:10 -0400
committerGravatar Mike Klein <mtklein@google.com>2018-05-29 19:14:03 +0000
commitcdbec8f197e3a75185e95ff66afb3edb49097bde (patch)
treedcc7738094962538cd2f59b549f144a552f1251b /tests/NonlinearBlendingTest.cpp
parenta33447dab9b9ebdc0bd636b6ec7721557d21feac (diff)
remove bit, srgbnl config in DM
We're not going to need the bit. I've rewritten "esrgb" and "srgbnl" to express themselves the way I'd like them to work. Their images are supressed in Gold already. Change-Id: I6da58cc75dcb998cbfcf9a8f65de31c030adb494 Reviewed-on: https://skia-review.googlesource.com/130506 Reviewed-by: Brian Osman <brianosman@google.com>
Diffstat (limited to 'tests/NonlinearBlendingTest.cpp')
-rw-r--r--tests/NonlinearBlendingTest.cpp76
1 files changed, 0 insertions, 76 deletions
diff --git a/tests/NonlinearBlendingTest.cpp b/tests/NonlinearBlendingTest.cpp
deleted file mode 100644
index 10c12aa280..0000000000
--- a/tests/NonlinearBlendingTest.cpp
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright 2018 Google Inc.
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "Test.h"
-#include "SkHalf.h"
-#include "SkSurface.h"
-#include "SkCanvas.h"
-
-DEF_TEST(NonlinearBlending, r) {
-
- // First check our familiar basics with linear F16.
- {
- auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
- SkColorSpace::MakeSRGBLinear());
-
- auto surface = SkSurface::MakeRaster(info);
- surface->getCanvas()->clear(0xff808080);
- uint64_t pix;
- REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0));
-
- // 0x80 in sRGB is ≈ 0.22 linear.
- REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) < 0.25f);
- }
-
- // Test that we support sRGB-encoded F16. This is somewhat new.
- {
- auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
- SkColorSpace::MakeSRGB());
-
- auto surface = SkSurface::MakeRaster(info);
- surface->getCanvas()->clear(0xff808080);
- uint64_t pix;
- REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0));
-
- // 0x80 sRGB is ≈ 0.501.
- REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.5f);
- }
-
- // Since we're only clear()ing, this should work the same as the last block.
- {
- auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
- SkColorSpace::MakeSRGB()->makeNonlinearBlending());
-
- auto surface = SkSurface::MakeRaster(info);
- surface->getCanvas()->clear(0xff808080);
- uint64_t pix;
- REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0));
-
- // 0x80 sRGB is ≈ 0.501.
- REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.5f);
- }
-
- // This won't work until we actually support color spaces with non-linear blending.
- if (0) {
- auto info = SkImageInfo::Make(1,1, kRGBA_F16_SkColorType, kPremul_SkAlphaType,
- SkColorSpace::MakeSRGB()->makeNonlinearBlending());
-
- auto surface = SkSurface::MakeRaster(info);
-
- surface->getCanvas()->clear(SK_ColorWHITE);
- SkPaint p;
- p.setColor(0x80000000);
- surface->getCanvas()->drawPaint(p);
-
- uint64_t pix;
- REPORTER_ASSERT(r, surface->readPixels(info, &pix, sizeof(pix),0,0));
-
- // 0x80 sRGB is ≈ 0.501. A likely failure here is ~0.75, linear blending.
- REPORTER_ASSERT(r, SkHalfToFloat(pix & 0xffff) >= 0.45f &&
- SkHalfToFloat(pix & 0xffff) <= 0.55f);
- }
-}