]> granicus.if.org Git - libass/commitdiff
Fix degrees/radians cache confusion; avoid a fixed-point overflow
authorRodger Combs <rodger.combs@gmail.com>
Thu, 12 Mar 2015 09:45:00 +0000 (04:45 -0500)
committerRodger Combs <rodger.combs@gmail.com>
Thu, 12 Mar 2015 09:45:00 +0000 (04:45 -0500)
Also fix an incorrect comment

libass/ass_cache_template.h
libass/ass_utils.h

index dbf724c151674a257262ad626bd47a40a953be21..da49f50f0310a7b063858a0157d7b664012b53da 100644 (file)
@@ -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
index 579ac4061717a9a9f51804dee2a263e834a54085..b9af979d0d2206747581f7ad18ff2e80b4dafdb6 100644 (file)
@@ -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