summaryrefslogtreecommitdiffstats
path: root/src/libuemf/uwmf.c
diff options
context:
space:
mode:
authorDavid Mathog <mathog@caltech.edu>2014-02-08 07:17:30 +0000
committer~suv <suv-sf@users.sourceforge.net>2014-02-08 07:17:30 +0000
commit042cc81dd7c3ca2f0d42b68356f4b450074c8473 (patch)
treef9acbfb046848f7cd420a1fbdf718bdcd604ed11 /src/libuemf/uwmf.c
parentExtensions->Render submenu. Scaling of input parameters into document units, ... (diff)
downloadinkscape-042cc81dd7c3ca2f0d42b68356f4b450074c8473.tar.gz
inkscape-042cc81dd7c3ca2f0d42b68356f4b450074c8473.zip
EMF/WMF support: Various changes (see bug #1263242 c35 for details)
EMF support: - linear gradients: improve numeric stability on round-trip editing - linear gradients: fix scaling issue libTERE/text_reassemble update: - improve handling of whitespace created with large x kerns - fix handling of absolute RTL-positioning of LTR text in EMF files WMF support: - fix support for 'textout' records and Placeable headers - add support for CREATEPATTERNBRUSH - fix offset on load if opened via GUI (bug #1250250) Fixed bugs: - https://launchpad.net/bugs/1263242 - https://launchpad.net/bugs/1250250 (bzr r13008)
Diffstat (limited to 'src/libuemf/uwmf.c')
-rw-r--r--src/libuemf/uwmf.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/libuemf/uwmf.c b/src/libuemf/uwmf.c
index a6ac963cb..be1feadea 100644
--- a/src/libuemf/uwmf.c
+++ b/src/libuemf/uwmf.c
@@ -19,11 +19,11 @@
/*
File: uwmf.c
-Version: 0.0.12
-Date: 25-NOV-2013
+Version: 0.0.13
+Date: 30-JAN-2014
Author: David Mathog, Biology Division, Caltech
email: mathog@caltech.edu
-Copyright: 2013 David Mathog and California Institute of Technology (Caltech)
+Copyright: 2014 David Mathog and California Institute of Technology (Caltech)
*/
#ifdef __cplusplus
@@ -4271,13 +4271,12 @@ char *U_WMRCREATEPATTERNBRUSH_set(
if(!Bm16 || !Pattern)return(NULL);
cbPat = (((Bm16->Width * Bm16->BitsPixel + 15) >> 4) << 1) * Bm16->Height;
- irecsize = U_SIZE_METARECORD + 14 + 4 + 18 + cbPat; /* core WMR + truncated Bm16 + pattern */
+ irecsize = U_SIZE_METARECORD + 14 + 18 + cbPat; /* core WMR + truncated Bm16 + 18 spaces bytes + pattern */
record = malloc(irecsize);
if(record){
U_WMRCORE_SETRECHEAD(record,irecsize,U_WMR_CREATEPATTERNBRUSH);
off = U_SIZE_METARECORD;
- memcpy(record + off, Bm16, 14); off+=14; /* Truncated bitmap16 object*/
- memset(record + off, 0, 4); off+=4; /* 4 bytes of its "bits", which are ignored */
+ memcpy(record + off, Bm16, 14); off+=14; /* Truncated bitmap16 object, last 4 bytes are to be ignored*/
memset(record + off, 0, 18); off+=18; /* 18 bytes of zero, which are ignored */
memcpy(record + off, Pattern, cbPat); /* The pattern array */
}
@@ -5359,7 +5358,7 @@ int U_WMRTEXTOUT_get(
){
int16_t L2;
int off;
- int size = U_WMRCORE_RECSAFE_get(contents, (U_SIZE_WMRPATBLT));
+ int size = U_WMRCORE_RECSAFE_get(contents, (U_SIZE_WMRTEXTOUT));
if(!size)return(0);
*Length = *(int16_t *)(contents + offsetof(U_WMRTEXTOUT, Length));
*string = contents + offsetof(U_WMRTEXTOUT, String); /* May not be null terminated!!! */
@@ -6851,12 +6850,15 @@ int U_WMRCREATEPATTERNBRUSH_get(
const char **Pattern
){
int off = U_SIZE_METARECORD;
- int size = U_WMRCORE_RECSAFE_get(contents, (U_SIZE_WMRSETDIBTODEV));
+ /* size in next one is
+ 6 (core header) + 14 (truncated bitmap16) + 18 bytes reserved + 2 bytes (at least) for data */
+ int size = U_WMRCORE_RECSAFE_get(contents, (U_SIZE_METARECORD + 14 + 18 + 2));
if(!size)return(0);
memset(Bm16, 0, U_SIZE_BITMAP16);
- memcpy(Bm16, contents + off, 14); /* BM16 is truncated in this record type */
+ /* BM16 is truncated in this record type to 14 bytes, last 4 bytes must be ignored, so they are not even copied */
+ memcpy(Bm16, contents + off, 10);
*pasize = (((Bm16->Width * Bm16->BitsPixel + 15) >> 4) << 1) * Bm16->Height;
- off += 36; /* skip [truncated bitmap16 object and 18 bytes of reserved */
+ off += 32; /* skip [14 bytes of truncated bitmap16 object and 18 bytes of reserved */
*Pattern = (contents + off);
return(size);
}