Created
March 12, 2015 09:46
-
-
Save rcombs/b81372285530e810f58a to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit e5b86309cf3117cb0a3a4523ae42d483c5356f15 | |
Author: Rodger Combs <[email protected]> | |
Date: Thu Mar 12 04:45:00 2015 -0500 | |
Fix degrees/radians cache confusion; avoid a fixed-point overflow | |
Also fix an incorrect comment | |
diff --git a/libass/ass_cache_template.h b/libass/ass_cache_template.h | |
index dbf724c..da49f50 100644 | |
--- a/libass/ass_cache_template.h | |
+++ b/libass/ass_cache_template.h | |
@@ -70,9 +70,9 @@ | |
// describes an outline bitmap | |
START(outline_bitmap, outline_bitmap_hash_key) | |
GENERIC(OutlineHashValue *, outline) | |
- GENERIC(int, frx) // signed 16.16 | |
- GENERIC(int, fry) // signed 16.16 | |
- GENERIC(int, frz) // signed 16.16 | |
+ GENERIC(int, frx) // signed 10.22 | |
+ GENERIC(int, fry) // signed 10.22 | |
+ GENERIC(int, frz) // signed 10.22 | |
GENERIC(int, fax) // signed 16.16 | |
GENERIC(int, fay) // signed 16.16 | |
// shift vector that was added to glyph before applying rotation | |
diff --git a/libass/ass_utils.h b/libass/ass_utils.h | |
index 579ac40..b9af979 100644 | |
--- a/libass/ass_utils.h | |
+++ b/libass/ass_utils.h | |
@@ -26,6 +26,7 @@ | |
#include <string.h> | |
#include <assert.h> | |
#include <errno.h> | |
+#include <math.h> | |
#include "config.h" | |
@@ -162,8 +163,7 @@ static inline int double_to_d22(double x) | |
// Calculate cache key for a rotational angle in degrees | |
static inline int rot_key(double a) | |
{ | |
- const int m = double_to_d22(360.0); | |
- return double_to_d22(a) % m; | |
+ return double_to_d22(fmod(a, M_PI)); | |
} | |
#define FNV1_32A_INIT 0x811c9dc5U |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment