changeset 17526:4f1dd8a980df

Clip OpenGL text rotations to range [0,360]. * libinterp/corefcn/txt-eng-ft.cc(rotation_to_mode): Add or subtract increments of 360 degrees to put rotation into range [0,360].
author Rik <rik@octave.org>
date Tue, 01 Oct 2013 13:50:08 -0700
parents 76a6d7de4cbc
children 76614e624818
files libinterp/corefcn/txt-eng-ft.cc
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libinterp/corefcn/txt-eng-ft.cc	Tue Oct 01 12:51:04 2013 -0700
+++ b/libinterp/corefcn/txt-eng-ft.cc	Tue Oct 01 13:50:08 2013 -0700
@@ -949,6 +949,12 @@
 int
 ft_render::rotation_to_mode (double rotation) const
 {
+  // Clip rotation to range [0, 360]
+  while (rotation < 0)
+    rotation += 360.0;
+  while (rotation > 360.0)
+    rotation -= 360.0;
+
   if (rotation == 0.0)
     return ROTATION_0;
   else if (rotation == 90.0)
@@ -967,7 +973,6 @@
                            int _halign, int valign, double rotation,
                            const caseless_str& interpreter)
 {
-  // FIXME: clip "rotation" between 0 and 360
   int rot_mode = rotation_to_mode (rotation);
 
   halign = _halign;