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

Unified Diff: include/private/SkFixed.h

Issue 2433233003: Make SkFixedRound/Ceil/FloorToFixed as inline func (Closed)
Patch Set: Created 4 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/private/SkFixed.h
diff --git a/include/private/SkFixed.h b/include/private/SkFixed.h
index be3bb5d6045d9b24fd98096295b3385be409d5d3..1c6eee52b5db33456203e7ef0023d778e6f98f44 100644
--- a/include/private/SkFixed.h
+++ b/include/private/SkFixed.h
@@ -69,9 +69,15 @@ typedef int32_t SkFixed;
#define SkFixedCeilToInt(x) (((x) + SK_Fixed1 - 1) >> 16)
#define SkFixedFloorToInt(x) ((x) >> 16)
-#define SkFixedRoundToFixed(x) (((x) + SK_FixedHalf) & 0xFFFF0000)
-#define SkFixedCeilToFixed(x) (((x) + SK_Fixed1 - 1) & 0xFFFF0000)
-#define SkFixedFloorToFixed(x) ((x) & 0xFFFF0000)
+static inline SkFixed SkFixedRoundToFixed(SkFixed x) {
+ return (((x) + SK_FixedHalf) & 0xFFFF0000);
+}
+static inline SkFixed SkFixedCeilToFixed(SkFixed x) {
+ return (((x) + SK_Fixed1 - 1) & 0xFFFF0000);
reed1 2016/10/20 17:39:53 nit: more () than needed in each impl
liyuqian 2016/10/20 17:55:36 Done.
+}
+static inline SkFixed SkFixedFloorToFixed(SkFixed x) {
+ return ((x) & 0xFFFF0000);
+}
#define SkFixedAbs(x) SkAbs32(x)
#define SkFixedAve(a, b) (((a) + (b)) >> 1)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698