56 lines
1.8 KiB
Plaintext
56 lines
1.8 KiB
Plaintext
|
2024-04-07 Yukimasa Morimi <h20y6m@yahoo.co.jp>
|
||
|
* pdfximage.c: fix an issue where the PDF becomes large when
|
||
|
inserting the same image multiple times.
|
||
|
https://github.com/texjporg/tex-jp-build/pull/169
|
||
|
|
||
|
---
|
||
|
texk/dvipdfm-x/pdfximage.c | 29 ++++++++++++++++-------------
|
||
|
1 file changed, 16 insertions(+), 13 deletions(-)
|
||
|
|
||
|
--- texk/dvipdfm-x/pdfximage.c 2024-03-05 00:40:55.000000000 +0100
|
||
|
+++ texk/dvipdfm-x/pdfximage.c 2024-04-12 14:22:48.800914761 +0200
|
||
|
@@ -396,6 +396,8 @@ load_image (const char *ident, const cha
|
||
|
int utf8name_failed = 0;
|
||
|
#endif /* WIN32 */
|
||
|
|
||
|
+#define dpx_streq(a, b) ((a) == (b) || (a) && (b) && strcmp(a, b) == 0)
|
||
|
+
|
||
|
int
|
||
|
pdf_ximage_load_image (const char *ident, const char *filename, load_options options)
|
||
|
{
|
||
|
@@ -408,20 +410,21 @@ pdf_ximage_load_image (const char *ident
|
||
|
|
||
|
for (i = 0; i < ic->count; i++) {
|
||
|
I = &ic->ximages[i];
|
||
|
- if (I->filename && !strcmp(filename, I->filename)) {
|
||
|
- id = i;
|
||
|
- break;
|
||
|
- }
|
||
|
- }
|
||
|
- if (id >= 0) {
|
||
|
- if (I->attr.page_no == options.page_no &&
|
||
|
- (I->attr.page_name && options.page_name &&
|
||
|
- strcmp(I->attr.page_name, options.page_name) == 0) &&
|
||
|
- !pdf_compare_object(I->attr.dict, options.dict) && /* ????? */
|
||
|
- I->attr.bbox_type == options.bbox_type) {
|
||
|
- return id;
|
||
|
- }
|
||
|
+ if (I->filename == NULL || strcmp(filename, I->filename) != 0)
|
||
|
+ continue;
|
||
|
+ id = i;
|
||
|
f = I->fullname;
|
||
|
+
|
||
|
+ if (I->attr.page_no != options.page_no)
|
||
|
+ continue;
|
||
|
+ if (!dpx_streq(I->attr.page_name, options.page_name))
|
||
|
+ continue;
|
||
|
+ if (pdf_compare_object(I->attr.dict, options.dict) != 0) /* ????? */
|
||
|
+ continue;
|
||
|
+ if (I->attr.bbox_type != options.bbox_type)
|
||
|
+ continue;
|
||
|
+
|
||
|
+ return id;
|
||
|
}
|
||
|
if (f) {
|
||
|
/* we already have converted this file; f is the temporary file name */
|