diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-07-25 04:19:27 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2015-07-25 04:19:27 +0000 |
commit | 14ebc2a9ea32def73c44d5502f4fbc701d5dee96 (patch) | |
tree | b0b24db2e5b8df26bd4219db30a833dab976fb3f | |
parent | 22b3ee317c07e2d0f8cf8bec64b2dec6ff7c3103 (diff) |
dvipdfm-x: Improve output file size
git-svn-id: svn://tug.org/texlive/trunk@37953 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/dvipdfm-x/pdfobj.h | 2 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/pdfximage.c | 16 | ||||
-rw-r--r-- | Build/source/texk/dvipdfm-x/spc_pdfm.c | 13 |
3 files changed, 23 insertions, 8 deletions
diff --git a/Build/source/texk/dvipdfm-x/pdfobj.h b/Build/source/texk/dvipdfm-x/pdfobj.h index fa5232f1a09..b6f2d6c5086 100644 --- a/Build/source/texk/dvipdfm-x/pdfobj.h +++ b/Build/source/texk/dvipdfm-x/pdfobj.h @@ -196,5 +196,7 @@ extern int pdfobj_escape_str (char *buffer, int size, const unsigned char * extern pdf_obj *pdf_new_indirect (pdf_file *pf, unsigned long label, unsigned short generation); extern int PageBox; +extern uint8_t PageBox_of_id[]; extern int ImageSpecial; + #endif /* _PDFOBJ_H_ */ diff --git a/Build/source/texk/dvipdfm-x/pdfximage.c b/Build/source/texk/dvipdfm-x/pdfximage.c index 36368603f59..f4ad65db0e2 100644 --- a/Build/source/texk/dvipdfm-x/pdfximage.c +++ b/Build/source/texk/dvipdfm-x/pdfximage.c @@ -354,6 +354,8 @@ load_image (const char *ident, const char *fullname, int format, FILE *fp, #define dpx_fopen(n,m) (MFOPEN((n),(m))) #define dpx_fclose(f) (MFCLOSE((f))) +uint8_t PageBox_of_id[5000]; /* 5000 may be enough */ + int pdf_ximage_findresource (const char *ident, long page_no, pdf_obj *dict) { @@ -368,13 +370,13 @@ pdf_ximage_findresource (const char *ident, long page_no, pdf_obj *dict) I = &ic->ximages[id]; if (I->ident && !strcmp(ident, I->ident)) { f = I->filename; -/* - PageBox can be differrent. So we retry if ImageSpecial != 0 -*/ - if (ImageSpecial == 0) { - if (I->page_no == page_no + (page_no < 0 ? I->page_count+1 : 0) && - I->attr_dict == dict) { - return id; + if (I->page_no == page_no + (page_no < 0 ? I->page_count+1 : 0) && + I->attr_dict == dict) { + if (ImageSpecial) { + if ((int)PageBox_of_id[id] == PageBox) + return id; + } else { + return id; } } } diff --git a/Build/source/texk/dvipdfm-x/spc_pdfm.c b/Build/source/texk/dvipdfm-x/spc_pdfm.c index fc1c49d477f..f3fd5971725 100644 --- a/Build/source/texk/dvipdfm-x/spc_pdfm.c +++ b/Build/source/texk/dvipdfm-x/spc_pdfm.c @@ -984,7 +984,7 @@ spc_handler_pdfm_bead (struct spc_env *spe, struct spc_arg *args) return 0; } -ImageSpecial = 0; +ImageSpecial = 0; /* default value */ static int spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) @@ -1047,6 +1047,7 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) ImageSpecial = 1; xobj_id = pdf_ximage_findresource(pdf_string_value(fspec), page_no, attr); ImageSpecial = 0; + if (xobj_id < 0) { spc_warn(spe, "Could not find image resource..."); pdf_release_obj(fspec); @@ -1055,6 +1056,16 @@ spc_handler_pdfm_image (struct spc_env *spe, struct spc_arg *args) return -1; } + if (xobj_id > 4999) { + spc_warn(spe, "Too many images..."); + pdf_release_obj(fspec); + if (ident) + RELEASE(ident); + return -1; + } + + PageBox_of_id[xobj_id] = (uint8_t)PageBox; + if (!(ti.flags & INFO_DO_HIDE)) pdf_dev_put_image(xobj_id, &ti, spe->x_user, spe->y_user); |