mirror of
https://github.com/mozilla/pdf.js.git
synced 2025-04-20 15:18:08 +02:00
Merge pull request #16096 from bungeman/fix_trig_functions
Correct PostScript trigonometric operators
This commit is contained in:
commit
b2a86350fc
7 changed files with 37 additions and 11 deletions
|
@ -628,8 +628,13 @@ class PostScriptEvaluator {
|
|||
}
|
||||
break;
|
||||
case "atan":
|
||||
b = stack.pop();
|
||||
a = stack.pop();
|
||||
stack.push(Math.atan(a));
|
||||
a = (Math.atan2(a, b) / Math.PI) * 180;
|
||||
if (a < 0) {
|
||||
a += 360;
|
||||
}
|
||||
stack.push(a);
|
||||
break;
|
||||
case "bitshift":
|
||||
b = stack.pop();
|
||||
|
@ -650,7 +655,7 @@ class PostScriptEvaluator {
|
|||
break;
|
||||
case "cos":
|
||||
a = stack.pop();
|
||||
stack.push(Math.cos(a));
|
||||
stack.push(Math.cos(((a % 360) / 180) * Math.PI));
|
||||
break;
|
||||
case "cvi":
|
||||
a = stack.pop() | 0;
|
||||
|
@ -774,7 +779,7 @@ class PostScriptEvaluator {
|
|||
break;
|
||||
case "sin":
|
||||
a = stack.pop();
|
||||
stack.push(Math.sin(a));
|
||||
stack.push(Math.sin(((a % 360) / 180) * Math.PI));
|
||||
break;
|
||||
case "sqrt":
|
||||
a = stack.pop();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue