add a test that sRGB stages round trip
Change-Id: Ide8303f6fc162f3703f7db298fe210d47225a580 Reviewed-on: https://skia-review.googlesource.com/16988 Reviewed-by: Matt Sarett <msarett@google.com> Commit-Queue: Mike Klein <mtklein@chromium.org>
This commit is contained in:
parent
f82b3cd6b5
commit
ca2194b38e
@ -5,6 +5,7 @@
|
||||
* found in the LICENSE file.
|
||||
*/
|
||||
|
||||
#include "SkRasterPipeline.h"
|
||||
#include "SkSRGB.h"
|
||||
#include "SkTypes.h"
|
||||
#include "Test.h"
|
||||
@ -37,3 +38,26 @@ DEF_TEST(sk_linear_to_srgb, r) {
|
||||
f = pun.flt;
|
||||
}
|
||||
}
|
||||
|
||||
DEF_TEST(sk_pipeline_srgb_roundtrip, r) {
|
||||
uint32_t reds[256];
|
||||
for (int i = 0; i < 256; i++) {
|
||||
reds[i] = i;
|
||||
}
|
||||
|
||||
auto ptr = (void*)reds;
|
||||
|
||||
SkRasterPipeline p;
|
||||
p.append(SkRasterPipeline::load_8888, &ptr);
|
||||
p.append_from_srgb(kUnpremul_SkAlphaType);
|
||||
p.append(SkRasterPipeline::to_srgb);
|
||||
p.append(SkRasterPipeline::store_8888, &ptr);
|
||||
|
||||
p.run(0,256);
|
||||
|
||||
for (int i = 0; i < 256; i++) {
|
||||
if (reds[i] != (uint32_t)i) {
|
||||
ERRORF(r, "%d doesn't round trip, %d", i, reds[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user