summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorTor Andersson <tor@ghostscript.com>2008-10-13 18:01:58 +0200
committerTor Andersson <tor@ghostscript.com>2008-10-13 18:01:58 +0200
commit9555d31fb7f2b98e795e747c26a5ce4617f8d711 (patch)
tree5c8d4c63fc21a32120a31e643797135c4d694664 /apps
parentf249008ad1d568729a35c7de7ad113ee9e652a16 (diff)
downloadmupdf-9555d31fb7f2b98e795e747c26a5ce4617f8d711.tar.xz
Take md5 checksum of rasters in pdftool, and clean up messages a bit.
Diffstat (limited to 'apps')
-rw-r--r--apps/pdftool.c35
1 files changed, 26 insertions, 9 deletions
diff --git a/apps/pdftool.c b/apps/pdftool.c
index fbd26024..c104596e 100644
--- a/apps/pdftool.c
+++ b/apps/pdftool.c
@@ -530,7 +530,15 @@ drawloadpage(int pagenum, struct benchmark *loadtimes)
long end;
long elapsed;
- fprintf(stderr, "draw %s page %d ", srcname, pagenum);
+ char *basename;
+
+ basename = strrchr(srcname, '/');
+ if (!basename)
+ basename = srcname;
+ else
+ basename ++;
+
+ fprintf(stderr, "draw %s:%03d ", basename, pagenum);
if (benchmark && loadtimes)
{
fflush(stderr);
@@ -561,11 +569,6 @@ drawloadpage(int pagenum, struct benchmark *loadtimes)
loadtimes->pages++;
}
- fprintf(stderr, "mediabox [ %g %g %g %g ] rotate %d%s",
- drawpage->mediabox.x0, drawpage->mediabox.y0,
- drawpage->mediabox.x1, drawpage->mediabox.y1,
- drawpage->rotate,
- benchmark ? "" : "\n");
if (benchmark)
fflush(stderr);
}
@@ -586,12 +589,16 @@ drawpnm(int pagenum, struct benchmark *loadtimes, struct benchmark *drawtimes)
fz_pixmap *pix;
char name[256];
char pnmhdr[256];
- int x, y, w, h, b, bh;
+ int i, x, y, w, h, b, bh;
int fd = -1;
long start;
long end;
long elapsed;
+ fz_md5 digest;
+
+ fz_md5init(&digest);
+
drawloadpage(pagenum, loadtimes);
if (benchmark)
@@ -653,6 +660,8 @@ drawpnm(int pagenum, struct benchmark *loadtimes, struct benchmark *drawtimes)
}
}
+ fz_md5update(&digest, pix->samples, pix->h * pix->w * 4);
+
pix->y += bh;
if (pix->y + pix->h > bbox.y1)
pix->h = bbox.y1 - pix->y;
@@ -660,6 +669,13 @@ drawpnm(int pagenum, struct benchmark *loadtimes, struct benchmark *drawtimes)
fz_droppixmap(pix);
+ {
+ unsigned char buf[16];
+ fz_md5final(&digest, buf);
+ for (i = 0; i < 16; i++)
+ fprintf(stderr, "%02x", buf[i]);
+ }
+
if (drawpattern)
close(fd);
@@ -683,9 +699,11 @@ drawpnm(int pagenum, struct benchmark *loadtimes, struct benchmark *drawtimes)
drawtimes->avg += elapsed;
drawtimes->pages++;
- fprintf(stderr, " time %.3fs\n",
+ fprintf(stderr, " time %.3fs",
elapsed / 1000000.0);
}
+
+ fprintf(stderr, "\n");
}
void
@@ -758,7 +776,6 @@ drawpages(char *pagelist)
if (spage > epage)
page = spage, spage = epage, epage = page;
- printf("Drawing pages %d-%d...\n", spage, epage);
for (page = spage; page <= epage; page++)
{
if (page < 1 || page > pdf_getpagecount(srcpages))