diff options
author | Mike Klein <mtklein@chromium.org> | 2017-05-23 09:53:36 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-05-23 15:09:07 +0000 |
commit | e980174d0f3af8e497d9c38851114cc6a3c02e9a (patch) | |
tree | 722fa00268c4996a2063a2a5b9dcfd03f40e9965 /src/jumper/SkJumper_vectors.h | |
parent | b8abb4c636d9dcb08e300e5bfe3b73f6928b38e4 (diff) |
simpler portable round()
Calling out lrintf() is probably kind of extreme...
adding half and truncating should be just fine.
Change-Id: Ifb22c1c1a9b764be153b769aad4671ca44311255
Reviewed-on: https://skia-review.googlesource.com/17708
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Mike Klein <mtklein@chromium.org>
Diffstat (limited to 'src/jumper/SkJumper_vectors.h')
-rw-r--r-- | src/jumper/SkJumper_vectors.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/jumper/SkJumper_vectors.h b/src/jumper/SkJumper_vectors.h index 073b946595..b99330903a 100644 --- a/src/jumper/SkJumper_vectors.h +++ b/src/jumper/SkJumper_vectors.h @@ -35,7 +35,7 @@ SI F rcp (F v) { return 1.0f / v; } SI F rsqrt (F v) { return 1.0f / sqrtf(v); } SI F sqrt_(F v) { return sqrtf(v); } - SI U32 round (F v, F scale) { return (uint32_t)lrintf(v*scale); } + SI U32 round (F v, F scale) { return (uint32_t)(v*scale + 0.5f); } SI U16 pack(U32 v) { return (U16)v; } SI U8 pack(U16 v) { return (U8)v; } |