summaryrefslogtreecommitdiff
path: root/Build/source/texk/web2c/luatexdir/image
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-11-14 00:48:08 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2015-11-14 00:48:08 +0000
commit64322869cd45fa0029198b6ef544363a0cf49eb6 (patch)
treefaa34b755a1bd7b9b5ca4a66d204deebf841d119 /Build/source/texk/web2c/luatexdir/image
parent6d37525a79984eea934633c34944113831e3fecb (diff)
web2c/luatexdir: Sync with the upstream trunk.
git-svn-id: svn://tug.org/texlive/trunk@38844 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/luatexdir/image')
-rw-r--r--Build/source/texk/web2c/luatexdir/image/epdf.h5
-rw-r--r--Build/source/texk/web2c/luatexdir/image/pdftoepdf.w2
-rw-r--r--Build/source/texk/web2c/luatexdir/image/writeimg.w56
3 files changed, 29 insertions, 34 deletions
diff --git a/Build/source/texk/web2c/luatexdir/image/epdf.h b/Build/source/texk/web2c/luatexdir/image/epdf.h
index 6bd9734b9dc..09bc7cc84e4 100644
--- a/Build/source/texk/web2c/luatexdir/image/epdf.h
+++ b/Build/source/texk/web2c/luatexdir/image/epdf.h
@@ -197,13 +197,8 @@ PdfDocument *refPdfDocument(const char *file_path, file_error_mode fe);
PdfDocument *refMemStreamPdfDocument(char *docstream, unsigned long long streamsize, const char *file_id);
-
#define STREAM_CHECKSUM_SIZE 16 // md5
-#if defined(_MSC_VER) // VS 2010 cannot compile log(ULONG_MAX)/log(16)
#define STRSTREAM_CHECKSUM_SIZE 1+((unsigned int)(log((double)ULONG_MAX)/log(16.0))) // djb2 printable digest as hex stream
-#else
-#define STRSTREAM_CHECKSUM_SIZE 1+((unsigned int)(log(ULONG_MAX)/log(16))) // djb2 printable digest as hex stream
-#endif
#define STREAM_FILE_ID_LEN 2048 // 2048 bytes are enough to make a strong almost-unique name
#define STREAM_URI "data:application/pdf,"
#define STREAM_URI_LEN 21 // length of "data:application/pdf," without final '\0'
diff --git a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
index cacaea11389..caa510497ba 100644
--- a/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
+++ b/Build/source/texk/web2c/luatexdir/image/pdftoepdf.w
@@ -249,7 +249,7 @@ PdfDocument *refMemStreamPdfDocument(char *docstream, unsigned long long streams
pdf_doc->file_path, pdf_doc->occurences);
#endif
assert(pdf_doc->checksum != NULL);
- // As is now, checksum is in file_path, so this check is should be useless.
+ // As is now, checksum is in file_path, so this check should be useless.
if (strncmp(pdf_doc->checksum, checksum, STRSTREAM_CHECKSUM_SIZE) != 0) {
luatex_fail("PDF inclusion: stream has changed '%s'", file_path);
}
diff --git a/Build/source/texk/web2c/luatexdir/image/writeimg.w b/Build/source/texk/web2c/luatexdir/image/writeimg.w
index 561efd514c0..a93fb6de642 100644
--- a/Build/source/texk/web2c/luatexdir/image/writeimg.w
+++ b/Build/source/texk/web2c/luatexdir/image/writeimg.w
@@ -38,10 +38,6 @@
#include "lua.h" /* for |LUA_NOREF| */
#include "lauxlib.h"
-@ @c
-#define pdf_image_resolution int_par(pdf_image_resolution_code)
-#define pdf_pagebox int_par(pdf_pagebox_code)
-
@* Patch ImageTypeDetection 2003/02/08 by Heiko Oberdiek.
Function |readimage| performs some basic initializations.
@@ -125,7 +121,7 @@
#define HEADER_PDF "%PDF-1."
#define MAX_HEADER (sizeof(HEADER_PNG)-1)
#define HEADER_PDF_MEMSTREAM "data:application/pdf," /* see epdf.h */
-#define LEN_PDF_MEMSTREAM 21 /* see epdf.h */
+#define LEN_PDF_MEMSTREAM 21 /* see epdf.h */
static void check_type_by_header(image_dict * idict)
@@ -133,7 +129,7 @@ static void check_type_by_header(image_dict * idict)
int i;
FILE *file = NULL;
char header[MAX_HEADER];
- char prefix[LEN_PDF_MEMSTREAM+1];
+ char prefix[LEN_PDF_MEMSTREAM+1];
assert(idict != NULL);
if (img_type(idict) != IMG_TYPE_NONE) /* nothing to do */
@@ -143,7 +139,7 @@ static void check_type_by_header(image_dict * idict)
/* Like */
/* file = xfopen(img_filepath(idict), FOPEN_RBIN_MODE);*/
/* but we also check for a memstream object */
- assert(img_filepath(idict) && FOPEN_RBIN_MODE);
+ assert(img_filepath(idict) && FOPEN_RBIN_MODE);
file = fopen(img_filepath(idict), FOPEN_RBIN_MODE);
if (file == NULL) {
/* check the prefix of img_filepath(idict) */
@@ -448,9 +444,8 @@ void scan_pdfximage(PDF pdf)
img_attr(idict) = attr;
img_dimen(idict) = alt_rule;
img_transform(idict) = transform;
- pdf_last_ximage = img_objnum(idict);
- pdf_last_ximage_pages = img_totalpages(idict);
- pdf_last_ximage_colordepth = img_colordepth(idict);
+ last_saved_image_index = img_objnum(idict);
+ last_saved_image_pages = img_totalpages(idict);
}
@ @c
@@ -464,7 +459,7 @@ void scan_pdfrefximage(PDF pdf)
alt_rule = scan_alt_rule(); /* scans |<rule spec>| to |alt_rule| */
scan_int();
check_obj_type(pdf, obj_type_ximage, cur_val);
- new_whatsit(pdf_refximage_node);
+ tail_append(new_rule(image_rule));
idict = idict_array[obj_data_ptr(pdf, cur_val)];
if (alt_rule.wd != null_flag || alt_rule.ht != null_flag
|| alt_rule.dp != null_flag)
@@ -474,8 +469,8 @@ void scan_pdfrefximage(PDF pdf)
width(tail) = dim.wd;
height(tail) = dim.ht;
depth(tail) = dim.dp;
- pdf_ximage_transform(tail) = transform;
- pdf_ximage_index(tail) = img_index(idict);
+ rule_transform(tail) = transform;
+ rule_index(tail) = img_index(idict);
}
@ |tex_scale()| sequence of decisions:
@@ -702,23 +697,28 @@ void pdf_dict_add_img_filename(PDF pdf, image_dict * idict)
{
char s[21], *p;
assert(idict != NULL);
- /* for now PTEX.FileName only for PDF, but prepared for JPG, PNG, ... */
- if ((img_type(idict) != IMG_TYPE_PDF) || (img_type(idict) != IMG_TYPE_PDFMEMSTREAM))
- return;
- if (img_visiblefilename(idict) != NULL) {
- if (strlen(img_visiblefilename(idict)) == 0)
- return; /* empty string blocks PTEX.FileName output */
- else
- p = img_visiblefilename(idict);
- } else
- p = img_filepath(idict);
- // write additional information
- snprintf(s, 20, "%s.FileName", pdfkeyprefix);
- pdf_add_name(pdf, s);
- pdf_printf(pdf, " (%s)", convertStringToPDFString(p, strlen(p)));
+ if (pdf_image_addfilename>0) {
+ /* for now PTEX.FileName only for PDF, but prepared for JPG, PNG, ... */
+ if (! ( (img_type(idict) == IMG_TYPE_PDF) || (img_type(idict) == IMG_TYPE_PDFMEMSTREAM) ))
+ return;
+ if (img_visiblefilename(idict) != NULL) {
+ if (strlen(img_visiblefilename(idict)) == 0) {
+ return; /* empty string blocks PTEX.FileName output */
+ } else {
+ p = img_visiblefilename(idict);
+ }
+ } else {
+ /* unset so let's use the default */
+ p = img_filepath(idict);
+ }
+ // write additional information
+ snprintf(s, 20, "%s.FileName", pdfkeyprefix);
+ pdf_add_name(pdf, s);
+ pdf_printf(pdf, " (%s)", convertStringToPDFString(p, strlen(p)));
+ }
}
-@ To allow the use of \.{\\pdfrefximage} inside saved boxes in -ini mode,
+@ To allow the use of box resources inside saved boxes in -ini mode,
the information in the array has to be (un)dumped with the format.
The next two routines take care of that.