-
Notifications
You must be signed in to change notification settings - Fork 10k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Type4 PostScript Functions #994
Conversation
@pdfjsbot test |
Processing command test by user brendandahl. Queue size: 0 Live script output is available (after queueing is done) at: http://184.73.87.52:8989/3305568.txt [bot:processed:3305568] |
ERROR(s) foundOutput:
Bot response time: 60.00 mins |
for (; p; p = (Math.ceil(l / p) - 1) * p - l + (l = p)) | ||
for (i = l; i > p; x = a[--i], a[i] = a[i - p], a[i - p] = x); | ||
this.stack = this.stack.concat(a); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's replace o(p * n) with o(n) algorithm:
@@@
var stack = this.stack;
var l = stack.length - n, r = stack.length - 1, c = l + (p - Math.floor(p / n) * n), i, j;
for (i = l, j = r; i < j; i++, j--) {
var t = stack[i]; stack[i] = stack[j]; stack[j] = t;
}
for (i = l, j = c - 1; i < j; i++, j--) {
var t = stack[i]; stack[i] = stack[j]; stack[j] = t;
}
for (i = c, j = r; i < j; i++, j--) {
var t = stack[i]; stack[i] = stack[j]; stack[j] = t;
}
@@@
@pdfjsbot test |
Processing command test by user brendandahl. Queue size: 0 Live script output is available (after queueing is done) at: http://184.73.87.52:8989/3315132.txt [bot:processed:3315132] |
WARNING(s) foundAll tests passed, but with WARNING(s). Make sure to read them! :). Output:
Bot response time: 30.71 mins |
stack.push(Math.cos(a)); | ||
break; | ||
case 'cvi': | ||
a |= stack.pop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a = stack.pop() | 0;
@pdfjsbot test |
Processing command test by user notmasteryet. Queue size: 0 Live script output is available (after queueing is done) at: http://184.73.87.52:8989/3317876.txt [bot:processed:3317876] |
…o be faster testing locally.
WARNING(s) foundAll tests passed, but with WARNING(s). Make sure to read them! :). Output:
Bot response time: 30.93 mins |
@pdfjsbot makeref |
Processing command makeref by user notmasteryet. Queue size: 2 Live script output is available (after queueing is done) at: http://184.73.87.52:8989/3318151.txt [bot:processed:3318151] |
Type4 PostScript Functions
References generated Images pushed to Output:
Bot response time: 65.15 mins |
Fixes #843, resolves #813.
Uses a simple recursive descent parser to build the "assembly code" that is then evaluated to convert color values. I tried to write unit tests for most of the parser and evaluator, but I skipped a number of operators that I deemed straightforward.
I also added the unit test files to the linter and fixed obj_spec.js.
@kkujala Thanks for setting up the unit test stuff!
Last, if anyone is interested in trying more files, the following from the corpus report have type4 functions: