diff options
author | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-12-24 03:10:06 +0000 |
---|---|---|
committer | Akira Kakuto <kakuto@fuk.kindai.ac.jp> | 2018-12-24 03:10:06 +0000 |
commit | dabf643894a0c150fbb9c8f41818f99393aa25b8 (patch) | |
tree | 351cc858e9152b32a56c7c22fdf69df67e062b2f | |
parent | ad3f45e36d3ed596ea5f8262b36f4eb20ce335e1 (diff) |
Avoid modification of internal poppler object (from Stefun)
git-svn-id: svn://tug.org/texlive/trunk@49491 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r-- | Build/source/texk/web2c/xetexdir/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/xetexdir/pdfimage.cpp | 43 |
2 files changed, 29 insertions, 22 deletions
diff --git a/Build/source/texk/web2c/xetexdir/ChangeLog b/Build/source/texk/web2c/xetexdir/ChangeLog index 8ff98249d4f..2c93067ff91 100644 --- a/Build/source/texk/web2c/xetexdir/ChangeLog +++ b/Build/source/texk/web2c/xetexdir/ChangeLog @@ -1,3 +1,9 @@ +2018-12-24 Stefan Br\"uns <stefan.bruens@rwth-aachen.de tug.org> + + * pdfimage.cpp: Avoid modification of internal poppler object, + fix compilation with poppler 0.70.0 and newer ones. + Improve the change on 2018-10-22. + 2018-11-17 Joseph Wright <joseph.wright@morningstar2.co.uk> * xetex.web, xetex.defines: Support some primitives from @@ -5,7 +11,7 @@ 2018-10-22 Akira Kakuto <kakuto@fuk.kindai.ac.jp> - * pdfimage.cpp: Cast types to support poppler 0.70.0. + * pdfimage.cpp: Support poppler 0.70.0. 2018-09-09 Karl Berry <karl@tug.org> diff --git a/Build/source/texk/web2c/xetexdir/pdfimage.cpp b/Build/source/texk/web2c/xetexdir/pdfimage.cpp index 8a38f1ee55b..b097b820df7 100644 --- a/Build/source/texk/web2c/xetexdir/pdfimage.cpp +++ b/Build/source/texk/web2c/xetexdir/pdfimage.cpp @@ -78,52 +78,53 @@ pdf_get_rect(char* filename, int page_num, int pdf_box, realrect* box) Page* page = doc->getCatalog()->getPage(page_num); - PDFRectangle* r; + const PDFRectangle* r; switch (pdf_box) { default: case pdfbox_crop: - r = (PDFRectangle *)page->getCropBox(); + r = page->getCropBox(); break; case pdfbox_media: - r = (PDFRectangle *)page->getMediaBox(); + r = page->getMediaBox(); break; case pdfbox_bleed: - r = (PDFRectangle *)page->getBleedBox(); + r = page->getBleedBox(); break; case pdfbox_trim: - r = (PDFRectangle *)page->getTrimBox(); + r = page->getTrimBox(); break; case pdfbox_art: - r = (PDFRectangle *)page->getArtBox(); + r = page->getArtBox(); break; } + PDFRectangle r2 = *r; int RotAngle = 0; RotAngle = (int)page->getRotate() % 360; if (RotAngle < 0) RotAngle += 360; if (RotAngle == 90 || RotAngle == 270) { double tmpvalue; - if (r->x1 > r->x2) { - tmpvalue = r->x1; - r->x1 = r->x2; - r->x2 = tmpvalue; + if (r2.x1 > r2.x2) { + tmpvalue = r2.x1; + r2.x1 = r2.x2; + r2.x2 = tmpvalue; } - if (r->y1 > r->y2) { - tmpvalue = r->y1; - r->y1 = r->y2; - r->y2 = tmpvalue; + if (r2.y1 > r2.y2) { + tmpvalue = r2.y1; + r2.y1 = r2.y2; + r2.y2 = tmpvalue; } - tmpvalue = r->x2; - r->x2 = r->x1 + r->y2 - r->y1; - r->y2 = r->y1 + tmpvalue - r->x1; + tmpvalue = r2.x2; + r2.x2 = r2.x1 + r2.y2 - r2.y1; + r2.y2 = r2.y1 + tmpvalue - r2.x1; } - box->x = 72.27 / 72 * my_fmin(r->x1, r->x2); - box->y = 72.27 / 72 * my_fmin(r->y1, r->y2); - box->wd = 72.27 / 72 * fabs(r->x2 - r->x1); - box->ht = 72.27 / 72 * fabs(r->y2 - r->y1); + box->x = 72.27 / 72 * my_fmin(r2.x1, r2.x2); + box->y = 72.27 / 72 * my_fmin(r2.y1, r2.y2); + box->wd = 72.27 / 72 * fabs(r2.x2 - r2.x1); + box->ht = 72.27 / 72 * fabs(r2.y2 - r2.y1); delete doc; |