summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@hotmail.com>2008-03-21 11:11:00 +0100
committerSebastian Rasmussen <sebras@hotmail.com>2008-03-21 11:11:00 +0100
commit58443e4d8b86bb76ffcaae54e23f24b8d59503e5 (patch)
tree958344fd874c5e67ed013c949dc6735e10bb8148
parente95aabed4b04c9abb5a8259137cc50466e26f739 (diff)
downloadmupdf-58443e4d8b86bb76ffcaae54e23f24b8d59503e5.tar.xz
Added support for benchmarking all pages in pdf if none were specified.
-rw-r--r--apps/pdftool.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/pdftool.c b/apps/pdftool.c
index cbd5cd31..1ab4c90c 100644
--- a/apps/pdftool.c
+++ b/apps/pdftool.c
@@ -759,6 +759,7 @@ drawmain(int argc, char **argv)
fz_error *error;
char *password = "";
int c;
+ enum { NO_FILE_OPENED, NO_PAGES_DRAWN, DREW_PAGES } state;
while ((c = getopt(argc, argv, "b:d:o:r:txm")) != -1)
{
@@ -784,15 +785,28 @@ drawmain(int argc, char **argv)
if (error)
die(error);
+ state = NO_FILE_OPENED;
while (optind < argc)
{
if (strstr(argv[optind], ".pdf"))
+ {
+ if (state == NO_PAGES_DRAWN)
+ drawpages("1-");
+
opensrc(argv[optind], password, 1);
+ state = NO_PAGES_DRAWN;
+ }
else
+ {
drawpages(argv[optind]);
+ state = DREW_PAGES;
+ }
optind++;
}
+ if (state == NO_PAGES_DRAWN)
+ drawpages("1-");
+
closesrc();
fz_droprenderer(drawgc);