Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1456)

Unified Diff: tests/SkBlend_optsTest.cpp

Issue 2163683002: Correct sRGB <-> linear everywhere. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: back to brute Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/opts/SkBlend_opts.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/SkBlend_optsTest.cpp
diff --git a/tests/SkBlend_optsTest.cpp b/tests/SkBlend_optsTest.cpp
index 7665a2d5dedd6811ed2baa5ea67921b9ef083c95..e6813748522640a03164c4a89fa19061c062fbcf 100644
--- a/tests/SkBlend_optsTest.cpp
+++ b/tests/SkBlend_optsTest.cpp
@@ -19,13 +19,19 @@
typedef void (*Blender)(uint32_t* dst, const uint32_t* const srcStart, int ndst, const int nsrc);
+static inline void srcover_srgb_srgb_1(uint32_t* dst, uint32_t src) {
+ auto d = Sk4f_fromS32(*dst),
+ s = Sk4f_fromS32( src);
+ *dst = Sk4f_toS32(s + d * (1.0f - s[3]));
+}
+
static void brute_force_srcover_srgb_srgb(
uint32_t* dst, const uint32_t* const src, int ndst, const int nsrc) {
while (ndst > 0) {
int n = SkTMin(ndst, nsrc);
for (int i = 0; i < n; i++) {
- srcover_blend_srgb8888_srgb_1(dst++, srgb_to_linear(to_4f(src[i])));
+ srcover_srgb_srgb_1(dst++, src[i]);
}
ndst -= n;
}
@@ -63,6 +69,7 @@ static void test_blender(std::string resourceName, skiatest::Reporter* reporter)
SkAutoTArray<uint32_t> testDst(width);
for (int y = 0; y < pixmap.height(); y++) {
+ // TODO: zero is not the most interesting dst to test srcover...
sk_bzero(correctDst.get(), width * sizeof(uint32_t));
sk_bzero(testDst.get(), width * sizeof(uint32_t));
brute_force_srcover_srgb_srgb(correctDst.get(), src, width, width);
« no previous file with comments | « src/opts/SkBlend_opts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698