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

Unified Diff: include/core/SkFixed.h

Issue 977623002: Glyph positions maintain 32 bit integer part. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Use Sk48Dot6, do no fixed math. Created 5 years, 10 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 | include/core/SkScalar.h » ('j') | include/core/SkScalar.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/core/SkFixed.h
diff --git a/include/core/SkFixed.h b/include/core/SkFixed.h
index f3326618433dbaa060f5f950ea85d101489e27da..1bb13f6fc2232ec36ea65dd382cc668652d2bdc3 100644
--- a/include/core/SkFixed.h
+++ b/include/core/SkFixed.h
@@ -150,4 +150,17 @@ typedef int64_t SkFixed3232; // 32.32
#define SkScalarToFixed3232(x) SkFloatToFixed3232(x)
+///////////////////////////////////////////////////////////////////////////////
+
+// 64bits wide, with a 16bit bias. Useful when accumulating lots of 16.16 so
+// we don't overflow along the way
+typedef int64_t Sk48Dot16;
mtklein 2015/03/05 21:00:03 Let's harmonize the names of SkFixed3232 and Sk48D
bungeman-skia 2015/03/05 21:17:56 As seen here, I pulled Sk48Dot16 out of SkPaint be
+
+static inline float Sk48Dot16ToScalar(Sk48Dot16 x) {
+ return (float) (x * 1.5258789e-5); // x * (1 / 65536.0f)
+}
+#define SkFloatTo48Dot16(x) ((Sk48Dot16)((x) * SK_Fixed1))
reed1 2015/03/09 16:33:56 I know the value is correct, but it might read cle
bungeman-skia 2015/03/09 17:49:12 Made things line up in a more sane way.
+
+#define SkScalarTo48Dot16(x) SkFloatTo48Dot16(x)
+
#endif
« no previous file with comments | « no previous file | include/core/SkScalar.h » ('j') | include/core/SkScalar.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698