[poppler] poppler/Function.cc

Albert Astals Cid aacid at kemper.freedesktop.org
Sat Feb 9 03:28:23 PST 2008


 poppler/Function.cc |    6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

New commits:
commit 56c924609223196c5c41b9e6d9102bc248bad947
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Feb 9 12:26:06 2008 +0100

    atan operator must yield a degrees result between 0 and 360
    
    See testcase at http://bugs.kde.org/show_bug.cgi?id=157497

diff --git a/poppler/Function.cc b/poppler/Function.cc
index ff05650..9a9951a 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -1262,7 +1262,7 @@ void PostScriptFunction::resizeCode(int newSize) {
 
 void PostScriptFunction::exec(PSStack *stack, int codePtr) {
   int i1, i2;
-  double r1, r2;
+  double r1, r2, result;
   GBool b1, b2;
 
   while (1) {
@@ -1307,7 +1307,9 @@ void PostScriptFunction::exec(PSStack *stack, int codePtr) {
       case psOpAtan:
 	r2 = stack->popNum();
 	r1 = stack->popNum();
-	stack->pushReal(atan2(r1, r2));
+	result = atan2(r1, r2) * 180.0 / M_PI;
+	if (result < 0) result += 360.0;
+	stack->pushReal(result);
 	break;
       case psOpBitshift:
 	i2 = stack->popInt();


More information about the poppler mailing list