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

Unified Diff: src/core/SkNx.h

Issue 2134753006: Add Sk4f_RoundToInt (Closed) Base URL: https://skia.googlesource.com/skia.git@xformrefactor
Patch Set: Compile fixes 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 | « no previous file | src/opts/SkColorXform_opts.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkNx.h
diff --git a/src/core/SkNx.h b/src/core/SkNx.h
index d0c7f41f1cd1b4b3b8a7e64b4b8fc9a4c6d43408..6e453896c79ee71dc1906df6913a5ef27d9240a4 100644
--- a/src/core/SkNx.h
+++ b/src/core/SkNx.h
@@ -299,6 +299,22 @@ typedef SkNx<4, int> Sk4i;
#include "../opts/SkNx_sse.h"
#elif !defined(SKNX_NO_SIMD) && defined(SK_ARM_HAS_NEON)
#include "../opts/SkNx_neon.h"
+#else
+
+SI Sk4i Sk4f_RoundToInt(const Sk4f& x) {
+ return { sk_float_round2int(x[0]),
mtklein 2016/07/11 14:05:03 If we can't implement this in terms of things from
msarett 2016/07/12 15:42:43 lrintf() seems fine to me.
+ sk_float_round2int(x[1]),
+ sk_float_round2int(x[2]),
+ sk_float_round2int(x[3]), };
+}
+
+SI uint32_t Sk4f_RoundToByte(const Sk4f& x) {
mtklein 2016/07/11 14:05:03 Why don't we simplify this by adding just one new
msarett 2016/07/12 15:42:43 SGTM
+ return sk_float_round2int(x[0]) << 0
+ | sk_float_round2int(x[1]) << 8
+ | sk_float_round2int(x[2]) << 16
+ | sk_float_round2int(x[3]) << 24;
+}
+
#endif
SI void Sk4f_ToBytes(uint8_t p[16], const Sk4f& a, const Sk4f& b, const Sk4f& c, const Sk4f& d) {
« no previous file with comments | « no previous file | src/opts/SkColorXform_opts.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698