diff options
author | Tor Andersson <tor@ghostscript.com> | 2004-11-19 03:15:23 +0100 |
---|---|---|
committer | Tor Andersson <tor@ghostscript.com> | 2004-11-19 03:15:23 +0100 |
commit | d5a8ffc6e88c7853169b972ee94286702b214c6b (patch) | |
tree | 6fa101e11734fbd3a0499d7a7e7c703da36a60a1 /test/x11pdf.c | |
parent | ff0bcfe322c6ba8910105780544f498bff23bcd4 (diff) | |
download | mupdf-d5a8ffc6e88c7853169b972ee94286702b214c6b.tar.xz |
cleaned up colorspace loading in mupdf
Diffstat (limited to 'test/x11pdf.c')
-rw-r--r-- | test/x11pdf.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/test/x11pdf.c b/test/x11pdf.c index e0724076..9b1e94c7 100644 --- a/test/x11pdf.c +++ b/test/x11pdf.c @@ -24,6 +24,8 @@ static XEvent xevt; static int mapped = 0; static Cursor xcarrow, xchand, xcwait; +static char doctitle[256]; + static float zoom = 1.0; static int rotate = 0; static int pageno = 1; @@ -181,6 +183,12 @@ Lskipload: XDefineCursor(xdpy, xwin, xcarrow); XFlush(xdpy); + { + char buf[512]; + sprintf(buf, "%s - %d/%d", doctitle, pageno, count); + xtitle(buf); + } + xresize(); xblit(); } @@ -188,6 +196,7 @@ Lskipload: static void pdfopen(char *filename, char *password) { fz_error *error; + fz_obj *obj; error = pdf_openpdf(&xref, filename); if (error) @@ -208,6 +217,20 @@ static void pdfopen(char *filename, char *password) count = pdf_getpagecount(pages); + strlcpy(doctitle, filename, sizeof doctitle); + obj = fz_dictgets(xref->trailer, "Info"); + if (fz_isindirect(obj)) + { + pdf_resolve(&obj, xref); + obj = fz_dictgets(obj, "Title"); + if (obj) + { + int n = MIN(fz_tostringlen(obj) + 1, sizeof doctitle); + if (obj) + strlcpy(doctitle, fz_tostringbuf(obj), n); + } + } + error = fz_newrenderer(&rast, pdf_devicergb, 1024 * 512); if (error) fz_abort(error); @@ -320,8 +343,6 @@ static void handlekey(int c) int main(int argc, char **argv) { char *filename; - fz_obj *obj; - char buf[256]; int c; char *password = ""; @@ -347,22 +368,6 @@ int main(int argc, char **argv) pdfopen(filename, password); showpage(); - strlcpy(buf, filename, sizeof buf); - obj = fz_dictgets(xref->trailer, "Info"); - if (fz_isindirect(obj)) - { - pdf_resolve(&obj, xref); - obj = fz_dictgets(obj, "Title"); - if (obj) - { - int n = MIN(fz_tostringlen(obj) + 1, sizeof buf); - if (obj) - strlcpy(buf, fz_tostringbuf(obj), n); - printf("Title: %s\n", buf); - } - } - xtitle(buf); - while (1) { int len; |