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

Unified Diff: tests/SkBlend_optsTest.cpp

Issue 2163683002: Correct sRGB <-> linear everywhere. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix! 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
« src/opts/SkBlend_opts.h ('K') | « 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..1b29e4228d46aacb26a6d6604a70a96cd5113927 100644
--- a/tests/SkBlend_optsTest.cpp
+++ b/tests/SkBlend_optsTest.cpp
@@ -19,13 +19,25 @@
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) {
+ // TODO: switch back to pure brute force if we can get Sk4f_toS32(Sk4f_fromS32(...)) to
+ // roundtrip perfectly.
+ if (src >= 0xFF000000) {
+ *dst = src;
+ return;
+ }
+ 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;
}
« src/opts/SkBlend_opts.h ('K') | « src/opts/SkBlend_opts.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698