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

Unified Diff: include/core/SkFloatingPoint.h

Issue 213153006: Fix size of rotated text with FreeType. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 8 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 | « gyp/utils.gyp ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkFloatingPoint.h
===================================================================
--- include/core/SkFloatingPoint.h (revision 14081)
+++ include/core/SkFloatingPoint.h (working copy)
@@ -14,6 +14,12 @@
#include <math.h>
#include <float.h>
+
+// For _POSIX_VERSION
+#if defined(__unix__) || (defined(__APPLE__) && defined(__MACH__))
+#include <unistd.h>
+#endif
+
#include "SkFloatBits.h"
// C++98 cmath std::pow seems to be the earliest portable way to get float pow.
@@ -24,9 +30,24 @@
}
static inline float sk_float_copysign(float x, float y) {
+// c++11 contains a 'float copysign(float, float)' function in <cmath>.
+#if __cplusplus >= 201103L || (defined(_MSC_VER) && _MSC_VER >= 1800)
+ return copysign(x, y);
+
+// Posix has demanded 'float copysignf(float, float)' (from C99) since Issue 6.
+#elif defined(_POSIX_VERSION) && _POSIX_VERSION >= 200112L
+ return copysignf(x, y);
+
+// Visual studio prior to 13 only has 'double _copysign(double, double)'.
+#elif defined(_MSC_VER)
+ return _copysign(x, y);
+
+// Otherwise convert to bits and extract sign.
+#else
int32_t xbits = SkFloat2Bits(x);
int32_t ybits = SkFloat2Bits(y);
return SkBits2Float((xbits & 0x7FFFFFFF) | (ybits & 0x80000000));
+#endif
}
#ifdef SK_BUILD_FOR_WINCE
« no previous file with comments | « gyp/utils.gyp ('k') | src/ports/SkFontHost_FreeType.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698