summaryrefslogtreecommitdiff
path: root/fitz
diff options
context:
space:
mode:
Diffstat (limited to 'fitz')
-rw-r--r--fitz/base_error.c92
-rw-r--r--fitz/base_geometry.c70
-rw-r--r--fitz/base_hash.c72
-rw-r--r--fitz/base_memory.c2
-rw-r--r--fitz/base_string.c6
-rw-r--r--fitz/crypt_arc4.c8
-rw-r--r--fitz/crypt_md5.c10
-rw-r--r--fitz/crypt_sha2.c6
-rw-r--r--fitz/dev_bbox.c84
-rw-r--r--fitz/dev_draw.c546
-rw-r--r--fitz/dev_list.c488
-rw-r--r--fitz/dev_null.c92
-rw-r--r--fitz/dev_text.c200
-rw-r--r--fitz/dev_trace.c232
-rw-r--r--fitz/filt_basic.c88
-rw-r--r--fitz/filt_dctd.c30
-rw-r--r--fitz/filt_faxd.c161
-rw-r--r--fitz/filt_flate.c14
-rw-r--r--fitz/filt_jbig2d.c16
-rw-r--r--fitz/filt_jpxd.c10
-rw-r--r--fitz/filt_lzwd.c104
-rw-r--r--fitz/filt_predict.c32
-rw-r--r--fitz/fitz.h791
-rw-r--r--fitz/obj_array.c72
-rw-r--r--fitz/obj_dict.c144
-rw-r--r--fitz/obj_print.c217
-rw-r--r--fitz/obj_simple.c118
-rw-r--r--fitz/res_colorspace.c200
-rw-r--r--fitz/res_font.c214
-rw-r--r--fitz/res_path.c150
-rw-r--r--fitz/res_pixmap.c50
-rw-r--r--fitz/res_shade.c32
-rw-r--r--fitz/res_text.c64
-rw-r--r--fitz/stm_buffer.c12
-rw-r--r--fitz/stm_open.c50
-rw-r--r--fitz/stm_read.c22
36 files changed, 2224 insertions, 2275 deletions
diff --git a/fitz/base_error.c b/fitz/base_error.c
index 7b21d691..a0efa290 100644
--- a/fitz/base_error.c
+++ b/fitz/base_error.c
@@ -1,159 +1,159 @@
#include "fitz.h"
-enum { LINELEN = 160, LINECOUNT = 25 };
+enum { LINE_LEN = 160, LINE_COUNT = 25 };
-static char warnmessage[LINELEN] = "";
-static int warncount = 0;
+static char warn_message[LINE_LEN] = "";
+static int warn_count = 0;
-void fz_flushwarnings(void)
+void fz_flush_warnings(void)
{
- if (warncount > 1)
- fprintf(stderr, "warning: ... repeated %d times ...\n", warncount);
- warnmessage[0] = 0;
- warncount = 0;
+ if (warn_count > 1)
+ fprintf(stderr, "warning: ... repeated %d times ...\n", warn_count);
+ warn_message[0] = 0;
+ warn_count = 0;
}
void fz_warn(char *fmt, ...)
{
va_list ap;
- char buf[LINELEN];
+ char buf[LINE_LEN];
va_start(ap, fmt);
vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
- if (!strcmp(buf, warnmessage))
+ if (!strcmp(buf, warn_message))
{
- warncount++;
+ warn_count++;
}
else
{
- fz_flushwarnings();
+ fz_flush_warnings();
fprintf(stderr, "warning: %s\n", buf);
- fz_strlcpy(warnmessage, buf, sizeof warnmessage);
- warncount = 1;
+ fz_strlcpy(warn_message, buf, sizeof warn_message);
+ warn_count = 1;
}
}
-static char errormessage[LINECOUNT][LINELEN];
-static int errorcount = 0;
+static char error_message[LINE_COUNT][LINE_LEN];
+static int error_count = 0;
static void
-fz_emiterror(char what, char *location, char *message)
+fz_emit_error(char what, char *location, char *message)
{
- fz_flushwarnings();
+ fz_flush_warnings();
fprintf(stderr, "%c %s%s\n", what, location, message);
- if (errorcount < LINECOUNT)
+ if (error_count < LINE_COUNT)
{
- fz_strlcpy(errormessage[errorcount], location, LINELEN);
- fz_strlcat(errormessage[errorcount], message, LINELEN);
- errorcount++;
+ fz_strlcpy(error_message[error_count], location, LINE_LEN);
+ fz_strlcat(error_message[error_count], message, LINE_LEN);
+ error_count++;
}
}
int
-fz_geterrorcount(void)
+fz_get_error_count(void)
{
- return errorcount;
+ return error_count;
}
char *
-fz_geterrorline(int n)
+fz_get_error_line(int n)
{
- return errormessage[n];
+ return error_message[n];
}
fz_error
-fz_throwimp(const char *file, int line, const char *func, char *fmt, ...)
+fz_throw_imp(const char *file, int line, const char *func, char *fmt, ...)
{
va_list ap;
- char one[LINELEN], two[LINELEN];
+ char one[LINE_LEN], two[LINE_LEN];
- errorcount = 0;
+ error_count = 0;
snprintf(one, sizeof one, "%s:%d: %s(): ", file, line, func);
va_start(ap, fmt);
vsnprintf(two, sizeof two, fmt, ap);
va_end(ap);
- fz_emiterror('+', one, two);
+ fz_emit_error('+', one, two);
return -1;
}
fz_error
-fz_rethrowimp(const char *file, int line, const char *func, fz_error cause, char *fmt, ...)
+fz_rethrow_imp(const char *file, int line, const char *func, fz_error cause, char *fmt, ...)
{
va_list ap;
- char one[LINELEN], two[LINELEN];
+ char one[LINE_LEN], two[LINE_LEN];
snprintf(one, sizeof one, "%s:%d: %s(): ", file, line, func);
va_start(ap, fmt);
vsnprintf(two, sizeof two, fmt, ap);
va_end(ap);
- fz_emiterror('|', one, two);
+ fz_emit_error('|', one, two);
return cause;
}
void
-fz_catchimp(const char *file, int line, const char *func, fz_error cause, char *fmt, ...)
+fz_catch_imp(const char *file, int line, const char *func, fz_error cause, char *fmt, ...)
{
va_list ap;
- char one[LINELEN], two[LINELEN];
+ char one[LINE_LEN], two[LINE_LEN];
snprintf(one, sizeof one, "%s:%d: %s(): ", file, line, func);
va_start(ap, fmt);
vsnprintf(two, sizeof two, fmt, ap);
va_end(ap);
- fz_emiterror('\\', one, two);
+ fz_emit_error('\\', one, two);
}
fz_error
-fz_throwimpx(char *fmt, ...)
+fz_throw_impx(char *fmt, ...)
{
va_list ap;
- char buf[LINELEN];
+ char buf[LINE_LEN];
- errorcount = 0;
+ error_count = 0;
va_start(ap, fmt);
vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
- fz_emiterror('+', "", buf);
+ fz_emit_error('+', "", buf);
return -1;
}
fz_error
-fz_rethrowimpx(fz_error cause, char *fmt, ...)
+fz_rethrow_impx(fz_error cause, char *fmt, ...)
{
va_list ap;
- char buf[LINELEN];
+ char buf[LINE_LEN];
va_start(ap, fmt);
vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
- fz_emiterror('|', "", buf);
+ fz_emit_error('|', "", buf);
return cause;
}
void
-fz_catchimpx(fz_error cause, char *fmt, ...)
+fz_catch_impx(fz_error cause, char *fmt, ...)
{
va_list ap;
- char buf[LINELEN];
+ char buf[LINE_LEN];
va_start(ap, fmt);
vsnprintf(buf, sizeof buf, fmt, ap);
va_end(ap);
- fz_emiterror('\\', "", buf);
+ fz_emit_error('\\', "", buf);
}
diff --git a/fitz/base_geometry.c b/fitz/base_geometry.c
index 311221e0..bd333dfa 100644
--- a/fitz/base_geometry.c
+++ b/fitz/base_geometry.c
@@ -85,7 +85,7 @@ fz_translate(float tx, float ty)
}
fz_matrix
-fz_invertmatrix(fz_matrix src)
+fz_invert_matrix(fz_matrix src)
{
fz_matrix dst;
float rdet = 1 / (src.a * src.d - src.b * src.c);
@@ -99,20 +99,20 @@ fz_invertmatrix(fz_matrix src)
}
int
-fz_isrectilinear(fz_matrix m)
+fz_is_rectilinear(fz_matrix m)
{
return (fabsf(m.b) < FLT_EPSILON && fabsf(m.c) < FLT_EPSILON) ||
(fabsf(m.a) < FLT_EPSILON && fabsf(m.d) < FLT_EPSILON);
}
float
-fz_matrixexpansion(fz_matrix m)
+fz_matrix_expansion(fz_matrix m)
{
return sqrtf(fabsf(m.a * m.d - m.b * m.c));
}
fz_point
-fz_transformpoint(fz_matrix m, fz_point p)
+fz_transform_point(fz_matrix m, fz_point p)
{
fz_point t;
t.x = p.x * m.a + p.y * m.c + m.e;
@@ -121,7 +121,7 @@ fz_transformpoint(fz_matrix m, fz_point p)
}
fz_point
-fz_transformvector(fz_matrix m, fz_point p)
+fz_transform_vector(fz_matrix m, fz_point p)
{
fz_point t;
t.x = p.x * m.a + p.y * m.c;
@@ -131,16 +131,16 @@ fz_transformvector(fz_matrix m, fz_point p)
/* Rectangles and bounding boxes */
-const fz_rect fz_infiniterect = { 1, 1, -1, -1 };
-const fz_rect fz_emptyrect = { 0, 0, 0, 0 };
-const fz_rect fz_unitrect = { 0, 0, 1, 1 };
+const fz_rect fz_infinite_rect = { 1, 1, -1, -1 };
+const fz_rect fz_empty_rect = { 0, 0, 0, 0 };
+const fz_rect fz_unit_rect = { 0, 0, 1, 1 };
-const fz_bbox fz_infinitebbox = { 1, 1, -1, -1 };
-const fz_bbox fz_emptybbox = { 0, 0, 0, 0 };
-const fz_bbox fz_unitbbox = { 0, 0, 1, 1 };
+const fz_bbox fz_infinite_bbox = { 1, 1, -1, -1 };
+const fz_bbox fz_empty_bbox = { 0, 0, 0, 0 };
+const fz_bbox fz_unit_bbox = { 0, 0, 1, 1 };
fz_bbox
-fz_roundrect(fz_rect f)
+fz_round_rect(fz_rect f)
{
fz_bbox i;
i.x0 = floorf(f.x0 + 0.001f); /* adjust by 0.001 to compensate for precision errors */
@@ -151,28 +151,28 @@ fz_roundrect(fz_rect f)
}
fz_bbox
-fz_intersectbbox(fz_bbox a, fz_bbox b)
+fz_intersect_bbox(fz_bbox a, fz_bbox b)
{
fz_bbox r;
- if (fz_isinfiniterect(a)) return b;
- if (fz_isinfiniterect(b)) return a;
- if (fz_isemptyrect(a)) return fz_emptybbox;
- if (fz_isemptyrect(b)) return fz_emptybbox;
+ if (fz_is_infinite_rect(a)) return b;
+ if (fz_is_infinite_rect(b)) return a;
+ if (fz_is_empty_rect(a)) return fz_empty_bbox;
+ if (fz_is_empty_rect(b)) return fz_empty_bbox;
r.x0 = MAX(a.x0, b.x0);
r.y0 = MAX(a.y0, b.y0);
r.x1 = MIN(a.x1, b.x1);
r.y1 = MIN(a.y1, b.y1);
- return (r.x1 < r.x0 || r.y1 < r.y0) ? fz_emptybbox : r;
+ return (r.x1 < r.x0 || r.y1 < r.y0) ? fz_empty_bbox : r;
}
fz_bbox
-fz_unionbbox(fz_bbox a, fz_bbox b)
+fz_union_bbox(fz_bbox a, fz_bbox b)
{
fz_bbox r;
- if (fz_isinfiniterect(a)) return a;
- if (fz_isinfiniterect(b)) return b;
- if (fz_isemptyrect(a)) return b;
- if (fz_isemptyrect(b)) return a;
+ if (fz_is_infinite_rect(a)) return a;
+ if (fz_is_infinite_rect(b)) return b;
+ if (fz_is_empty_rect(a)) return b;
+ if (fz_is_empty_rect(b)) return a;
r.x0 = MIN(a.x0, b.x0);
r.y0 = MIN(a.y0, b.y0);
r.x1 = MAX(a.x1, b.x1);
@@ -181,21 +181,21 @@ fz_unionbbox(fz_bbox a, fz_bbox b)
}
fz_rect
-fz_transformrect(fz_matrix m, fz_rect r)
+fz_transform_rect(fz_matrix m, fz_rect r)
{
fz_point s, t, u, v;
- if (fz_isinfiniterect(r))
+ if (fz_is_infinite_rect(r))
return r;
s.x = r.x0; s.y = r.y0;
t.x = r.x0; t.y = r.y1;
u.x = r.x1; u.y = r.y1;
v.x = r.x1; v.y = r.y0;
- s = fz_transformpoint(m, s);
- t = fz_transformpoint(m, t);
- u = fz_transformpoint(m, u);
- v = fz_transformpoint(m, v);
+ s = fz_transform_point(m, s);
+ t = fz_transform_point(m, t);
+ u = fz_transform_point(m, u);
+ v = fz_transform_point(m, v);
r.x0 = MIN4(s.x, t.x, u.x, v.x);
r.y0 = MIN4(s.y, t.y, u.y, v.y);
r.x1 = MAX4(s.x, t.x, u.x, v.x);
@@ -204,21 +204,21 @@ fz_transformrect(fz_matrix m, fz_rect r)
}
fz_bbox
-fz_transformbbox(fz_matrix m, fz_bbox b)
+fz_transform_bbox(fz_matrix m, fz_bbox b)
{
fz_point s, t, u, v;
- if (fz_isinfinitebbox(b))
+ if (fz_is_infinite_bbox(b))
return b;
s.x = b.x0; s.y = b.y0;
t.x = b.x0; t.y = b.y1;
u.x = b.x1; u.y = b.y1;
v.x = b.x1; v.y = b.y0;
- s = fz_transformpoint(m, s);
- t = fz_transformpoint(m, t);
- u = fz_transformpoint(m, u);
- v = fz_transformpoint(m, v);
+ s = fz_transform_point(m, s);
+ t = fz_transform_point(m, t);
+ u = fz_transform_point(m, u);
+ v = fz_transform_point(m, v);
b.x0 = MIN4(s.x, t.x, u.x, v.x);
b.y0 = MIN4(s.y, t.y, u.y, v.y);
b.x1 = MAX4(s.x, t.x, u.x, v.x);
diff --git a/fitz/base_hash.c b/fitz/base_hash.c
index e2bf6b04..fcfc1f61 100644
--- a/fitz/base_hash.c
+++ b/fitz/base_hash.c
@@ -8,21 +8,21 @@ exhibiting bad behaviour if entries are inserted
and removed frequently.
*/
-enum { MAXKEYLEN = 48 };
-typedef struct fz_hashentry_s fz_hashentry;
+enum { MAX_KEY_LEN = 48 };
+typedef struct fz_hash_entry_s fz_hash_entry;
-struct fz_hashentry_s
+struct fz_hash_entry_s
{
- unsigned char key[MAXKEYLEN];
+ unsigned char key[MAX_KEY_LEN];
void *val;
};
-struct fz_hashtable_s
+struct fz_hash_table_s
{
int keylen;
int size;
int load;
- fz_hashentry *ents;
+ fz_hash_entry *ents;
};
static unsigned hash(unsigned char *s, int len)
@@ -41,59 +41,59 @@ static unsigned hash(unsigned char *s, int len)
return val;
}
-fz_hashtable *
-fz_newhash(int initialsize, int keylen)
+fz_hash_table *
+fz_new_hash_table(int initialsize, int keylen)
{
- fz_hashtable *table;
+ fz_hash_table *table;
- assert(keylen <= MAXKEYLEN);
+ assert(keylen <= MAX_KEY_LEN);
- table = fz_malloc(sizeof(fz_hashtable));
+ table = fz_malloc(sizeof(fz_hash_table));
table->keylen = keylen;
table->size = initialsize;
table->load = 0;
- table->ents = fz_calloc(table->size, sizeof(fz_hashentry));
- memset(table->ents, 0, sizeof(fz_hashentry) * table->size);
+ table->ents = fz_calloc(table->size, sizeof(fz_hash_entry));
+ memset(table->ents, 0, sizeof(fz_hash_entry) * table->size);
return table;
}
void
-fz_emptyhash(fz_hashtable *table)
+fz_empty_hash(fz_hash_table *table)
{
table->load = 0;
- memset(table->ents, 0, sizeof(fz_hashentry) * table->size);
+ memset(table->ents, 0, sizeof(fz_hash_entry) * table->size);
}
int
-fz_hashlen(fz_hashtable *table)
+fz_hash_len(fz_hash_table *table)
{
return table->size;
}
void *
-fz_hashgetkey(fz_hashtable *table, int idx)
+fz_hash_get_key(fz_hash_table *table, int idx)
{
return table->ents[idx].key;
}
void *
-fz_hashgetval(fz_hashtable *table, int idx)
+fz_hash_get_val(fz_hash_table *table, int idx)
{
return table->ents[idx].val;
}
void
-fz_freehash(fz_hashtable *table)
+fz_free_hash(fz_hash_table *table)
{
fz_free(table->ents);
fz_free(table);
}
static void
-fz_resizehash(fz_hashtable *table, int newsize)
+fz_resize_hash(fz_hash_table *table, int newsize)
{
- fz_hashentry *oldents = table->ents;
+ fz_hash_entry *oldents = table->ents;
int oldsize = table->size;
int oldload = table->load;
int i;
@@ -104,8 +104,8 @@ fz_resizehash(fz_hashtable *table, int newsize)
return;
}
- table->ents = fz_calloc(newsize, sizeof(fz_hashentry));
- memset(table->ents, 0, sizeof(fz_hashentry) * newsize);
+ table->ents = fz_calloc(newsize, sizeof(fz_hash_entry));
+ memset(table->ents, 0, sizeof(fz_hash_entry) * newsize);
table->size = newsize;
table->load = 0;
@@ -113,7 +113,7 @@ fz_resizehash(fz_hashtable *table, int newsize)
{
if (oldents[i].val)
{
- fz_hashinsert(table, oldents[i].key, oldents[i].val);
+ fz_hash_insert(table, oldents[i].key, oldents[i].val);
}
}
@@ -121,16 +121,16 @@ fz_resizehash(fz_hashtable *table, int newsize)
}
void *
-fz_hashfind(fz_hashtable *table, void *key)
+fz_hash_find(fz_hash_table *table, void *key)
{
- fz_hashentry *ents = table->ents;
+ fz_hash_entry *ents = table->ents;
unsigned size = table->size;
unsigned pos = hash(key, table->keylen) % size;
while (1)
{
if (!ents[pos].val)
- return nil;
+ return NULL;
if (memcmp(key, ents[pos].key, table->keylen) == 0)
return ents[pos].val;
@@ -140,15 +140,15 @@ fz_hashfind(fz_hashtable *table, void *key)
}
void
-fz_hashinsert(fz_hashtable *table, void *key, void *val)
+fz_hash_insert(fz_hash_table *table, void *key, void *val)
{
- fz_hashentry *ents;
+ fz_hash_entry *ents;
unsigned size;
unsigned pos;
if (table->load > table->size * 8 / 10)
{
- fz_resizehash(table, table->size * 2);
+ fz_resize_hash(table, table->size * 2);
}
ents = table->ents;
@@ -173,9 +173,9 @@ fz_hashinsert(fz_hashtable *table, void *key, void *val)
}
void
-fz_hashremove(fz_hashtable *table, void *key)
+fz_hash_remove(fz_hash_table *table, void *key)
{
- fz_hashentry *ents = table->ents;
+ fz_hash_entry *ents = table->ents;
unsigned size = table->size;
unsigned pos = hash(key, table->keylen) % size;
unsigned hole, look, code;
@@ -190,7 +190,7 @@ fz_hashremove(fz_hashtable *table, void *key)
if (memcmp(key, ents[pos].key, table->keylen) == 0)
{
- ents[pos].val = nil;
+ ents[pos].val = NULL;
hole = pos;
look = (hole + 1) % size;
@@ -203,7 +203,7 @@ fz_hashremove(fz_hashtable *table, void *key)
(hole < look && look < code))
{
ents[hole] = ents[look];
- ents[look].val = nil;
+ ents[look].val = NULL;
hole = look;
}
@@ -220,7 +220,7 @@ fz_hashremove(fz_hashtable *table, void *key)
}
void
-fz_debughash(fz_hashtable *table)
+fz_debug_hash(fz_hash_table *table)
{
int i, k;
@@ -233,7 +233,7 @@ fz_debughash(fz_hashtable *table)
else
{
printf("table % 4d: key=", i);
- for (k = 0; k < MAXKEYLEN; k++)
+ for (k = 0; k < MAX_KEY_LEN; k++)
printf("%02x", ((char*)table->ents[i].key)[k]);
printf(" val=$%p\n", table->ents[i].val);
}
diff --git a/fitz/base_memory.c b/fitz/base_memory.c
index caeee451..f1b668eb 100644
--- a/fitz/base_memory.c
+++ b/fitz/base_memory.c
@@ -53,7 +53,7 @@ fz_realloc(void *p, int count, int size)
}
np = realloc(p, count * size);
- if (np == nil)
+ if (np == NULL)
{
fprintf(stderr, "fatal error: out of memory\n");
abort();
diff --git a/fitz/base_string.c b/fitz/base_string.c
index 30d544d5..72a7a556 100644
--- a/fitz/base_string.c
+++ b/fitz/base_string.c
@@ -1,7 +1,7 @@
#include "fitz.h"
int
-fz_isbigendian(void)
+fz_is_big_endian(void)
{
static const int one = 1;
return *(char*)&one == 0;
@@ -11,8 +11,8 @@ char *
fz_strsep(char **stringp, const char *delim)
{
char *ret = *stringp;
- if (ret == nil) return nil;
- if ((*stringp = strpbrk(*stringp, delim)) != nil)
+ if (ret == NULL) return NULL;
+ if ((*stringp = strpbrk(*stringp, delim)) != NULL)
*((*stringp)++) = '\0';
return ret;
}
diff --git a/fitz/crypt_arc4.c b/fitz/crypt_arc4.c
index 1db8a132..72871386 100644
--- a/fitz/crypt_arc4.c
+++ b/fitz/crypt_arc4.c
@@ -24,7 +24,7 @@
#include "fitz.h"
void
-fz_arc4init(fz_arc4 *arc4, const unsigned char *key, const unsigned keylen)
+fz_arc4_init(fz_arc4 *arc4, const unsigned char *key, const unsigned keylen)
{
unsigned int t, u;
unsigned int keyindex;
@@ -62,7 +62,7 @@ fz_arc4init(fz_arc4 *arc4, const unsigned char *key, const unsigned keylen)
}
static unsigned char
-fz_arc4next(fz_arc4 *arc4)
+fz_arc4_next(fz_arc4 *arc4)
{
unsigned int x;
unsigned int y;
@@ -86,13 +86,13 @@ fz_arc4next(fz_arc4 *arc4)
}
void
-fz_arc4encrypt(fz_arc4 *arc4, unsigned char *dest, const unsigned char *src, const unsigned len)
+fz_arc4_encrypt(fz_arc4 *arc4, unsigned char *dest, const unsigned char *src, const unsigned len)
{
unsigned int i;
for (i = 0; i < len; i++)
{
unsigned char x;
- x = fz_arc4next(arc4);
+ x = fz_arc4_next(arc4);
dest[i] = src[i] ^ x;
}
}
diff --git a/fitz/crypt_md5.c b/fitz/crypt_md5.c
index 6e38f416..ba2571c4 100644
--- a/fitz/crypt_md5.c
+++ b/fitz/crypt_md5.c
@@ -196,7 +196,7 @@ static void transform(unsigned int state[4], const unsigned char block[64])
}
/* MD5 initialization. Begins an MD5 operation, writing a new context. */
-void fz_md5init(fz_md5 *context)
+void fz_md5_init(fz_md5 *context)
{
context->count[0] = context->count[1] = 0;
@@ -210,7 +210,7 @@ void fz_md5init(fz_md5 *context)
/* MD5 block update operation. Continues an MD5 message-digest operation,
* processing another message block, and updating the context.
*/
-void fz_md5update(fz_md5 *context, const unsigned char *input, const unsigned inlen)
+void fz_md5_update(fz_md5 *context, const unsigned char *input, const unsigned inlen)
{
unsigned i, index, partlen;
@@ -248,7 +248,7 @@ void fz_md5update(fz_md5 *context, const unsigned char *input, const unsigned in
/* MD5 finalization. Ends an MD5 message-digest operation, writing the
* the message digest and zeroizing the context.
*/
-void fz_md5final(fz_md5 *context, unsigned char digest[16])
+void fz_md5_final(fz_md5 *context, unsigned char digest[16])
{
unsigned char bits[8];
unsigned index, padlen;
@@ -259,10 +259,10 @@ void fz_md5final(fz_md5 *context, unsigned char digest[16])
/* Pad out to 56 mod 64 */
index = (unsigned)((context->count[0] >> 3) & 0x3f);
padlen = index < 56 ? 56 - index : 120 - index;
- fz_md5update(context, padding, padlen);
+ fz_md5_update(context, padding, padlen);
/* Append length (before padding) */
- fz_md5update(context, bits, 8);
+ fz_md5_update(context, bits, 8);
/* Store state in digest */
encode(digest, context->state, 16);
diff --git a/fitz/crypt_sha2.c b/fitz/crypt_sha2.c
index 6796c5ab..f17146c6 100644
--- a/fitz/crypt_sha2.c
+++ b/fitz/crypt_sha2.c
@@ -110,7 +110,7 @@ transform(unsigned int state[8], const unsigned int data_xe[16])
state[7] += h(0);
}
-void fz_sha256init(fz_sha256 *context)
+void fz_sha256_init(fz_sha256 *context)
{
context->count[0] = context->count[1] = 0;
@@ -124,7 +124,7 @@ void fz_sha256init(fz_sha256 *context)
context->state[7] = 0x5BE0CD19;
}
-void fz_sha256update(fz_sha256 *context, const unsigned char *input, unsigned int inlen)
+void fz_sha256_update(fz_sha256 *context, const unsigned char *input, unsigned int inlen)
{
/* Copy the input data into a properly aligned temporary buffer.
* This way we can be called with arbitrarily sized buffers
@@ -151,7 +151,7 @@ void fz_sha256update(fz_sha256 *context, const unsigned char *input, unsigned in
}
}
-void fz_sha256final(fz_sha256 *context, unsigned char digest[32])
+void fz_sha256_final(fz_sha256 *context, unsigned char digest[32])
{
/* Add padding as described in RFC 3174 (it describes SHA-1 but
* the same padding style is used for SHA-256 too). */
diff --git a/fitz/dev_bbox.c b/fitz/dev_bbox.c
index f6028f44..0f2f3cfe 100644
--- a/fitz/dev_bbox.c
+++ b/fitz/dev_bbox.c
@@ -2,95 +2,95 @@
/* TODO: add clip stack and use to intersect bboxes */
-typedef struct fz_bboxdevice_s fz_bboxdevice;
+typedef struct fz_bbox_device_s fz_bbox_device;
-struct fz_bboxdevice_s
+struct fz_bbox_device_s
{
fz_bbox *bbox;
};
static void
-fz_bboxfillpath(void *user, fz_path *path, int evenodd, fz_matrix ctm,
+fz_bbox_fill_path(void *user, fz_path *path, int even_odd, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_bboxdevice *bdev = user;
- fz_bbox bbox = fz_roundrect(fz_boundpath(path, nil, ctm));
- *bdev->bbox = fz_unionbbox(*bdev->bbox, bbox);
+ fz_bbox_device *bdev = user;
+ fz_bbox bbox = fz_round_rect(fz_bound_path(path, NULL, ctm));
+ *bdev->bbox = fz_union_bbox(*bdev->bbox, bbox);
}
static void
-fz_bboxstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm,
+fz_bbox_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_bboxdevice *bdev = user;
- fz_bbox bbox = fz_roundrect(fz_boundpath(path, stroke, ctm));
- *bdev->bbox = fz_unionbbox(*bdev->bbox, bbox);
+ fz_bbox_device *bdev = user;
+ fz_bbox bbox = fz_round_rect(fz_bound_path(path, stroke, ctm));
+ *bdev->bbox = fz_union_bbox(*bdev->bbox, bbox);
}
static void
-fz_bboxfilltext(void *user, fz_text *text, fz_matrix ctm,
+fz_bbox_fill_text(void *user, fz_text *text, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_bboxdevice *bdev = user;
- fz_bbox bbox = fz_roundrect(fz_boundtext(text, ctm));
- *bdev->bbox = fz_unionbbox(*bdev->bbox, bbox);
+ fz_bbox_device *bdev = user;
+ fz_bbox bbox = fz_round_rect(fz_bound_text(text, ctm));
+ *bdev->bbox = fz_union_bbox(*bdev->bbox, bbox);
}
static void
-fz_bboxstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm,
+fz_bbox_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_bboxdevice *bdev = user;
- fz_bbox bbox = fz_roundrect(fz_boundtext(text, ctm));
- *bdev->bbox = fz_unionbbox(*bdev->bbox, bbox);
+ fz_bbox_device *bdev = user;
+ fz_bbox bbox = fz_round_rect(fz_bound_text(text, ctm));
+ *bdev->bbox = fz_union_bbox(*bdev->bbox, bbox);
}
static void
-fz_bboxfillshade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
+fz_bbox_fill_shade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
{
- fz_bboxdevice *bdev = user;
- fz_bbox bbox = fz_roundrect(fz_boundshade(shade, ctm));
- *bdev->bbox = fz_unionbbox(*bdev->bbox, bbox);
+ fz_bbox_device *bdev = user;
+ fz_bbox bbox = fz_round_rect(fz_bound_shade(shade, ctm));
+ *bdev->bbox = fz_union_bbox(*bdev->bbox, bbox);
}
static void
-fz_bboxfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
+fz_bbox_fill_image(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
{
- fz_bboxdevice *bdev = user;
- fz_bbox bbox = fz_roundrect(fz_transformrect(ctm, fz_unitrect));
- *bdev->bbox = fz_unionbbox(*bdev->bbox, bbox);
+ fz_bbox_device *bdev = user;
+ fz_bbox bbox = fz_round_rect(fz_transform_rect(ctm, fz_unit_rect));
+ *bdev->bbox = fz_union_bbox(*bdev->bbox, bbox);
}
static void
-fz_bboxfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm,
+fz_bbox_fill_image_mask(void *user, fz_pixmap *image, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_bboxfillimage(user, image, ctm, alpha);
+ fz_bbox_fill_image(user, image, ctm, alpha);
}
static void
-fz_bboxfreeuser(void *user)
+fz_bbox_free_user(void *user)
{
- fz_bboxdevice *bdev = user;
+ fz_bbox_device *bdev = user;
fz_free(bdev);
}
fz_device *
-fz_newbboxdevice(fz_bbox *bboxp)
+fz_new_bbox_device(fz_bbox *bboxp)
{
fz_device *dev;
- fz_bboxdevice *bdev = fz_malloc(sizeof(fz_bboxdevice));
+ fz_bbox_device *bdev = fz_malloc(sizeof(fz_bbox_device));
bdev->bbox = bboxp;
- *bdev->bbox = fz_emptybbox;
+ *bdev->bbox = fz_empty_bbox;
- dev = fz_newdevice(bdev);
- dev->freeuser = fz_bboxfreeuser;
- dev->fillpath = fz_bboxfillpath;
- dev->strokepath = fz_bboxstrokepath;
- dev->filltext = fz_bboxfilltext;
- dev->stroketext = fz_bboxstroketext;
- dev->fillshade = fz_bboxfillshade;
- dev->fillimage = fz_bboxfillimage;
- dev->fillimagemask = fz_bboxfillimagemask;
+ dev = fz_new_device(bdev);
+ dev->free_user = fz_bbox_free_user;
+ dev->fill_path = fz_bbox_fill_path;
+ dev->stroke_path = fz_bbox_stroke_path;
+ dev->fill_text = fz_bbox_fill_text;
+ dev->stroke_text = fz_bbox_stroke_text;
+ dev->fill_shade = fz_bbox_fill_shade;
+ dev->fill_image = fz_bbox_fill_image;
+ dev->fill_image_mask = fz_bbox_fill_image_mask;
return dev;
}
diff --git a/fitz/dev_draw.c b/fitz/dev_draw.c
index ee74033d..e5078f49 100644
--- a/fitz/dev_draw.c
+++ b/fitz/dev_draw.c
@@ -4,13 +4,13 @@
#define HSUBPIX 5.0
#define VSUBPIX 5.0
-#define STACKSIZE 96
+#define STACK_SIZE 96
-typedef struct fz_drawdevice_s fz_drawdevice;
+typedef struct fz_draw_device_s fz_draw_device;
-struct fz_drawdevice_s
+struct fz_draw_device_s
{
- fz_glyphcache *cache;
+ fz_glyph_cache *cache;
fz_gel *gel;
fz_ael *ael;
@@ -28,118 +28,118 @@ struct fz_drawdevice_s
fz_matrix ctm;
float xstep, ystep;
fz_rect area;
- } stack[STACKSIZE];
+ } stack[STACK_SIZE];
};
static void
-fz_drawfillpath(void *user, fz_path *path, int evenodd, fz_matrix ctm,
+fz_draw_fill_path(void *user, fz_path *path, int even_odd, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
- float expansion = fz_matrixexpansion(ctm);
+ float expansion = fz_matrix_expansion(ctm);
float flatness = 0.3f / expansion;
- unsigned char colorbv[FZ_MAXCOLORS + 1];
- float colorfv[FZ_MAXCOLORS];
+ unsigned char colorbv[FZ_MAX_COLORS + 1];
+ float colorfv[FZ_MAX_COLORS];
fz_bbox bbox;
int i;
- fz_resetgel(dev->gel, dev->scissor);
- fz_fillpath(dev->gel, path, ctm, flatness);
- fz_sortgel(dev->gel);
+ fz_reset_gel(dev->gel, dev->scissor);
+ fz_fill_path(dev->gel, path, ctm, flatness);
+ fz_sort_gel(dev->gel);
- bbox = fz_boundgel(dev->gel);
- bbox = fz_intersectbbox(bbox, dev->scissor);
+ bbox = fz_bound_gel(dev->gel);
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
- if (fz_isemptyrect(bbox))
+ if (fz_is_empty_rect(bbox))
return;
- fz_convertcolor(colorspace, color, model, colorfv);
+ fz_convert_color(colorspace, color, model, colorfv);
for (i = 0; i < model->n; i++)
colorbv[i] = colorfv[i] * 255;
colorbv[i] = alpha * 255;
- fz_scanconvert(dev->gel, dev->ael, evenodd, bbox, dev->dest, colorbv);
+ fz_scan_convert(dev->gel, dev->ael, even_odd, bbox, dev->dest, colorbv);
}
static void
-fz_drawstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm,
+fz_draw_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
- float expansion = fz_matrixexpansion(ctm);
+ float expansion = fz_matrix_expansion(ctm);
float flatness = 0.3f / expansion;
float linewidth = stroke->linewidth;
- unsigned char colorbv[FZ_MAXCOLORS + 1];
- float colorfv[FZ_MAXCOLORS];
+ unsigned char colorbv[FZ_MAX_COLORS + 1];
+ float colorfv[FZ_MAX_COLORS];
fz_bbox bbox;
int i;
if (linewidth * expansion < 0.1f)
linewidth = 1 / expansion;
- fz_resetgel(dev->gel, dev->scissor);
- if (stroke->dashlen > 0)
- fz_dashpath(dev->gel, path, stroke, ctm, flatness, linewidth);
+ fz_reset_gel(dev->gel, dev->scissor);
+ if (stroke->dash_len > 0)
+ fz_dash_path(dev->gel, path, stroke, ctm, flatness, linewidth);
else
- fz_strokepath(dev->gel, path, stroke, ctm, flatness, linewidth);
- fz_sortgel(dev->gel);
+ fz_stroke_path(dev->gel, path, stroke, ctm, flatness, linewidth);
+ fz_sort_gel(dev->gel);
- bbox = fz_boundgel(dev->gel);
- bbox = fz_intersectbbox(bbox, dev->scissor);
+ bbox = fz_bound_gel(dev->gel);
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
- if (fz_isemptyrect(bbox))
+ if (fz_is_empty_rect(bbox))
return;
- fz_convertcolor(colorspace, color, model, colorfv);
+ fz_convert_color(colorspace, color, model, colorfv);
for (i = 0; i < model->n; i++)
colorbv[i] = colorfv[i] * 255;
colorbv[i] = alpha * 255;
- fz_scanconvert(dev->gel, dev->ael, 0, bbox, dev->dest, colorbv);
+ fz_scan_convert(dev->gel, dev->ael, 0, bbox, dev->dest, colorbv);
}
static void
-fz_drawclippath(void *user, fz_path *path, int evenodd, fz_matrix ctm)
+fz_draw_clip_path(void *user, fz_path *path, int even_odd, fz_matrix ctm)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
- float expansion = fz_matrixexpansion(ctm);
+ float expansion = fz_matrix_expansion(ctm);
float flatness = 0.3f / expansion;
fz_pixmap *mask, *dest;
fz_bbox bbox;
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
}
- fz_resetgel(dev->gel, dev->scissor);
- fz_fillpath(dev->gel, path, ctm, flatness);
- fz_sortgel(dev->gel);
+ fz_reset_gel(dev->gel, dev->scissor);
+ fz_fill_path(dev->gel, path, ctm, flatness);
+ fz_sort_gel(dev->gel);
- bbox = fz_boundgel(dev->gel);
- bbox = fz_intersectbbox(bbox, dev->scissor);
+ bbox = fz_bound_gel(dev->gel);
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
- if (fz_isemptyrect(bbox) || fz_isrectgel(dev->gel))
+ if (fz_is_empty_rect(bbox) || fz_is_rect_gel(dev->gel))
{
dev->stack[dev->top].scissor = dev->scissor;
- dev->stack[dev->top].mask = nil;
- dev->stack[dev->top].dest = nil;
+ dev->stack[dev->top].mask = NULL;
+ dev->stack[dev->top].dest = NULL;
dev->scissor = bbox;
dev->top++;
return;
}
- mask = fz_newpixmapwithrect(nil, bbox);
- dest = fz_newpixmapwithrect(model, bbox);
+ mask = fz_new_pixmap_with_rect(NULL, bbox);
+ dest = fz_new_pixmap_with_rect(model, bbox);
- fz_clearpixmap(mask);
- fz_clearpixmap(dest);
+ fz_clear_pixmap(mask);
+ fz_clear_pixmap(dest);
- fz_scanconvert(dev->gel, dev->ael, evenodd, bbox, mask, nil);
+ fz_scan_convert(dev->gel, dev->ael, even_odd, bbox, mask, NULL);
dev->stack[dev->top].scissor = dev->scissor;
dev->stack[dev->top].mask = mask;
@@ -150,17 +150,17 @@ fz_drawclippath(void *user, fz_path *path, int evenodd, fz_matrix ctm)
}
static void
-fz_drawclipstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm)
+fz_draw_clip_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
- float expansion = fz_matrixexpansion(ctm);
+ float expansion = fz_matrix_expansion(ctm);
float flatness = 0.3f / expansion;
float linewidth = stroke->linewidth;
fz_pixmap *mask, *dest;
fz_bbox bbox;
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
@@ -169,24 +169,24 @@ fz_drawclipstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matr
if (linewidth * expansion < 0.1f)
linewidth = 1 / expansion;
- fz_resetgel(dev->gel, dev->scissor);
- if (stroke->dashlen > 0)
- fz_dashpath(dev->gel, path, stroke, ctm, flatness, linewidth);
+ fz_reset_gel(dev->gel, dev->scissor);
+ if (stroke->dash_len > 0)
+ fz_dash_path(dev->gel, path, stroke, ctm, flatness, linewidth);
else
- fz_strokepath(dev->gel, path, stroke, ctm, flatness, linewidth);
- fz_sortgel(dev->gel);
+ fz_stroke_path(dev->gel, path, stroke, ctm, flatness, linewidth);
+ fz_sort_gel(dev->gel);
- bbox = fz_boundgel(dev->gel);
- bbox = fz_intersectbbox(bbox, dev->scissor);
+ bbox = fz_bound_gel(dev->gel);
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
- mask = fz_newpixmapwithrect(nil, bbox);
- dest = fz_newpixmapwithrect(model, bbox);
+ mask = fz_new_pixmap_with_rect(NULL, bbox);
+ dest = fz_new_pixmap_with_rect(model, bbox);
- fz_clearpixmap(mask);
- fz_clearpixmap(dest);
+ fz_clear_pixmap(mask);
+ fz_clear_pixmap(dest);
- if (!fz_isemptyrect(bbox))
- fz_scanconvert(dev->gel, dev->ael, 0, bbox, mask, nil);
+ if (!fz_is_empty_rect(bbox))
+ fz_scan_convert(dev->gel, dev->ael, 0, bbox, mask, NULL);
dev->stack[dev->top].scissor = dev->scissor;
dev->stack[dev->top].mask = mask;
@@ -197,20 +197,20 @@ fz_drawclipstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matr
}
static void
-drawglyph(unsigned char *colorbv, fz_pixmap *dst, fz_pixmap *msk,
+draw_glyph(unsigned char *colorbv, fz_pixmap *dst, fz_pixmap *msk,
int xorig, int yorig, fz_bbox scissor)
{
unsigned char *dp, *mp;
fz_bbox bbox;
int x, y, w, h;
- bbox = fz_boundpixmap(msk);
+ bbox = fz_bound_pixmap(msk);
bbox.x0 += xorig;
bbox.y0 += yorig;
bbox.x1 += xorig;
bbox.y1 += yorig;
- bbox = fz_intersectbbox(bbox, scissor); /* scissor < dst */
+ bbox = fz_intersect_bbox(bbox, scissor); /* scissor < dst */
x = bbox.x0;
y = bbox.y0;
w = bbox.x1 - bbox.x0;
@@ -224,27 +224,27 @@ drawglyph(unsigned char *colorbv, fz_pixmap *dst, fz_pixmap *msk,
while (h--)
{
if (dst->colorspace)
- fz_paintspancolor(dp, mp, dst->n, w, colorbv);
+ fz_paint_span_with_color(dp, mp, dst->n, w, colorbv);
else
- fz_paintspan(dp, mp, 1, w, 255);
+ fz_paint_span(dp, mp, 1, w, 255);
dp += dst->w * dst->n;
mp += msk->w;
}
}
static void
-fz_drawfilltext(void *user, fz_text *text, fz_matrix ctm,
+fz_draw_fill_text(void *user, fz_text *text, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
- unsigned char colorbv[FZ_MAXCOLORS + 1];
- float colorfv[FZ_MAXCOLORS];
+ unsigned char colorbv[FZ_MAX_COLORS + 1];
+ float colorfv[FZ_MAX_COLORS];
fz_matrix tm, trm;
fz_pixmap *glyph;
int i, x, y, gid;
- fz_convertcolor(colorspace, color, model, colorfv);
+ fz_convert_color(colorspace, color, model, colorfv);
for (i = 0; i < model->n; i++)
colorbv[i] = colorfv[i] * 255;
colorbv[i] = alpha * 255;
@@ -253,40 +253,40 @@ fz_drawfilltext(void *user, fz_text *text, fz_matrix ctm,
for (i = 0; i < text->len; i++)
{
- gid = text->els[i].gid;
+ gid = text->items[i].gid;
if (gid < 0)
continue;
- tm.e = text->els[i].x;
- tm.f = text->els[i].y;
+ tm.e = text->items[i].x;
+ tm.f = text->items[i].y;
trm = fz_concat(tm, ctm);
x = floorf(trm.e);
y = floorf(trm.f);
trm.e = QUANT(trm.e - floorf(trm.e), HSUBPIX);
trm.f = QUANT(trm.f - floorf(trm.f), VSUBPIX);
- glyph = fz_renderglyph(dev->cache, text->font, gid, trm);
+ glyph = fz_render_glyph(dev->cache, text->font, gid, trm);
if (glyph)
{
- drawglyph(colorbv, dev->dest, glyph, x, y, dev->scissor);
- fz_droppixmap(glyph);
+ draw_glyph(colorbv, dev->dest, glyph, x, y, dev->scissor);
+ fz_drop_pixmap(glyph);
}
}
}
static void
-fz_drawstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm,
+fz_draw_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
- unsigned char colorbv[FZ_MAXCOLORS + 1];
- float colorfv[FZ_MAXCOLORS];
+ unsigned char colorbv[FZ_MAX_COLORS + 1];
+ float colorfv[FZ_MAX_COLORS];
fz_matrix tm, trm;
fz_pixmap *glyph;
int i, x, y, gid;
- fz_convertcolor(colorspace, color, model, colorfv);
+ fz_convert_color(colorspace, color, model, colorfv);
for (i = 0; i < model->n; i++)
colorbv[i] = colorfv[i] * 255;
colorbv[i] = alpha * 255;
@@ -295,31 +295,31 @@ fz_drawstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix c
for (i = 0; i < text->len; i++)
{
- gid = text->els[i].gid;
+ gid = text->items[i].gid;
if (gid < 0)
continue;
- tm.e = text->els[i].x;
- tm.f = text->els[i].y;
+ tm.e = text->items[i].x;
+ tm.f = text->items[i].y;
trm = fz_concat(tm, ctm);
x = floorf(trm.e);
y = floorf(trm.f);
trm.e = QUANT(trm.e - floorf(trm.e), HSUBPIX);
trm.f = QUANT(trm.f - floorf(trm.f), VSUBPIX);
- glyph = fz_renderstrokedglyph(dev->cache, text->font, gid, trm, ctm, stroke);
+ glyph = fz_render_stroked_glyph(dev->cache, text->font, gid, trm, ctm, stroke);
if (glyph)
{
- drawglyph(colorbv, dev->dest, glyph, x, y, dev->scissor);
- fz_droppixmap(glyph);
+ draw_glyph(colorbv, dev->dest, glyph, x, y, dev->scissor);
+ fz_drop_pixmap(glyph);
}
}
}
static void
-fz_drawcliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate)
+fz_draw_clip_text(void *user, fz_text *text, fz_matrix ctm, int accumulate)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
fz_bbox bbox;
fz_pixmap *mask, *dest;
@@ -331,7 +331,7 @@ fz_drawcliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate)
/* If accumulate == 1 then this text object is the first (or only) in a sequence */
/* If accumulate == 2 then this text object is a continuation */
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
@@ -340,8 +340,8 @@ fz_drawcliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate)
if (accumulate == 0)
{
/* make the mask the exact size needed */
- bbox = fz_roundrect(fz_boundtext(text, ctm));
- bbox = fz_intersectbbox(bbox, dev->scissor);
+ bbox = fz_round_rect(fz_bound_text(text, ctm));
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
}
else
{
@@ -351,11 +351,11 @@ fz_drawcliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate)
if (accumulate == 0 || accumulate == 1)
{
- mask = fz_newpixmapwithrect(nil, bbox);
- dest = fz_newpixmapwithrect(model, bbox);
+ mask = fz_new_pixmap_with_rect(NULL, bbox);
+ dest = fz_new_pixmap_with_rect(model, bbox);
- fz_clearpixmap(mask);
- fz_clearpixmap(dest);
+ fz_clear_pixmap(mask);
+ fz_clear_pixmap(dest);
dev->stack[dev->top].scissor = dev->scissor;
dev->stack[dev->top].mask = mask;
@@ -369,38 +369,38 @@ fz_drawcliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate)
mask = dev->stack[dev->top-1].mask;
}
- if (!fz_isemptyrect(bbox))
+ if (!fz_is_empty_rect(bbox))
{
tm = text->trm;
for (i = 0; i < text->len; i++)
{
- gid = text->els[i].gid;
+ gid = text->items[i].gid;
if (gid < 0)
continue;
- tm.e = text->els[i].x;
- tm.f = text->els[i].y;
+ tm.e = text->items[i].x;
+ tm.f = text->items[i].y;
trm = fz_concat(tm, ctm);
x = floorf(trm.e);
y = floorf(trm.f);
trm.e = QUANT(trm.e - floorf(trm.e), HSUBPIX);
trm.f = QUANT(trm.f - floorf(trm.f), VSUBPIX);
- glyph = fz_renderglyph(dev->cache, text->font, gid, trm);
+ glyph = fz_render_glyph(dev->cache, text->font, gid, trm);
if (glyph)
{
- drawglyph(nil, mask, glyph, x, y, bbox);
- fz_droppixmap(glyph);
+ draw_glyph(NULL, mask, glyph, x, y, bbox);
+ fz_drop_pixmap(glyph);
}
}
}
}
static void
-fz_drawclipstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm)
+fz_draw_clip_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
fz_bbox bbox;
fz_pixmap *mask, *dest;
@@ -408,21 +408,21 @@ fz_drawclipstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matr
fz_pixmap *glyph;
int i, x, y, gid;
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
}
/* make the mask the exact size needed */
- bbox = fz_roundrect(fz_boundtext(text, ctm));
- bbox = fz_intersectbbox(bbox, dev->scissor);
+ bbox = fz_round_rect(fz_bound_text(text, ctm));
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
- mask = fz_newpixmapwithrect(nil, bbox);
- dest = fz_newpixmapwithrect(model, bbox);
+ mask = fz_new_pixmap_with_rect(NULL, bbox);
+ dest = fz_new_pixmap_with_rect(model, bbox);
- fz_clearpixmap(mask);
- fz_clearpixmap(dest);
+ fz_clear_pixmap(mask);
+ fz_clear_pixmap(dest);
dev->stack[dev->top].scissor = dev->scissor;
dev->stack[dev->top].mask = mask;
@@ -431,57 +431,57 @@ fz_drawclipstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matr
dev->dest = dest;
dev->top++;
- if (!fz_isemptyrect(bbox))
+ if (!fz_is_empty_rect(bbox))
{
tm = text->trm;
for (i = 0; i < text->len; i++)
{
- gid = text->els[i].gid;
+ gid = text->items[i].gid;
if (gid < 0)
continue;
- tm.e = text->els[i].x;
- tm.f = text->els[i].y;
+ tm.e = text->items[i].x;
+ tm.f = text->items[i].y;
trm = fz_concat(tm, ctm);
x = floorf(trm.e);
y = floorf(trm.f);
trm.e = QUANT(trm.e - floorf(trm.e), HSUBPIX);
trm.f = QUANT(trm.f - floorf(trm.f), VSUBPIX);
- glyph = fz_renderstrokedglyph(dev->cache, text->font, gid, trm, ctm, stroke);
+ glyph = fz_render_stroked_glyph(dev->cache, text->font, gid, trm, ctm, stroke);
if (glyph)
{
- drawglyph(nil, mask, glyph, x, y, bbox);
- fz_droppixmap(glyph);
+ draw_glyph(NULL, mask, glyph, x, y, bbox);
+ fz_drop_pixmap(glyph);
}
}
}
}
static void
-fz_drawignoretext(void *user, fz_text *text, fz_matrix ctm)
+fz_draw_ignore_text(void *user, fz_text *text, fz_matrix ctm)
{
}
static void
-fz_drawfillshade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
+fz_draw_fill_shade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
fz_pixmap *dest = dev->dest;
fz_rect bounds;
fz_bbox bbox, scissor;
- float colorfv[FZ_MAXCOLORS];
- unsigned char colorbv[FZ_MAXCOLORS + 1];
+ float colorfv[FZ_MAX_COLORS];
+ unsigned char colorbv[FZ_MAX_COLORS + 1];
- bounds = fz_boundshade(shade, ctm);
- bbox = fz_intersectbbox(fz_roundrect(bounds), dev->scissor);
+ bounds = fz_bound_shade(shade, ctm);
+ bbox = fz_intersect_bbox(fz_round_rect(bounds), dev->scissor);
scissor = dev->scissor;
// TODO: proper clip by shade->bbox
- if (fz_isemptyrect(bbox))
+ if (fz_is_empty_rect(bbox))
return;
if (!model)
@@ -492,15 +492,15 @@ fz_drawfillshade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
if (alpha < 1)
{
- dest = fz_newpixmapwithrect(dev->dest->colorspace, bbox);
- fz_clearpixmap(dest);
+ dest = fz_new_pixmap_with_rect(dev->dest->colorspace, bbox);
+ fz_clear_pixmap(dest);
}
- if (shade->usebackground)
+ if (shade->use_background)
{
unsigned char *s;
int x, y, n, i;
- fz_convertcolor(shade->colorspace, shade->background, model, colorfv);
+ fz_convert_color(shade->colorspace, shade->background, model, colorfv);
for (i = 0; i < model->n; i++)
colorbv[i] = colorfv[i] * 255;
colorbv[i] = 255;
@@ -517,26 +517,26 @@ fz_drawfillshade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
}
}
- fz_paintshade(shade, ctm, dest, bbox);
+ fz_paint_shade(shade, ctm, dest, bbox);
if (alpha < 1)
{
- fz_paintpixmap(dev->dest, dest, alpha * 255);
- fz_droppixmap(dest);
+ fz_paint_pixmap(dev->dest, dest, alpha * 255);
+ fz_drop_pixmap(dest);
}
}
static fz_pixmap *
-fz_transformpixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx, int dy)
+fz_transform_pixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx, int dy)
{
fz_pixmap *scaled;
if ((ctm->a != 0) && (ctm->b == 0) && (ctm->c == 0) && (ctm->d != 0))
{
/* Unrotated or X flip or Yflip or XYflip */
- scaled = fz_scalepixmap(image, ctm->e, ctm->f, ctm->a, ctm->d);
- if (scaled == nil)
- return nil;
+ scaled = fz_scale_pixmap(image, ctm->e, ctm->f, ctm->a, ctm->d);
+ if (scaled == NULL)
+ return NULL;
ctm->a = scaled->w;
ctm->d = scaled->h;
ctm->e = scaled->x;
@@ -546,9 +546,9 @@ fz_transformpixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx, int d
if ((ctm->a == 0) && (ctm->b != 0) && (ctm->c != 0) && (ctm->d == 0))
{
/* Other orthogonal flip/rotation cases */
- scaled = fz_scalepixmap(image, ctm->f, ctm->e, ctm->b, ctm->c);
- if (scaled == nil)
- return nil;
+ scaled = fz_scale_pixmap(image, ctm->f, ctm->e, ctm->b, ctm->c);
+ if (scaled == NULL)
+ return NULL;
ctm->b = scaled->w;
ctm->c = scaled->h;
ctm->f = scaled->x;
@@ -558,19 +558,19 @@ fz_transformpixmap(fz_pixmap *image, fz_matrix *ctm, int x, int y, int dx, int d
/* Downscale, non rectilinear case */
if ((dx > 0) && (dy > 0))
{
- scaled = fz_scalepixmap(image, 0, 0, (float)dx, (float)dy);
+ scaled = fz_scale_pixmap(image, 0, 0, (float)dx, (float)dy);
return scaled;
}
- return nil;
+ return NULL;
}
static void
-fz_drawfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
+fz_draw_fill_image(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
- fz_pixmap *converted = nil;
- fz_pixmap *scaled = nil;
+ fz_pixmap *converted = NULL;
+ fz_pixmap *scaled = NULL;
int after;
int dx, dy;
@@ -588,13 +588,13 @@ fz_drawfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
/* convert images with expensive colorspace transforms after scaling */
after = 0;
- if (image->colorspace == fz_devicegray)
+ if (image->colorspace == fz_device_gray)
after = 1;
if (image->colorspace != model && !after)
{
- converted = fz_newpixmap(model, image->x, image->y, image->w, image->h);
- fz_convertpixmap(image, converted);
+ converted = fz_new_pixmap(model, image->x, image->y, image->w, image->h);
+ fz_convert_pixmap(image, converted);
image = converted;
}
@@ -602,43 +602,43 @@ fz_drawfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d);
if (dx < image->w && dy < image->h)
{
- scaled = fz_transformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
- if (scaled == nil)
+ scaled = fz_transform_pixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
+ if (scaled == NULL)
{
if (dx < 1)
dx = 1;
if (dy < 1)
dy = 1;
- scaled = fz_scalepixmap(image, image->x, image->y, dx, dy);
+ scaled = fz_scale_pixmap(image, image->x, image->y, dx, dy);
}
- if (scaled != nil)
+ if (scaled != NULL)
image = scaled;
}
if (image->colorspace != model && after)
{
- converted = fz_newpixmap(model, image->x, image->y, image->w, image->h);
- fz_convertpixmap(image, converted);
+ converted = fz_new_pixmap(model, image->x, image->y, image->w, image->h);
+ fz_convert_pixmap(image, converted);
image = converted;
}
- fz_paintimage(dev->dest, dev->scissor, image, ctm, alpha * 255);
+ fz_paint_image(dev->dest, dev->scissor, image, ctm, alpha * 255);
if (scaled)
- fz_droppixmap(scaled);
+ fz_drop_pixmap(scaled);
if (converted)
- fz_droppixmap(converted);
+ fz_drop_pixmap(converted);
}
static void
-fz_drawfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm,
+fz_draw_fill_image_mask(void *user, fz_pixmap *image, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
- unsigned char colorbv[FZ_MAXCOLORS + 1];
- float colorfv[FZ_MAXCOLORS];
- fz_pixmap *scaled = nil;
+ unsigned char colorbv[FZ_MAX_COLORS + 1];
+ float colorfv[FZ_MAX_COLORS];
+ fz_pixmap *scaled = NULL;
int dx, dy;
int i;
@@ -649,41 +649,41 @@ fz_drawfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm,
dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d);
if (dx < image->w && dy < image->h)
{
- scaled = fz_transformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
- if (scaled == nil)
+ scaled = fz_transform_pixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
+ if (scaled == NULL)
{
if (dx < 1)
dx = 1;
if (dy < 1)
dy = 1;
- scaled = fz_scalepixmap(image, image->x, image->y, dx, dy);
+ scaled = fz_scale_pixmap(image, image->x, image->y, dx, dy);
}
- if (scaled != nil)
+ if (scaled != NULL)
image = scaled;
}
- fz_convertcolor(colorspace, color, model, colorfv);
+ fz_convert_color(colorspace, color, model, colorfv);
for (i = 0; i < model->n; i++)
colorbv[i] = colorfv[i] * 255;
colorbv[i] = alpha * 255;
- fz_paintimagecolor(dev->dest, dev->scissor, image, ctm, colorbv);
+ fz_paint_image_with_color(dev->dest, dev->scissor, image, ctm, colorbv);
if (scaled)
- fz_droppixmap(scaled);
+ fz_drop_pixmap(scaled);
}
static void
-fz_drawclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm)
+fz_draw_clip_image_mask(void *user, fz_pixmap *image, fz_matrix ctm)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
fz_bbox bbox;
fz_pixmap *mask, *dest;
- fz_pixmap *scaled = nil;
+ fz_pixmap *scaled = NULL;
int dx, dy;
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
@@ -692,43 +692,43 @@ fz_drawclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm)
if (image->w == 0 || image->h == 0)
{
dev->stack[dev->top].scissor = dev->scissor;
- dev->stack[dev->top].mask = nil;
- dev->stack[dev->top].dest = nil;
- dev->scissor = fz_emptybbox;
+ dev->stack[dev->top].mask = NULL;
+ dev->stack[dev->top].dest = NULL;
+ dev->scissor = fz_empty_bbox;
dev->top++;
return;
}
- bbox = fz_roundrect(fz_transformrect(ctm, fz_unitrect));
- bbox = fz_intersectbbox(bbox, dev->scissor);
+ bbox = fz_round_rect(fz_transform_rect(ctm, fz_unit_rect));
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
- mask = fz_newpixmapwithrect(nil, bbox);
- dest = fz_newpixmapwithrect(model, bbox);
+ mask = fz_new_pixmap_with_rect(NULL, bbox);
+ dest = fz_new_pixmap_with_rect(model, bbox);
- fz_clearpixmap(mask);
- fz_clearpixmap(dest);
+ fz_clear_pixmap(mask);
+ fz_clear_pixmap(dest);
dx = sqrtf(ctm.a * ctm.a + ctm.b * ctm.b);
dy = sqrtf(ctm.c * ctm.c + ctm.d * ctm.d);
if (dx < image->w && dy < image->h)
{
- scaled = fz_transformpixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
- if (scaled == nil)
+ scaled = fz_transform_pixmap(image, &ctm, dev->dest->x, dev->dest->y, dx, dy);
+ if (scaled == NULL)
{
if (dx < 1)
dx = 1;
if (dy < 1)
dy = 1;
- scaled = fz_scalepixmap(image, image->x, image->y, dx, dy);
+ scaled = fz_scale_pixmap(image, image->x, image->y, dx, dy);
}
- if (scaled != nil)
+ if (scaled != NULL)
image = scaled;
}
- fz_paintimage(mask, bbox, image, ctm, 255);
+ fz_paint_image(mask, bbox, image, ctm, 255);
if (scaled)
- fz_droppixmap(scaled);
+ fz_drop_pixmap(scaled);
dev->stack[dev->top].scissor = dev->scissor;
dev->stack[dev->top].mask = mask;
@@ -739,9 +739,9 @@ fz_drawclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm)
}
static void
-fz_drawpopclip(void *user)
+fz_draw_pop_clip(void *user)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_pixmap *mask, *dest;
if (dev->top > 0)
{
@@ -752,41 +752,41 @@ fz_drawpopclip(void *user)
if (mask && dest)
{
fz_pixmap *scratch = dev->dest;
- fz_paintpixmapmask(dest, scratch, mask);
- fz_droppixmap(mask);
- fz_droppixmap(scratch);
+ fz_paint_pixmap_with_mask(dest, scratch, mask);
+ fz_drop_pixmap(mask);
+ fz_drop_pixmap(scratch);
dev->dest = dest;
}
}
}
static void
-fz_drawbeginmask(void *user, fz_rect rect, int luminosity, fz_colorspace *colorspace, float *colorfv)
+fz_draw_begin_mask(void *user, fz_rect rect, int luminosity, fz_colorspace *colorspace, float *colorfv)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_pixmap *dest;
fz_bbox bbox;
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
}
- bbox = fz_roundrect(rect);
- bbox = fz_intersectbbox(bbox, dev->scissor);
- dest = fz_newpixmapwithrect(fz_devicegray, bbox);
+ bbox = fz_round_rect(rect);
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
+ dest = fz_new_pixmap_with_rect(fz_device_gray, bbox);
if (luminosity)
{
float bc;
if (!colorspace)
- colorspace = fz_devicegray;
- fz_convertcolor(colorspace, colorfv, fz_devicegray, &bc);
- fz_clearpixmapwithcolor(dest, bc * 255);
+ colorspace = fz_device_gray;
+ fz_convert_color(colorspace, colorfv, fz_device_gray, &bc);
+ fz_clear_pixmap_with_color(dest, bc * 255);
}
else
- fz_clearpixmap(dest);
+ fz_clear_pixmap(dest);
dev->stack[dev->top].scissor = dev->scissor;
dev->stack[dev->top].dest = dev->dest;
@@ -798,15 +798,15 @@ fz_drawbeginmask(void *user, fz_rect rect, int luminosity, fz_colorspace *colors
}
static void
-fz_drawendmask(void *user)
+fz_draw_end_mask(void *user)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_pixmap *mask = dev->dest;
fz_pixmap *temp, *dest;
fz_bbox bbox;
int luminosity;
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
@@ -821,13 +821,13 @@ fz_drawendmask(void *user)
dev->dest = dev->stack[dev->top].dest;
/* convert to alpha mask */
- temp = fz_alphafromgray(mask, luminosity);
- fz_droppixmap(mask);
+ temp = fz_alpha_from_gray(mask, luminosity);
+ fz_drop_pixmap(mask);
/* create new dest scratch buffer */
- bbox = fz_boundpixmap(temp);
- dest = fz_newpixmapwithrect(dev->dest->colorspace, bbox);
- fz_clearpixmap(dest);
+ bbox = fz_bound_pixmap(temp);
+ dest = fz_new_pixmap_with_rect(dev->dest->colorspace, bbox);
+ fz_clear_pixmap(dest);
/* push soft mask as clip mask */
dev->stack[dev->top].scissor = dev->scissor;
@@ -840,24 +840,24 @@ fz_drawendmask(void *user)
}
static void
-fz_drawbegingroup(void *user, fz_rect rect, int isolated, int knockout, fz_blendmode blendmode, float alpha)
+fz_draw_begin_group(void *user, fz_rect rect, int isolated, int knockout, fz_blendmode blendmode, float alpha)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
fz_bbox bbox;
fz_pixmap *dest;
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
}
- bbox = fz_roundrect(rect);
- bbox = fz_intersectbbox(bbox, dev->scissor);
- dest = fz_newpixmapwithrect(model, bbox);
+ bbox = fz_round_rect(rect);
+ bbox = fz_intersect_bbox(bbox, dev->scissor);
+ dest = fz_new_pixmap_with_rect(model, bbox);
- fz_clearpixmap(dest);
+ fz_clear_pixmap(dest);
dev->stack[dev->top].alpha = alpha;
dev->stack[dev->top].blendmode = blendmode;
@@ -870,9 +870,9 @@ fz_drawbegingroup(void *user, fz_rect rect, int isolated, int knockout, fz_blend
}
static void
-fz_drawendgroup(void *user)
+fz_draw_end_group(void *user)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_pixmap *group = dev->dest;
fz_blendmode blendmode;
float alpha;
@@ -885,19 +885,19 @@ fz_drawendgroup(void *user)
dev->dest = dev->stack[dev->top].dest;
dev->scissor = dev->stack[dev->top].scissor;
- if (blendmode == FZ_BNORMAL)
- fz_paintpixmap(dev->dest, group, alpha * 255);
+ if (blendmode == FZ_BLEND_NORMAL)
+ fz_paint_pixmap(dev->dest, group, alpha * 255);
else
- fz_blendpixmap(dev->dest, group, alpha * 255, blendmode);
+ fz_blend_pixmap(dev->dest, group, alpha * 255, blendmode);
- fz_droppixmap(group);
+ fz_drop_pixmap(group);
}
}
static void
-fz_drawbegintile(void *user, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm)
+fz_draw_begin_tile(void *user, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_colorspace *model = dev->dest->colorspace;
fz_pixmap *dest;
fz_bbox bbox;
@@ -905,15 +905,15 @@ fz_drawbegintile(void *user, fz_rect area, fz_rect view, float xstep, float yste
/* area, view, xstep, ystep are in pattern space */
/* ctm maps from pattern space to device space */
- if (dev->top == STACKSIZE)
+ if (dev->top == STACK_SIZE)
{
fz_warn("assert: too many buffers on stack");
return;
}
- bbox = fz_roundrect(fz_transformrect(ctm, view));
- dest = fz_newpixmapwithrect(model, bbox);
- fz_clearpixmap(dest);
+ bbox = fz_round_rect(fz_transform_rect(ctm, view));
+ dest = fz_new_pixmap_with_rect(model, bbox);
+ fz_clear_pixmap(dest);
dev->stack[dev->top].scissor = dev->scissor;
dev->stack[dev->top].dest = dev->dest;
@@ -928,9 +928,9 @@ fz_drawbegintile(void *user, fz_rect area, fz_rect view, float xstep, float yste
}
static void
-fz_drawendtile(void *user)
+fz_draw_end_tile(void *user)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
fz_pixmap *tile = dev->dest;
float xstep, ystep;
fz_matrix ctm, ttm;
@@ -962,32 +962,32 @@ fz_drawendtile(void *user)
ttm = fz_concat(fz_translate(x * xstep, y * ystep), ctm);
tile->x = ttm.e;
tile->y = ttm.f;
- fz_paintpixmapbbox(dev->dest, tile, 255, dev->scissor);
+ fz_paint_pixmap_with_rect(dev->dest, tile, 255, dev->scissor);
}
}
- fz_droppixmap(tile);
+ fz_drop_pixmap(tile);
}
}
static void
-fz_drawfreeuser(void *user)
+fz_draw_free_user(void *user)
{
- fz_drawdevice *dev = user;
+ fz_draw_device *dev = user;
/* TODO: pop and free the stacks */
- fz_freegel(dev->gel);
- fz_freeael(dev->ael);
+ fz_free_gel(dev->gel);
+ fz_free_ael(dev->ael);
fz_free(dev);
}
fz_device *
-fz_newdrawdevice(fz_glyphcache *cache, fz_pixmap *dest)
+fz_new_draw_device(fz_glyph_cache *cache, fz_pixmap *dest)
{
fz_device *dev;
- fz_drawdevice *ddev = fz_malloc(sizeof(fz_drawdevice));
+ fz_draw_device *ddev = fz_malloc(sizeof(fz_draw_device));
ddev->cache = cache;
- ddev->gel = fz_newgel();
- ddev->ael = fz_newael();
+ ddev->gel = fz_new_gel();
+ ddev->ael = fz_new_ael();
ddev->dest = dest;
ddev->top = 0;
@@ -996,34 +996,34 @@ fz_newdrawdevice(fz_glyphcache *cache, fz_pixmap *dest)
ddev->scissor.x1 = dest->x + dest->w;
ddev->scissor.y1 = dest->y + dest->h;
- dev = fz_newdevice(ddev);
- dev->freeuser = fz_drawfreeuser;
+ dev = fz_new_device(ddev);
+ dev->free_user = fz_draw_free_user;
- dev->fillpath = fz_drawfillpath;
- dev->strokepath = fz_drawstrokepath;
- dev->clippath = fz_drawclippath;
- dev->clipstrokepath = fz_drawclipstrokepath;
+ dev->fill_path = fz_draw_fill_path;
+ dev->stroke_path = fz_draw_stroke_path;
+ dev->clip_path = fz_draw_clip_path;
+ dev->clip_stroke_path = fz_draw_clip_stroke_path;
- dev->filltext = fz_drawfilltext;
- dev->stroketext = fz_drawstroketext;
- dev->cliptext = fz_drawcliptext;
- dev->clipstroketext = fz_drawclipstroketext;
- dev->ignoretext = fz_drawignoretext;
+ dev->fill_text = fz_draw_fill_text;
+ dev->stroke_text = fz_draw_stroke_text;
+ dev->clip_text = fz_draw_clip_text;
+ dev->clip_stroke_text = fz_draw_clip_stroke_text;
+ dev->ignore_text = fz_draw_ignore_text;
- dev->fillimagemask = fz_drawfillimagemask;
- dev->clipimagemask = fz_drawclipimagemask;
- dev->fillimage = fz_drawfillimage;
- dev->fillshade = fz_drawfillshade;
+ dev->fill_image_mask = fz_draw_fill_image_mask;
+ dev->clip_image_mask = fz_draw_clip_image_mask;
+ dev->fill_image = fz_draw_fill_image;
+ dev->fill_shade = fz_draw_fill_shade;
- dev->popclip = fz_drawpopclip;
+ dev->pop_clip = fz_draw_pop_clip;
- dev->beginmask = fz_drawbeginmask;
- dev->endmask = fz_drawendmask;
- dev->begingroup = fz_drawbegingroup;
- dev->endgroup = fz_drawendgroup;
+ dev->begin_mask = fz_draw_begin_mask;
+ dev->end_mask = fz_draw_end_mask;
+ dev->begin_group = fz_draw_begin_group;
+ dev->end_group = fz_draw_end_group;
- dev->begintile = fz_drawbegintile;
- dev->endtile = fz_drawendtile;
+ dev->begin_tile = fz_draw_begin_tile;
+ dev->end_tile = fz_draw_end_tile;
return dev;
}
diff --git a/fitz/dev_list.c b/fitz/dev_list.c
index 2bba6ed3..d9293dc4 100644
--- a/fitz/dev_list.c
+++ b/fitz/dev_list.c
@@ -3,24 +3,24 @@
#define ISOLATED 1
#define KNOCKOUT 2
-static fz_displaynode *
-fz_newdisplaynode(fz_displaycommand cmd, fz_matrix ctm,
+static fz_display_node *
+fz_new_display_node(fz_display_command cmd, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_displaynode *node;
+ fz_display_node *node;
int i;
- node = fz_malloc(sizeof(fz_displaynode));
+ node = fz_malloc(sizeof(fz_display_node));
node->cmd = cmd;
- node->next = nil;
- node->rect = fz_emptyrect;
- node->item.path = nil;
- node->stroke = nil;
+ node->next = NULL;
+ node->rect = fz_empty_rect;
+ node->item.path = NULL;
+ node->stroke = NULL;
node->flag = 0;
node->ctm = ctm;
if (colorspace)
{
- node->colorspace = fz_keepcolorspace(colorspace);
+ node->colorspace = fz_keep_colorspace(colorspace);
if (color)
{
for (i = 0; i < node->colorspace->n; i++)
@@ -29,23 +29,23 @@ fz_newdisplaynode(fz_displaycommand cmd, fz_matrix ctm,
}
else
{
- node->colorspace = nil;
+ node->colorspace = NULL;
}
node->alpha = alpha;
return node;
}
-static fz_strokestate *
-fz_clonestrokestate(fz_strokestate *stroke)
+static fz_stroke_state *
+fz_clone_stroke_state(fz_stroke_state *stroke)
{
- fz_strokestate *newstroke = fz_malloc(sizeof(fz_strokestate));
+ fz_stroke_state *newstroke = fz_malloc(sizeof(fz_stroke_state));
*newstroke = *stroke;
return newstroke;
}
static void
-fz_appenddisplaynode(fz_displaylist *list, fz_displaynode *node)
+fz_append_display_node(fz_display_list *list, fz_display_node *node)
{
if (!list->first)
{
@@ -60,244 +60,244 @@ fz_appenddisplaynode(fz_displaylist *list, fz_displaynode *node)
}
static void
-fz_freedisplaynode(fz_displaynode *node)
+fz_free_display_node(fz_display_node *node)
{
switch (node->cmd)
{
- case FZ_CMDFILLPATH:
- case FZ_CMDSTROKEPATH:
- case FZ_CMDCLIPPATH:
- case FZ_CMDCLIPSTROKEPATH:
- fz_freepath(node->item.path);
+ case FZ_CMD_FILL_PATH:
+ case FZ_CMD_STROKE_PATH:
+ case FZ_CMD_CLIP_PATH:
+ case FZ_CMD_CLIP_STROKE_PATH:
+ fz_free_path(node->item.path);
break;
- case FZ_CMDFILLTEXT:
- case FZ_CMDSTROKETEXT:
- case FZ_CMDCLIPTEXT:
- case FZ_CMDCLIPSTROKETEXT:
- case FZ_CMDIGNORETEXT:
- fz_freetext(node->item.text);
+ case FZ_CMD_FILL_TEXT:
+ case FZ_CMD_STROKE_TEXT:
+ case FZ_CMD_CLIP_TEXT:
+ case FZ_CMD_CLIP_STROKE_TEXT:
+ case FZ_CMD_IGNORE_TEXT:
+ fz_free_text(node->item.text);
break;
- case FZ_CMDFILLSHADE:
- fz_dropshade(node->item.shade);
+ case FZ_CMD_FILL_SHADE:
+ fz_drop_shade(node->item.shade);
break;
- case FZ_CMDFILLIMAGE:
- case FZ_CMDFILLIMAGEMASK:
- case FZ_CMDCLIPIMAGEMASK:
- fz_droppixmap(node->item.image);
+ case FZ_CMD_FILL_IMAGE:
+ case FZ_CMD_FILL_IMAGE_MASK:
+ case FZ_CMD_CLIP_IMAGE_MASK:
+ fz_drop_pixmap(node->item.image);
break;
- case FZ_CMDPOPCLIP:
- case FZ_CMDBEGINMASK:
- case FZ_CMDENDMASK:
- case FZ_CMDBEGINGROUP:
- case FZ_CMDENDGROUP:
- case FZ_CMDBEGINTILE:
- case FZ_CMDENDTILE:
+ case FZ_CMD_POP_CLIP:
+ case FZ_CMD_BEGIN_MASK:
+ case FZ_CMD_END_MASK:
+ case FZ_CMD_BEGIN_GROUP:
+ case FZ_CMD_END_GROUP:
+ case FZ_CMD_BEGIN_TILE:
+ case FZ_CMD_END_TILE:
break;
}
if (node->stroke)
fz_free(node->stroke);
if (node->colorspace)
- fz_dropcolorspace(node->colorspace);
+ fz_drop_colorspace(node->colorspace);
fz_free(node);
}
static void
-fz_listfillpath(void *user, fz_path *path, int evenodd, fz_matrix ctm,
+fz_list_fill_path(void *user, fz_path *path, int even_odd, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDFILLPATH, ctm, colorspace, color, alpha);
- node->rect = fz_boundpath(path, nil, ctm);
- node->item.path = fz_clonepath(path);
- node->flag = evenodd;
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_FILL_PATH, ctm, colorspace, color, alpha);
+ node->rect = fz_bound_path(path, NULL, ctm);
+ node->item.path = fz_clone_path(path);
+ node->flag = even_odd;
+ fz_append_display_node(user, node);
}
static void
-fz_liststrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm,
+fz_list_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDSTROKEPATH, ctm, colorspace, color, alpha);
- node->rect = fz_boundpath(path, stroke, ctm);
- node->item.path = fz_clonepath(path);
- node->stroke = fz_clonestrokestate(stroke);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_STROKE_PATH, ctm, colorspace, color, alpha);
+ node->rect = fz_bound_path(path, stroke, ctm);
+ node->item.path = fz_clone_path(path);
+ node->stroke = fz_clone_stroke_state(stroke);
+ fz_append_display_node(user, node);
}
static void
-fz_listclippath(void *user, fz_path *path, int evenodd, fz_matrix ctm)
+fz_list_clip_path(void *user, fz_path *path, int even_odd, fz_matrix ctm)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDCLIPPATH, ctm, nil, nil, 0);
- node->rect = fz_boundpath(path, nil, ctm);
- node->item.path = fz_clonepath(path);
- node->flag = evenodd;
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_CLIP_PATH, ctm, NULL, NULL, 0);
+ node->rect = fz_bound_path(path, NULL, ctm);
+ node->item.path = fz_clone_path(path);
+ node->flag = even_odd;
+ fz_append_display_node(user, node);
}
static void
-fz_listclipstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm)
+fz_list_clip_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDCLIPSTROKEPATH, ctm, nil, nil, 0);
- node->rect = fz_boundpath(path, stroke, ctm);
- node->item.path = fz_clonepath(path);
- node->stroke = fz_clonestrokestate(stroke);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_CLIP_STROKE_PATH, ctm, NULL, NULL, 0);
+ node->rect = fz_bound_path(path, stroke, ctm);
+ node->item.path = fz_clone_path(path);
+ node->stroke = fz_clone_stroke_state(stroke);
+ fz_append_display_node(user, node);
}
static void
-fz_listfilltext(void *user, fz_text *text, fz_matrix ctm,
+fz_list_fill_text(void *user, fz_text *text, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDFILLTEXT, ctm, colorspace, color, alpha);
- node->rect = fz_boundtext(text, ctm);
- node->item.text = fz_clonetext(text);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_FILL_TEXT, ctm, colorspace, color, alpha);
+ node->rect = fz_bound_text(text, ctm);
+ node->item.text = fz_clone_text(text);
+ fz_append_display_node(user, node);
}
static void
-fz_liststroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm,
+fz_list_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDSTROKETEXT, ctm, colorspace, color, alpha);
- node->rect = fz_boundtext(text, ctm);
- node->item.text = fz_clonetext(text);
- node->stroke = fz_clonestrokestate(stroke);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_STROKE_TEXT, ctm, colorspace, color, alpha);
+ node->rect = fz_bound_text(text, ctm);
+ node->item.text = fz_clone_text(text);
+ node->stroke = fz_clone_stroke_state(stroke);
+ fz_append_display_node(user, node);
}
static void
-fz_listcliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate)
+fz_list_clip_text(void *user, fz_text *text, fz_matrix ctm, int accumulate)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDCLIPTEXT, ctm, nil, nil, 0);
- node->rect = fz_boundtext(text, ctm);
- node->item.text = fz_clonetext(text);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_CLIP_TEXT, ctm, NULL, NULL, 0);
+ node->rect = fz_bound_text(text, ctm);
+ node->item.text = fz_clone_text(text);
node->flag = accumulate;
/* when accumulating, be conservative about culling */
if (accumulate)
- node->rect = fz_infiniterect;
- fz_appenddisplaynode(user, node);
+ node->rect = fz_infinite_rect;
+ fz_append_display_node(user, node);
}
static void
-fz_listclipstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm)
+fz_list_clip_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDCLIPSTROKETEXT, ctm, nil, nil, 0);
- node->rect = fz_boundtext(text, ctm);
- node->item.text = fz_clonetext(text);
- node->stroke = fz_clonestrokestate(stroke);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_CLIP_STROKE_TEXT, ctm, NULL, NULL, 0);
+ node->rect = fz_bound_text(text, ctm);
+ node->item.text = fz_clone_text(text);
+ node->stroke = fz_clone_stroke_state(stroke);
+ fz_append_display_node(user, node);
}
static void
-fz_listignoretext(void *user, fz_text *text, fz_matrix ctm)
+fz_list_ignore_text(void *user, fz_text *text, fz_matrix ctm)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDIGNORETEXT, ctm, nil, nil, 0);
- node->rect = fz_boundtext(text, ctm);
- node->item.text = fz_clonetext(text);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_IGNORE_TEXT, ctm, NULL, NULL, 0);
+ node->rect = fz_bound_text(text, ctm);
+ node->item.text = fz_clone_text(text);
+ fz_append_display_node(user, node);
}
static void
-fz_listpopclip(void *user)
+fz_list_pop_clip(void *user)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDPOPCLIP, fz_identity, nil, nil, 0);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_POP_CLIP, fz_identity, NULL, NULL, 0);
/* TODO: scan back for matching pushclip and calculate bbox of contents */
- fz_appenddisplaynode(user, node);
+ fz_append_display_node(user, node);
}
static void
-fz_listfillshade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
+fz_list_fill_shade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDFILLSHADE, ctm, nil, nil, alpha);
- node->rect = fz_boundshade(shade, ctm);
- node->item.shade = fz_keepshade(shade);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_FILL_SHADE, ctm, NULL, NULL, alpha);
+ node->rect = fz_bound_shade(shade, ctm);
+ node->item.shade = fz_keep_shade(shade);
+ fz_append_display_node(user, node);
}
static void
-fz_listfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
+fz_list_fill_image(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDFILLIMAGE, ctm, nil, nil, alpha);
- node->rect = fz_transformrect(ctm, fz_unitrect);
- node->item.image = fz_keeppixmap(image);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_FILL_IMAGE, ctm, NULL, NULL, alpha);
+ node->rect = fz_transform_rect(ctm, fz_unit_rect);
+ node->item.image = fz_keep_pixmap(image);
+ fz_append_display_node(user, node);
}
static void
-fz_listfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm,
+fz_list_fill_image_mask(void *user, fz_pixmap *image, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDFILLIMAGEMASK, ctm, colorspace, color, alpha);
- node->rect = fz_transformrect(ctm, fz_unitrect);
- node->item.image = fz_keeppixmap(image);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_FILL_IMAGE_MASK, ctm, colorspace, color, alpha);
+ node->rect = fz_transform_rect(ctm, fz_unit_rect);
+ node->item.image = fz_keep_pixmap(image);
+ fz_append_display_node(user, node);
}
static void
-fz_listclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm)
+fz_list_clip_image_mask(void *user, fz_pixmap *image, fz_matrix ctm)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDCLIPIMAGEMASK, ctm, nil, nil, 0);
- node->rect = fz_transformrect(ctm, fz_unitrect);
- node->item.image = fz_keeppixmap(image);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_CLIP_IMAGE_MASK, ctm, NULL, NULL, 0);
+ node->rect = fz_transform_rect(ctm, fz_unit_rect);
+ node->item.image = fz_keep_pixmap(image);
+ fz_append_display_node(user, node);
}
static void
-fz_listbeginmask(void *user, fz_rect rect, int luminosity, fz_colorspace *colorspace, float *color)
+fz_list_begin_mask(void *user, fz_rect rect, int luminosity, fz_colorspace *colorspace, float *color)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDBEGINMASK, fz_identity, colorspace, color, 0);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_BEGIN_MASK, fz_identity, colorspace, color, 0);
node->rect = rect;
node->flag = luminosity;
- fz_appenddisplaynode(user, node);
+ fz_append_display_node(user, node);
}
static void
-fz_listendmask(void *user)
+fz_list_end_mask(void *user)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDENDMASK, fz_identity, nil, nil, 0);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_END_MASK, fz_identity, NULL, NULL, 0);
+ fz_append_display_node(user, node);
}
static void
-fz_listbegingroup(void *user, fz_rect rect, int isolated, int knockout, fz_blendmode blendmode, float alpha)
+fz_list_begin_group(void *user, fz_rect rect, int isolated, int knockout, fz_blendmode blendmode, float alpha)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDBEGINGROUP, fz_identity, nil, nil, alpha);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_BEGIN_GROUP, fz_identity, NULL, NULL, alpha);
node->rect = rect;
node->item.blendmode = blendmode;
node->flag |= isolated ? ISOLATED : 0;
node->flag |= knockout ? KNOCKOUT : 0;
- fz_appenddisplaynode(user, node);
+ fz_append_display_node(user, node);
}
static void
-fz_listendgroup(void *user)
+fz_list_end_group(void *user)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDENDGROUP, fz_identity, nil, nil, 0);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_END_GROUP, fz_identity, NULL, NULL, 0);
+ fz_append_display_node(user, node);
}
static void
-fz_listbegintile(void *user, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm)
+fz_list_begin_tile(void *user, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDBEGINTILE, ctm, nil, nil, 0);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_BEGIN_TILE, ctm, NULL, NULL, 0);
node->rect = area;
node->color[0] = xstep;
node->color[1] = ystep;
@@ -305,82 +305,82 @@ fz_listbegintile(void *user, fz_rect area, fz_rect view, float xstep, float yste
node->color[3] = view.y0;
node->color[4] = view.x1;
node->color[5] = view.y1;
- fz_appenddisplaynode(user, node);
+ fz_append_display_node(user, node);
}
static void
-fz_listendtile(void *user)
+fz_list_end_tile(void *user)
{
- fz_displaynode *node;
- node = fz_newdisplaynode(FZ_CMDENDTILE, fz_identity, nil, nil, 0);
- fz_appenddisplaynode(user, node);
+ fz_display_node *node;
+ node = fz_new_display_node(FZ_CMD_END_TILE, fz_identity, NULL, NULL, 0);
+ fz_append_display_node(user, node);
}
fz_device *
-fz_newlistdevice(fz_displaylist *list)
+fz_new_list_device(fz_display_list *list)
{
- fz_device *dev = fz_newdevice(list);
+ fz_device *dev = fz_new_device(list);
- dev->fillpath = fz_listfillpath;
- dev->strokepath = fz_liststrokepath;
- dev->clippath = fz_listclippath;
- dev->clipstrokepath = fz_listclipstrokepath;
+ dev->fill_path = fz_list_fill_path;
+ dev->stroke_path = fz_list_stroke_path;
+ dev->clip_path = fz_list_clip_path;
+ dev->clip_stroke_path = fz_list_clip_stroke_path;
- dev->filltext = fz_listfilltext;
- dev->stroketext = fz_liststroketext;
- dev->cliptext = fz_listcliptext;
- dev->clipstroketext = fz_listclipstroketext;
- dev->ignoretext = fz_listignoretext;
+ dev->fill_text = fz_list_fill_text;
+ dev->stroke_text = fz_list_stroke_text;
+ dev->clip_text = fz_list_clip_text;
+ dev->clip_stroke_text = fz_list_clip_stroke_text;
+ dev->ignore_text = fz_list_ignore_text;
- dev->fillshade = fz_listfillshade;
- dev->fillimage = fz_listfillimage;
- dev->fillimagemask = fz_listfillimagemask;
- dev->clipimagemask = fz_listclipimagemask;
+ dev->fill_shade = fz_list_fill_shade;
+ dev->fill_image = fz_list_fill_image;
+ dev->fill_image_mask = fz_list_fill_image_mask;
+ dev->clip_image_mask = fz_list_clip_image_mask;
- dev->popclip = fz_listpopclip;
+ dev->pop_clip = fz_list_pop_clip;
- dev->beginmask = fz_listbeginmask;
- dev->endmask = fz_listendmask;
- dev->begingroup = fz_listbegingroup;
- dev->endgroup = fz_listendgroup;
+ dev->begin_mask = fz_list_begin_mask;
+ dev->end_mask = fz_list_end_mask;
+ dev->begin_group = fz_list_begin_group;
+ dev->end_group = fz_list_end_group;
- dev->begintile = fz_listbegintile;
- dev->endtile = fz_listendtile;
+ dev->begin_tile = fz_list_begin_tile;
+ dev->end_tile = fz_list_end_tile;
return dev;
}
-fz_displaylist *
-fz_newdisplaylist(void)
+fz_display_list *
+fz_new_display_list(void)
{
- fz_displaylist *list = fz_malloc(sizeof(fz_displaylist));
- list->first = nil;
- list->last = nil;
+ fz_display_list *list = fz_malloc(sizeof(fz_display_list));
+ list->first = NULL;
+ list->last = NULL;
return list;
}
void
-fz_freedisplaylist(fz_displaylist *list)
+fz_free_display_list(fz_display_list *list)
{
- fz_displaynode *node = list->first;
+ fz_display_node *node = list->first;
while (node)
{
- fz_displaynode *next = node->next;
- fz_freedisplaynode(node);
+ fz_display_node *next = node->next;
+ fz_free_display_node(node);
node = next;
}
fz_free(list);
}
void
-fz_executedisplaylist(fz_displaylist *list, fz_device *dev, fz_matrix topctm, fz_bbox bounds)
+fz_execute_display_list(fz_display_list *list, fz_device *dev, fz_matrix top_ctm, fz_bbox bounds)
{
- fz_displaynode *node;
+ fz_display_node *node;
fz_rect bbox;
int clipped = 0;
int tiled = 0;
- if (!fz_isinfinitebbox(bounds))
+ if (!fz_is_infinite_bbox(bounds))
{
/* add some fuzz at the edges, as especially glyph rects
* are sometimes not actually completely bounding the glyph */
@@ -390,40 +390,40 @@ fz_executedisplaylist(fz_displaylist *list, fz_device *dev, fz_matrix topctm, fz
for (node = list->first; node; node = node->next)
{
- fz_matrix ctm = fz_concat(node->ctm, topctm);
- fz_rect rect = fz_transformrect(topctm, node->rect);
+ fz_matrix ctm = fz_concat(node->ctm, top_ctm);
+ fz_rect rect = fz_transform_rect(top_ctm, node->rect);
/* never skip tiles */
if (tiled)
goto visible;
/* cull objects to draw using a quick visibility test */
- if (clipped || fz_isemptybbox(fz_intersectbbox(fz_roundrect(rect), bounds)))
+ if (clipped || fz_is_empty_bbox(fz_intersect_bbox(fz_round_rect(rect), bounds)))
{
switch (node->cmd)
{
- case FZ_CMDBEGINTILE:
+ case FZ_CMD_BEGIN_TILE:
tiled++;
goto visible;
- case FZ_CMDENDTILE:
+ case FZ_CMD_END_TILE:
tiled--;
goto visible;
- case FZ_CMDCLIPPATH:
- case FZ_CMDCLIPSTROKEPATH:
- case FZ_CMDCLIPTEXT:
- case FZ_CMDCLIPSTROKETEXT:
- case FZ_CMDCLIPIMAGEMASK:
- case FZ_CMDBEGINMASK:
- case FZ_CMDBEGINGROUP:
+ case FZ_CMD_CLIP_PATH:
+ case FZ_CMD_CLIP_STROKE_PATH:
+ case FZ_CMD_CLIP_TEXT:
+ case FZ_CMD_CLIP_STROKE_TEXT:
+ case FZ_CMD_CLIP_IMAGE_MASK:
+ case FZ_CMD_BEGIN_MASK:
+ case FZ_CMD_BEGIN_GROUP:
clipped++;
continue;
- case FZ_CMDPOPCLIP:
- case FZ_CMDENDGROUP:
+ case FZ_CMD_POP_CLIP:
+ case FZ_CMD_END_GROUP:
if (!clipped)
goto visible;
clipped--;
continue;
- case FZ_CMDENDMASK:
+ case FZ_CMD_END_MASK:
if (!clipped)
goto visible;
continue;
@@ -435,79 +435,79 @@ fz_executedisplaylist(fz_displaylist *list, fz_device *dev, fz_matrix topctm, fz
visible:
switch (node->cmd)
{
- case FZ_CMDFILLPATH:
- dev->fillpath(dev->user, node->item.path, node->flag, ctm,
+ case FZ_CMD_FILL_PATH:
+ dev->fill_path(dev->user, node->item.path, node->flag, ctm,
node->colorspace, node->color, node->alpha);
break;
- case FZ_CMDSTROKEPATH:
- dev->strokepath(dev->user, node->item.path, node->stroke, ctm,
+ case FZ_CMD_STROKE_PATH:
+ dev->stroke_path(dev->user, node->item.path, node->stroke, ctm,
node->colorspace, node->color, node->alpha);
break;
- case FZ_CMDCLIPPATH:
- dev->clippath(dev->user, node->item.path, node->flag, ctm);
+ case FZ_CMD_CLIP_PATH:
+ dev->clip_path(dev->user, node->item.path, node->flag, ctm);
break;
- case FZ_CMDCLIPSTROKEPATH:
- dev->clipstrokepath(dev->user, node->item.path, node->stroke, ctm);
+ case FZ_CMD_CLIP_STROKE_PATH:
+ dev->clip_stroke_path(dev->user, node->item.path, node->stroke, ctm);
break;
- case FZ_CMDFILLTEXT:
- dev->filltext(dev->user, node->item.text, ctm,
+ case FZ_CMD_FILL_TEXT:
+ dev->fill_text(dev->user, node->item.text, ctm,
node->colorspace, node->color, node->alpha);
break;
- case FZ_CMDSTROKETEXT:
- dev->stroketext(dev->user, node->item.text, node->stroke, ctm,
+ case FZ_CMD_STROKE_TEXT:
+ dev->stroke_text(dev->user, node->item.text, node->stroke, ctm,
node->colorspace, node->color, node->alpha);
break;
- case FZ_CMDCLIPTEXT:
- dev->cliptext(dev->user, node->item.text, ctm, node->flag);
+ case FZ_CMD_CLIP_TEXT:
+ dev->clip_text(dev->user, node->item.text, ctm, node->flag);
break;
- case FZ_CMDCLIPSTROKETEXT:
- dev->clipstroketext(dev->user, node->item.text, node->stroke, ctm);
+ case FZ_CMD_CLIP_STROKE_TEXT:
+ dev->clip_stroke_text(dev->user, node->item.text, node->stroke, ctm);
break;
- case FZ_CMDIGNORETEXT:
- dev->ignoretext(dev->user, node->item.text, ctm);
+ case FZ_CMD_IGNORE_TEXT:
+ dev->ignore_text(dev->user, node->item.text, ctm);
break;
- case FZ_CMDFILLSHADE:
- dev->fillshade(dev->user, node->item.shade, ctm, node->alpha);
+ case FZ_CMD_FILL_SHADE:
+ dev->fill_shade(dev->user, node->item.shade, ctm, node->alpha);
break;
- case FZ_CMDFILLIMAGE:
- dev->fillimage(dev->user, node->item.image, ctm, node->alpha);
+ case FZ_CMD_FILL_IMAGE:
+ dev->fill_image(dev->user, node->item.image, ctm, node->alpha);
break;
- case FZ_CMDFILLIMAGEMASK:
- dev->fillimagemask(dev->user, node->item.image, ctm,
+ case FZ_CMD_FILL_IMAGE_MASK:
+ dev->fill_image_mask(dev->user, node->item.image, ctm,
node->colorspace, node->color, node->alpha);
break;
- case FZ_CMDCLIPIMAGEMASK:
- dev->clipimagemask(dev->user, node->item.image, ctm);
+ case FZ_CMD_CLIP_IMAGE_MASK:
+ dev->clip_image_mask(dev->user, node->item.image, ctm);
break;
- case FZ_CMDPOPCLIP:
- dev->popclip(dev->user);
+ case FZ_CMD_POP_CLIP:
+ dev->pop_clip(dev->user);
break;
- case FZ_CMDBEGINMASK:
- bbox = fz_transformrect(topctm, node->rect);
- dev->beginmask(dev->user, bbox, node->flag, node->colorspace, node->color);
+ case FZ_CMD_BEGIN_MASK:
+ bbox = fz_transform_rect(top_ctm, node->rect);
+ dev->begin_mask(dev->user, bbox, node->flag, node->colorspace, node->color);
break;
- case FZ_CMDENDMASK:
- dev->endmask(dev->user);
+ case FZ_CMD_END_MASK:
+ dev->end_mask(dev->user);
break;
- case FZ_CMDBEGINGROUP:
- bbox = fz_transformrect(topctm, node->rect);
- dev->begingroup(dev->user, bbox,
+ case FZ_CMD_BEGIN_GROUP:
+ bbox = fz_transform_rect(top_ctm, node->rect);
+ dev->begin_group(dev->user, bbox,
node->flag & ISOLATED, node->flag & KNOCKOUT,
node->item.blendmode, node->alpha);
break;
- case FZ_CMDENDGROUP:
- dev->endgroup(dev->user);
+ case FZ_CMD_END_GROUP:
+ dev->end_group(dev->user);
break;
- case FZ_CMDBEGINTILE:
+ case FZ_CMD_BEGIN_TILE:
bbox.x0 = node->color[2];
bbox.y0 = node->color[3];
bbox.x1 = node->color[4];
bbox.y1 = node->color[5];
- dev->begintile(dev->user, node->rect, bbox,
+ dev->begin_tile(dev->user, node->rect, bbox,
node->color[0], node->color[1], ctm);
break;
- case FZ_CMDENDTILE:
- dev->endtile(dev->user);
+ case FZ_CMD_END_TILE:
+ dev->end_tile(dev->user);
break;
}
}
diff --git a/fitz/dev_null.c b/fitz/dev_null.c
index 2d20a966..dcb43292 100644
--- a/fitz/dev_null.c
+++ b/fitz/dev_null.c
@@ -1,29 +1,29 @@
#include "fitz.h"
-static void fz_nullfreeuser(void *user) {}
-static void fz_nullfillpath(void *user, fz_path *path, int evenodd, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
-static void fz_nullstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
-static void fz_nullclippath(void *user, fz_path *path, int evenodd, fz_matrix ctm) {}
-static void fz_nullclipstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm) {}
-static void fz_nullfilltext(void *user, fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
-static void fz_nullstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
-static void fz_nullcliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate) {}
-static void fz_nullclipstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm) {}
-static void fz_nullignoretext(void *user, fz_text *text, fz_matrix ctm) {}
-static void fz_nullpopclip(void *user) {}
-static void fz_nullfillshade(void *user, fz_shade *shade, fz_matrix ctm, float alpha) {}
-static void fz_nullfillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha) {}
-static void fz_nullfillimagemask(void *user, fz_pixmap *image, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
-static void fz_nullclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm) {}
-static void fz_nullbeginmask(void *user, fz_rect r, int luminosity, fz_colorspace *colorspace, float *bc) {}
-static void fz_nullendmask(void *user) {}
-static void fz_nullbegingroup(void *user, fz_rect r, int isolated, int knockout, fz_blendmode blendmode, float alpha) {}
-static void fz_nullendgroup(void *user) {}
-static void fz_nullbegintile(void *user, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm) {}
-static void fz_nullendtile(void *user) {}
+static void fz_null_free_user(void *user) {}
+static void fz_null_fill_path(void *user, fz_path *path, int even_odd, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
+static void fz_null_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
+static void fz_null_clip_path(void *user, fz_path *path, int even_odd, fz_matrix ctm) {}
+static void fz_null_clip_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm) {}
+static void fz_null_fill_text(void *user, fz_text *text, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
+static void fz_null_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
+static void fz_null_clip_text(void *user, fz_text *text, fz_matrix ctm, int accumulate) {}
+static void fz_null_clip_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm) {}
+static void fz_null_ignore_text(void *user, fz_text *text, fz_matrix ctm) {}
+static void fz_null_pop_clip(void *user) {}
+static void fz_null_fill_shade(void *user, fz_shade *shade, fz_matrix ctm, float alpha) {}
+static void fz_null_fill_image(void *user, fz_pixmap *image, fz_matrix ctm, float alpha) {}
+static void fz_null_fill_image_mask(void *user, fz_pixmap *image, fz_matrix ctm, fz_colorspace *colorspace, float *color, float alpha) {}
+static void fz_null_clip_image_mask(void *user, fz_pixmap *image, fz_matrix ctm) {}
+static void fz_null_begin_mask(void *user, fz_rect r, int luminosity, fz_colorspace *colorspace, float *bc) {}
+static void fz_null_end_mask(void *user) {}
+static void fz_null_begin_group(void *user, fz_rect r, int isolated, int knockout, fz_blendmode blendmode, float alpha) {}
+static void fz_null_end_group(void *user) {}
+static void fz_null_begin_tile(void *user, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm) {}
+static void fz_null_end_tile(void *user) {}
fz_device *
-fz_newdevice(void *user)
+fz_new_device(void *user)
{
fz_device *dev = fz_malloc(sizeof(fz_device));
memset(dev, 0, sizeof(fz_device));
@@ -31,41 +31,41 @@ fz_newdevice(void *user)
dev->hints = 0;
dev->user = user;
- dev->freeuser = fz_nullfreeuser;
+ dev->free_user = fz_null_free_user;
- dev->fillpath = fz_nullfillpath;
- dev->strokepath = fz_nullstrokepath;
- dev->clippath = fz_nullclippath;
- dev->clipstrokepath = fz_nullclipstrokepath;
+ dev->fill_path = fz_null_fill_path;
+ dev->stroke_path = fz_null_stroke_path;
+ dev->clip_path = fz_null_clip_path;
+ dev->clip_stroke_path = fz_null_clip_stroke_path;
- dev->filltext = fz_nullfilltext;
- dev->stroketext = fz_nullstroketext;
- dev->cliptext = fz_nullcliptext;
- dev->clipstroketext = fz_nullclipstroketext;
- dev->ignoretext = fz_nullignoretext;
+ dev->fill_text = fz_null_fill_text;
+ dev->stroke_text = fz_null_stroke_text;
+ dev->clip_text = fz_null_clip_text;
+ dev->clip_stroke_text = fz_null_clip_stroke_text;
+ dev->ignore_text = fz_null_ignore_text;
- dev->fillshade = fz_nullfillshade;
- dev->fillimage = fz_nullfillimage;
- dev->fillimagemask = fz_nullfillimagemask;
- dev->clipimagemask = fz_nullclipimagemask;
+ dev->fill_shade = fz_null_fill_shade;
+ dev->fill_image = fz_null_fill_image;
+ dev->fill_image_mask = fz_null_fill_image_mask;
+ dev->clip_image_mask = fz_null_clip_image_mask;
- dev->popclip = fz_nullpopclip;
+ dev->pop_clip = fz_null_pop_clip;
- dev->beginmask = fz_nullbeginmask;
- dev->endmask = fz_nullendmask;
- dev->begingroup = fz_nullbegingroup;
- dev->endgroup = fz_nullendgroup;
+ dev->begin_mask = fz_null_begin_mask;
+ dev->end_mask = fz_null_end_mask;
+ dev->begin_group = fz_null_begin_group;
+ dev->end_group = fz_null_end_group;
- dev->begintile = fz_nullbegintile;
- dev->endtile = fz_nullendtile;
+ dev->begin_tile = fz_null_begin_tile;
+ dev->end_tile = fz_null_end_tile;
return dev;
}
void
-fz_freedevice(fz_device *dev)
+fz_free_device(fz_device *dev)
{
- if (dev->freeuser)
- dev->freeuser(dev->user);
+ if (dev->free_user)
+ dev->free_user(dev->user);
fz_free(dev);
}
diff --git a/fitz/dev_text.c b/fitz/dev_text.c
index c59a36f7..139c3eed 100644
--- a/fitz/dev_text.c
+++ b/fitz/dev_text.c
@@ -1,55 +1,55 @@
#include "fitz.h"
-#define LINEDIST 0.9f
-#define SPACEDIST 0.2f
+#define LINE_DIST 0.9f
+#define SPACE_DIST 0.2f
#include <ft2build.h>
#include FT_FREETYPE_H
#include FT_ADVANCES_H
-typedef struct fz_textdevice_s fz_textdevice;
+typedef struct fz_text_device_s fz_text_device;
-struct fz_textdevice_s
+struct fz_text_device_s
{
fz_point point;
- fz_textspan *head;
- fz_textspan *span;
+ fz_text_span *head;
+ fz_text_span *span;
};
-fz_textspan *
-fz_newtextspan(void)
+fz_text_span *
+fz_new_text_span(void)
{
- fz_textspan *span;
- span = fz_malloc(sizeof(fz_textspan));
- span->font = nil;
+ fz_text_span *span;
+ span = fz_malloc(sizeof(fz_text_span));
+ span->font = NULL;
span->wmode = 0;
span->size = 0;
span->len = 0;
span->cap = 0;
- span->text = nil;
- span->next = nil;
+ span->text = NULL;
+ span->next = NULL;
span->eol = 0;
return span;
}
void
-fz_freetextspan(fz_textspan *span)
+fz_free_text_span(fz_text_span *span)
{
if (span->font)
- fz_dropfont(span->font);
+ fz_drop_font(span->font);
if (span->next)
- fz_freetextspan(span->next);
+ fz_free_text_span(span->next);
fz_free(span->text);
fz_free(span);
}
static void
-fz_addtextcharimp(fz_textspan *span, int c, fz_bbox bbox)
+fz_add_text_char_imp(fz_text_span *span, int c, fz_bbox bbox)
{
if (span->len + 1 >= span->cap)
{
span->cap = span->cap > 1 ? (span->cap * 3) / 2 : 80;
- span->text = fz_realloc(span->text, span->cap, sizeof(fz_textchar));
+ span->text = fz_realloc(span->text, span->cap, sizeof(fz_text_char));
}
span->text[span->len].c = c;
span->text[span->len].bbox = bbox;
@@ -57,7 +57,7 @@ fz_addtextcharimp(fz_textspan *span, int c, fz_bbox bbox)
}
static fz_bbox
-fz_splitbbox(fz_bbox bbox, int i, int n)
+fz_split_bbox(fz_bbox bbox, int i, int n)
{
float w = (float)(bbox.x1 - bbox.x0) / n;
float x0 = bbox.x0;
@@ -67,20 +67,20 @@ fz_splitbbox(fz_bbox bbox, int i, int n)
}
static void
-fz_addtextchar(fz_textspan **last, fz_font *font, float size, int wmode, int c, fz_bbox bbox)
+fz_add_text_char(fz_text_span **last, fz_font *font, float size, int wmode, int c, fz_bbox bbox)
{
- fz_textspan *span = *last;
+ fz_text_span *span = *last;
if (!span->font)
{
- span->font = fz_keepfont(font);
+ span->font = fz_keep_font(font);
span->size = size;
}
if ((span->font != font || span->size != size || span->wmode != wmode) && c != 32)
{
- span = fz_newtextspan();
- span->font = fz_keepfont(font);
+ span = fz_new_text_span();
+ span->font = fz_keep_font(font);
span->size = size;
span->wmode = wmode;
(*last)->next = span;
@@ -92,55 +92,55 @@ fz_addtextchar(fz_textspan **last, fz_font *font, float size, int wmode, int c,
case -1: /* ignore when one unicode character maps to multiple glyphs */
break;
case 0xFB00: /* ff */
- fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 0, 2));
- fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 1, 2));
+ fz_add_text_char_imp(span, 'f', fz_split_bbox(bbox, 0, 2));
+ fz_add_text_char_imp(span, 'f', fz_split_bbox(bbox, 1, 2));
break;
case 0xFB01: /* fi */
- fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 0, 2));
- fz_addtextcharimp(span, 'i', fz_splitbbox(bbox, 1, 2));
+ fz_add_text_char_imp(span, 'f', fz_split_bbox(bbox, 0, 2));
+ fz_add_text_char_imp(span, 'i', fz_split_bbox(bbox, 1, 2));
break;
case 0xFB02: /* fl */
- fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 0, 2));
- fz_addtextcharimp(span, 'l', fz_splitbbox(bbox, 1, 2));
+ fz_add_text_char_imp(span, 'f', fz_split_bbox(bbox, 0, 2));
+ fz_add_text_char_imp(span, 'l', fz_split_bbox(bbox, 1, 2));
break;
case 0xFB03: /* ffi */
- fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 0, 3));
- fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 1, 3));
- fz_addtextcharimp(span, 'i', fz_splitbbox(bbox, 2, 3));
+ fz_add_text_char_imp(span, 'f', fz_split_bbox(bbox, 0, 3));
+ fz_add_text_char_imp(span, 'f', fz_split_bbox(bbox, 1, 3));
+ fz_add_text_char_imp(span, 'i', fz_split_bbox(bbox, 2, 3));
break;
case 0xFB04: /* ffl */
- fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 0, 3));
- fz_addtextcharimp(span, 'f', fz_splitbbox(bbox, 1, 3));
- fz_addtextcharimp(span, 'l', fz_splitbbox(bbox, 2, 3));
+ fz_add_text_char_imp(span, 'f', fz_split_bbox(bbox, 0, 3));
+ fz_add_text_char_imp(span, 'f', fz_split_bbox(bbox, 1, 3));
+ fz_add_text_char_imp(span, 'l', fz_split_bbox(bbox, 2, 3));
break;
case 0xFB05: /* long st */
case 0xFB06: /* st */
- fz_addtextcharimp(span, 's', fz_splitbbox(bbox, 0, 2));
- fz_addtextcharimp(span, 't', fz_splitbbox(bbox, 1, 2));
+ fz_add_text_char_imp(span, 's', fz_split_bbox(bbox, 0, 2));
+ fz_add_text_char_imp(span, 't', fz_split_bbox(bbox, 1, 2));
break;
default:
- fz_addtextcharimp(span, c, bbox);
+ fz_add_text_char_imp(span, c, bbox);
break;
}
}
static void
-fz_dividetextchars(fz_textspan **last, int n, fz_bbox bbox)
+fz_divide_text_chars(fz_text_span **last, int n, fz_bbox bbox)
{
- fz_textspan *span = *last;
+ fz_text_span *span = *last;
int i, x;
x = span->len - n;
if (x >= 0)
for (i = 0; i < n; i++)
- span->text[x + i].bbox = fz_splitbbox(bbox, i, n);
+ span->text[x + i].bbox = fz_split_bbox(bbox, i, n);
}
static void
-fz_addtextnewline(fz_textspan **last, fz_font *font, float size, int wmode)
+fz_add_text_newline(fz_text_span **last, fz_font *font, float size, int wmode)
{
- fz_textspan *span;
- span = fz_newtextspan();
- span->font = fz_keepfont(font);
+ fz_text_span *span;
+ span = fz_new_text_span();
+ span->font = fz_keep_font(font);
span->size = size;
span->wmode = wmode;
(*last)->eol = 1;
@@ -149,7 +149,7 @@ fz_addtextnewline(fz_textspan **last, fz_font *font, float size, int wmode)
}
void
-fz_debugtextspanxml(fz_textspan *span)
+fz_debug_text_span_xml(fz_text_span *span)
{
char buf[10];
int c, n, k, i;
@@ -179,11 +179,11 @@ fz_debugtextspanxml(fz_textspan *span)
printf("</span>\n");
if (span->next)
- fz_debugtextspanxml(span->next);
+ fz_debug_text_span_xml(span->next);
}
void
-fz_debugtextspan(fz_textspan *span)
+fz_debug_text_span(fz_text_span *span)
{
char buf[10];
int c, n, k, i;
@@ -205,14 +205,14 @@ fz_debugtextspan(fz_textspan *span)
putchar('\n');
if (span->next)
- fz_debugtextspan(span->next);
+ fz_debug_text_span(span->next);
}
static void
-fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *pen)
+fz_text_extract_span(fz_text_span **last, fz_text *text, fz_matrix ctm, fz_point *pen)
{
fz_font *font = text->font;
- FT_Face face = font->ftface;
+ FT_Face face = font->ft_face;
fz_matrix tm = text->trm;
fz_matrix trm;
float size;
@@ -229,16 +229,16 @@ fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *p
if (text->len == 0)
return;
- if (font->ftface)
+ if (font->ft_face)
{
- err = FT_Set_Char_Size(font->ftface, 64, 64, 72, 72);
+ err = FT_Set_Char_Size(font->ft_face, 64, 64, 72, 72);
if (err)
- fz_warn("freetype set character size: %s", ft_errorstring(err));
+ fz_warn("freetype set character size: %s", ft_error_string(err));
ascender = (float)face->ascender / face->units_per_EM;
descender = (float)face->descender / face->units_per_EM;
}
- rect = fz_emptyrect;
+ rect = fz_empty_rect;
if (text->wmode == 0)
{
@@ -254,29 +254,29 @@ fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *p
tm.e = 0;
tm.f = 0;
trm = fz_concat(tm, ctm);
- dir = fz_transformvector(trm, dir);
+ dir = fz_transform_vector(trm, dir);
dist = sqrtf(dir.x * dir.x + dir.y * dir.y);
ndir.x = dir.x / dist;
ndir.y = dir.y / dist;
- size = fz_matrixexpansion(trm);
+ size = fz_matrix_expansion(trm);
multi = 1;
for (i = 0; i < text->len; i++)
{
- if (text->els[i].gid < 0)
+ if (text->items[i].gid < 0)
{
- fz_addtextchar(last, font, size, text->wmode, text->els[i].ucs, fz_roundrect(rect));
+ fz_add_text_char(last, font, size, text->wmode, text->items[i].ucs, fz_round_rect(rect));
multi ++;
- fz_dividetextchars(last, multi, fz_roundrect(rect));
+ fz_divide_text_chars(last, multi, fz_round_rect(rect));
continue;
}
multi = 1;
/* Calculate new pen location and delta */
- tm.e = text->els[i].x;
- tm.f = text->els[i].y;
+ tm.e = text->items[i].x;
+ tm.f = text->items[i].y;
trm = fz_concat(tm, ctm);
delta.x = pen->x - trm.e;
@@ -293,11 +293,11 @@ fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *p
ndelta.y = delta.y / dist;
dot = ndelta.x * ndir.x + ndelta.y * ndir.y;
- if (dist > size * LINEDIST)
+ if (dist > size * LINE_DIST)
{
- fz_addtextnewline(last, font, size, text->wmode);
+ fz_add_text_newline(last, font, size, text->wmode);
}
- else if (fabsf(dot) > 0.95f && dist > size * SPACEDIST)
+ else if (fabsf(dot) > 0.95f && dist > size * SPACE_DIST)
{
if ((*last)->len > 0 && (*last)->text[(*last)->len - 1].c != ' ')
{
@@ -306,14 +306,14 @@ fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *p
spacerect.y0 = 0;
spacerect.x1 = 0;
spacerect.y1 = 1;
- spacerect = fz_transformrect(trm, spacerect);
- fz_addtextchar(last, font, size, text->wmode, ' ', fz_roundrect(spacerect));
+ spacerect = fz_transform_rect(trm, spacerect);
+ fz_add_text_char(last, font, size, text->wmode, ' ', fz_round_rect(spacerect));
}
}
}
/* Calculate bounding box and new pen position based on font metrics */
- if (font->ftface)
+ if (font->ft_face)
{
FT_Fixed ftadv = 0;
int mask = FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING | FT_LOAD_IGNORE_TRANSFORM;
@@ -321,7 +321,7 @@ fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *p
/* TODO: freetype returns broken vertical metrics */
/* if (text->wmode) mask |= FT_LOAD_VERTICAL_LAYOUT; */
- FT_Get_Advance(font->ftface, text->els[i].gid, mask, &ftadv);
+ FT_Get_Advance(font->ft_face, text->items[i].gid, mask, &ftadv);
adv = ftadv / 65536.0f;
rect.x0 = 0;
@@ -331,62 +331,62 @@ fz_textextractspan(fz_textspan **last, fz_text *text, fz_matrix ctm, fz_point *p
}
else
{
- adv = font->t3widths[text->els[i].gid];
+ adv = font->t3widths[text->items[i].gid];
rect.x0 = 0;
rect.y0 = descender;
rect.x1 = adv;
rect.y1 = ascender;
}
- rect = fz_transformrect(trm, rect);
+ rect = fz_transform_rect(trm, rect);
pen->x = trm.e + dir.x * adv;
pen->y = trm.f + dir.y * adv;
- fz_addtextchar(last, font, size, text->wmode, text->els[i].ucs, fz_roundrect(rect));
+ fz_add_text_char(last, font, size, text->wmode, text->items[i].ucs, fz_round_rect(rect));
}
}
static void
-fz_textfilltext(void *user, fz_text *text, fz_matrix ctm,
+fz_text_fill_text(void *user, fz_text *text, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_textdevice *tdev = user;
- fz_textextractspan(&tdev->span, text, ctm, &tdev->point);
+ fz_text_device *tdev = user;
+ fz_text_extract_span(&tdev->span, text, ctm, &tdev->point);
}
static void
-fz_textstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm,
+fz_text_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- fz_textdevice *tdev = user;
- fz_textextractspan(&tdev->span, text, ctm, &tdev->point);
+ fz_text_device *tdev = user;
+ fz_text_extract_span(&tdev->span, text, ctm, &tdev->point);
}
static void
-fz_textcliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate)
+fz_text_clip_text(void *user, fz_text *text, fz_matrix ctm, int accumulate)
{
- fz_textdevice *tdev = user;
- fz_textextractspan(&tdev->span, text, ctm, &tdev->point);
+ fz_text_device *tdev = user;
+ fz_text_extract_span(&tdev->span, text, ctm, &tdev->point);
}
static void
-fz_textclipstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm)
+fz_text_clip_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm)
{
- fz_textdevice *tdev = user;
- fz_textextractspan(&tdev->span, text, ctm, &tdev->point);
+ fz_text_device *tdev = user;
+ fz_text_extract_span(&tdev->span, text, ctm, &tdev->point);
}
static void
-fz_textignoretext(void *user, fz_text *text, fz_matrix ctm)
+fz_text_ignore_text(void *user, fz_text *text, fz_matrix ctm)
{
- fz_textdevice *tdev = user;
- fz_textextractspan(&tdev->span, text, ctm, &tdev->point);
+ fz_text_device *tdev = user;
+ fz_text_extract_span(&tdev->span, text, ctm, &tdev->point);
}
static void
-fz_textfreeuser(void *user)
+fz_text_free_user(void *user)
{
- fz_textdevice *tdev = user;
+ fz_text_device *tdev = user;
tdev->span->eol = 1;
@@ -397,22 +397,22 @@ fz_textfreeuser(void *user)
}
fz_device *
-fz_newtextdevice(fz_textspan *root)
+fz_new_text_device(fz_text_span *root)
{
fz_device *dev;
- fz_textdevice *tdev = fz_malloc(sizeof(fz_textdevice));
+ fz_text_device *tdev = fz_malloc(sizeof(fz_text_device));
tdev->head = root;
tdev->span = root;
tdev->point.x = -1;
tdev->point.y = -1;
- dev = fz_newdevice(tdev);
- dev->hints = FZ_IGNOREIMAGE | FZ_IGNORESHADE;
- dev->freeuser = fz_textfreeuser;
- dev->filltext = fz_textfilltext;
- dev->stroketext = fz_textstroketext;
- dev->cliptext = fz_textcliptext;
- dev->clipstroketext = fz_textclipstroketext;
- dev->ignoretext = fz_textignoretext;
+ dev = fz_new_device(tdev);
+ dev->hints = FZ_IGNORE_IMAGE | FZ_IGNORE_SHADE;
+ dev->free_user = fz_text_free_user;
+ dev->fill_text = fz_text_fill_text;
+ dev->stroke_text = fz_text_stroke_text;
+ dev->clip_text = fz_text_clip_text;
+ dev->clip_stroke_text = fz_text_clip_stroke_text;
+ dev->ignore_text = fz_text_ignore_text;
return dev;
}
diff --git a/fitz/dev_trace.c b/fitz/dev_trace.c
index f8a94b43..2bc171de 100644
--- a/fitz/dev_trace.c
+++ b/fitz/dev_trace.c
@@ -1,14 +1,14 @@
#include "fitz.h"
static void
-fz_tracematrix(fz_matrix ctm)
+fz_trace_matrix(fz_matrix ctm)
{
printf("matrix=\"%g %g %g %g %g %g\" ",
ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f);
}
static void
-fz_tracecolor(fz_colorspace *colorspace, float *color, float alpha)
+fz_trace_color(fz_colorspace *colorspace, float *color, float alpha)
{
int i;
printf("colorspace=\"%s\" color=\"", colorspace->name);
@@ -20,7 +20,7 @@ fz_tracecolor(fz_colorspace *colorspace, float *color, float alpha)
}
static void
-fz_tracepath(fz_path *path, int indent)
+fz_trace_path(fz_path *path, int indent)
{
float x, y;
int i = 0;
@@ -29,30 +29,30 @@ fz_tracepath(fz_path *path, int indent)
{
for (n = 0; n < indent; n++)
putchar(' ');
- switch (path->els[i++].k)
+ switch (path->items[i++].k)
{
case FZ_MOVETO:
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("<moveto x=\"%g\" y=\"%g\" />\n", x, y);
break;
case FZ_LINETO:
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("<lineto x=\"%g\" y=\"%g\" />\n", x, y);
break;
case FZ_CURVETO:
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("<curveto x1=\"%g\" y1=\"%g\" ", x, y);
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("x2=\"%g\" y2=\"%g\" ", x, y);
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("x3=\"%g\" y3=\"%g\" />\n", x, y);
break;
- case FZ_CLOSEPATH:
+ case FZ_CLOSE_PATH:
printf("<closepath />\n");
break;
}
@@ -60,245 +60,245 @@ fz_tracepath(fz_path *path, int indent)
}
static void
-fz_tracefillpath(void *user, fz_path *path, int evenodd, fz_matrix ctm,
+fz_trace_fill_path(void *user, fz_path *path, int even_odd, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- printf("<fillpath ");
- if (evenodd)
+ printf("<fill_path ");
+ if (even_odd)
printf("winding=\"eofill\" ");
else
printf("winding=\"nonzero\" ");
- fz_tracecolor(colorspace, color, alpha);
- fz_tracematrix(ctm);
+ fz_trace_color(colorspace, color, alpha);
+ fz_trace_matrix(ctm);
printf(">\n");
- fz_tracepath(path, 0);
- printf("</fillpath>\n");
+ fz_trace_path(path, 0);
+ printf("</fill_path>\n");
}
static void
-fz_tracestrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm,
+fz_trace_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
int i;
- printf("<strokepath ");
+ printf("<stroke_path ");
printf("linewidth=\"%g\" ", stroke->linewidth);
printf("miterlimit=\"%g\" ", stroke->miterlimit);
printf("linecap=\"%d\" ", stroke->linecap);
printf("linejoin=\"%d\" ", stroke->linejoin);
- if (stroke->dashlen)
+ if (stroke->dash_len)
{
- printf("dashphase=\"%g\" dash=\"", stroke->dashphase);
- for (i = 0; i < stroke->dashlen; i++)
- printf("%g ", stroke->dashlist[i]);
+ printf("dash_phase=\"%g\" dash=\"", stroke->dash_phase);
+ for (i = 0; i < stroke->dash_len; i++)
+ printf("%g ", stroke->dash_list[i]);
printf("\"");
}
- fz_tracecolor(colorspace, color, alpha);
- fz_tracematrix(ctm);
+ fz_trace_color(colorspace, color, alpha);
+ fz_trace_matrix(ctm);
printf(">\n");
- fz_tracepath(path, 0);
+ fz_trace_path(path, 0);
- printf("</strokepath>\n");
+ printf("</stroke_path>\n");
}
static void
-fz_traceclippath(void *user, fz_path *path, int evenodd, fz_matrix ctm)
+fz_trace_clip_path(void *user, fz_path *path, int even_odd, fz_matrix ctm)
{
- printf("<clippath ");
- if (evenodd)
+ printf("<clip_path ");
+ if (even_odd)
printf("winding=\"eofill\" ");
else
printf("winding=\"nonzero\" ");
- fz_tracematrix(ctm);
+ fz_trace_matrix(ctm);
printf(">\n");
- fz_tracepath(path, 0);
- printf("</clippath>\n");
+ fz_trace_path(path, 0);
+ printf("</clip_path>\n");
}
static void
-fz_traceclipstrokepath(void *user, fz_path *path, fz_strokestate *stroke, fz_matrix ctm)
+fz_trace_clip_stroke_path(void *user, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm)
{
- printf("<clipstrokepath ");
- fz_tracematrix(ctm);
+ printf("<clip_stroke_path ");
+ fz_trace_matrix(ctm);
printf(">\n");
- fz_tracepath(path, 0);
- printf("</clipstrokepath>\n");
+ fz_trace_path(path, 0);
+ printf("</clip_stroke_path>\n");
}
static void
-fz_tracefilltext(void *user, fz_text *text, fz_matrix ctm,
+fz_trace_fill_text(void *user, fz_text *text, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- printf("<filltext font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
- fz_tracecolor(colorspace, color, alpha);
- fz_tracematrix(fz_concat(ctm, text->trm));
+ printf("<fill_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
+ fz_trace_color(colorspace, color, alpha);
+ fz_trace_matrix(fz_concat(ctm, text->trm));
printf(">\n");
- fz_debugtext(text, 0);
- printf("</filltext>\n");
+ fz_debug_text(text, 0);
+ printf("</fill_text>\n");
}
static void
-fz_tracestroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm,
+fz_trace_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- printf("<stroketext font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
- fz_tracecolor(colorspace, color, alpha);
- fz_tracematrix(fz_concat(ctm, text->trm));
+ printf("<stroke_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
+ fz_trace_color(colorspace, color, alpha);
+ fz_trace_matrix(fz_concat(ctm, text->trm));
printf(">\n");
- fz_debugtext(text, 0);
- printf("</stroketext>\n");
+ fz_debug_text(text, 0);
+ printf("</stroke_text>\n");
}
static void
-fz_tracecliptext(void *user, fz_text *text, fz_matrix ctm, int accumulate)
+fz_trace_clip_text(void *user, fz_text *text, fz_matrix ctm, int accumulate)
{
- printf("<cliptext font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
+ printf("<clip_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
printf("accumulate=\"%d\" ", accumulate);
- fz_tracematrix(fz_concat(ctm, text->trm));
+ fz_trace_matrix(fz_concat(ctm, text->trm));
printf(">\n");
- fz_debugtext(text, 0);
- printf("</cliptext>\n");
+ fz_debug_text(text, 0);
+ printf("</clip_text>\n");
}
static void
-fz_traceclipstroketext(void *user, fz_text *text, fz_strokestate *stroke, fz_matrix ctm)
+fz_trace_clip_stroke_text(void *user, fz_text *text, fz_stroke_state *stroke, fz_matrix ctm)
{
- printf("<clipstroketext font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
- fz_tracematrix(fz_concat(ctm, text->trm));
+ printf("<clip_stroke_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
+ fz_trace_matrix(fz_concat(ctm, text->trm));
printf(">\n");
- fz_debugtext(text, 0);
- printf("</clipstroketext>\n");
+ fz_debug_text(text, 0);
+ printf("</clip_stroke_text>\n");
}
static void
-fz_traceignoretext(void *user, fz_text *text, fz_matrix ctm)
+fz_trace_ignore_text(void *user, fz_text *text, fz_matrix ctm)
{
- printf("<ignoretext font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
- fz_tracematrix(fz_concat(ctm, text->trm));
+ printf("<ignore_text font=\"%s\" wmode=\"%d\" ", text->font->name, text->wmode);
+ fz_trace_matrix(fz_concat(ctm, text->trm));
printf(">\n");
- fz_debugtext(text, 0);
- printf("</ignoretext>\n");
+ fz_debug_text(text, 0);
+ printf("</ignore_text>\n");
}
static void
-fz_tracefillimage(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
+fz_trace_fill_image(void *user, fz_pixmap *image, fz_matrix ctm, float alpha)
{
- printf("<fillimage alpha=\"%g\" ", alpha);
- fz_tracematrix(ctm);
+ printf("<fill_image alpha=\"%g\" ", alpha);
+ fz_trace_matrix(ctm);
printf("/>\n");
}
static void
-fz_tracefillshade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
+fz_trace_fill_shade(void *user, fz_shade *shade, fz_matrix ctm, float alpha)
{
- printf("<fillshade alpha=\"%g\" ", alpha);
- fz_tracematrix(ctm);
+ printf("<fill_shade alpha=\"%g\" ", alpha);
+ fz_trace_matrix(ctm);
printf("/>\n");
}
static void
-fz_tracefillimagemask(void *user, fz_pixmap *image, fz_matrix ctm,
+fz_trace_fill_image_mask(void *user, fz_pixmap *image, fz_matrix ctm,
fz_colorspace *colorspace, float *color, float alpha)
{
- printf("<fillimagemask ");
- fz_tracematrix(ctm);
- fz_tracecolor(colorspace, color, alpha);
+ printf("<fill_image_mask ");
+ fz_trace_matrix(ctm);
+ fz_trace_color(colorspace, color, alpha);
printf("/>\n");
}
static void
-fz_traceclipimagemask(void *user, fz_pixmap *image, fz_matrix ctm)
+fz_trace_clip_image_mask(void *user, fz_pixmap *image, fz_matrix ctm)
{
- printf("<clipimagemask ");
- fz_tracematrix(ctm);
+ printf("<clip_image_mask ");
+ fz_trace_matrix(ctm);
printf("/>\n");
}
static void
-fz_tracepopclip(void *user)
+fz_trace_pop_clip(void *user)
{
- printf("<popclip />\n");
+ printf("<pop_clip />\n");
}
static void
-fz_tracebeginmask(void *user, fz_rect bbox, int luminosity, fz_colorspace *colorspace, float *color)
+fz_trace_begin_mask(void *user, fz_rect bbox, int luminosity, fz_colorspace *colorspace, float *color)
{
printf("<mask bbox=\"%g %g %g %g\" s=\"%s\" ",
bbox.x0, bbox.y0, bbox.x1, bbox.y1,
luminosity ? "luminosity" : "alpha");
-// fz_tracecolor(colorspace, color, 1);
+// fz_trace_color(colorspace, color, 1);
printf(">\n");
}
static void
-fz_traceendmask(void *user)
+fz_trace_end_mask(void *user)
{
printf("</mask>\n");
}
static void
-fz_tracebegingroup(void *user, fz_rect bbox, int isolated, int knockout, fz_blendmode blendmode, float alpha)
+fz_trace_begin_group(void *user, fz_rect bbox, int isolated, int knockout, fz_blendmode blendmode, float alpha)
{
printf("<group bbox=\"%g %g %g %g\" isolated=\"%d\" knockout=\"%d\" blendmode=\"%s\" alpha=\"%g\">\n",
bbox.x0, bbox.y0, bbox.x1, bbox.y1,
- isolated, knockout, fz_blendnames[blendmode], alpha);
+ isolated, knockout, fz_blendmode_names[blendmode], alpha);
}
static void
-fz_traceendgroup(void *user)
+fz_trace_end_group(void *user)
{
printf("</group>\n");
}
static void
-fz_tracebegintile(void *user, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm)
+fz_trace_begin_tile(void *user, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm)
{
printf("<tile ");
printf("area=\"%g %g %g %g\" ", area.x0, area.y0, area.x1, area.y1);
printf("view=\"%g %g %g %g\" ", view.x0, view.y0, view.x1, view.y1);
printf("xstep=\"%g\" ystep=\"%g\" ", xstep, ystep);
- fz_tracematrix(ctm);
+ fz_trace_matrix(ctm);
printf(">\n");
}
static void
-fz_traceendtile(void *user)
+fz_trace_end_tile(void *user)
{
printf("</tile>\n");
}
-fz_device *fz_newtracedevice(void)
+fz_device *fz_new_trace_device(void)
{
- fz_device *dev = fz_newdevice(nil);
+ fz_device *dev = fz_new_device(NULL);
- dev->fillpath = fz_tracefillpath;
- dev->strokepath = fz_tracestrokepath;
- dev->clippath = fz_traceclippath;
- dev->clipstrokepath = fz_traceclipstrokepath;
+ dev->fill_path = fz_trace_fill_path;
+ dev->stroke_path = fz_trace_stroke_path;
+ dev->clip_path = fz_trace_clip_path;
+ dev->clip_stroke_path = fz_trace_clip_stroke_path;
- dev->filltext = fz_tracefilltext;
- dev->stroketext = fz_tracestroketext;
- dev->cliptext = fz_tracecliptext;
- dev->clipstroketext = fz_traceclipstroketext;
- dev->ignoretext = fz_traceignoretext;
+ dev->fill_text = fz_trace_fill_text;
+ dev->stroke_text = fz_trace_stroke_text;
+ dev->clip_text = fz_trace_clip_text;
+ dev->clip_stroke_text = fz_trace_clip_stroke_text;
+ dev->ignore_text = fz_trace_ignore_text;
- dev->fillshade = fz_tracefillshade;
- dev->fillimage = fz_tracefillimage;
- dev->fillimagemask = fz_tracefillimagemask;
- dev->clipimagemask = fz_traceclipimagemask;
+ dev->fill_shade = fz_trace_fill_shade;
+ dev->fill_image = fz_trace_fill_image;
+ dev->fill_image_mask = fz_trace_fill_image_mask;
+ dev->clip_image_mask = fz_trace_clip_image_mask;
- dev->popclip = fz_tracepopclip;
+ dev->pop_clip = fz_trace_pop_clip;
- dev->beginmask = fz_tracebeginmask;
- dev->endmask = fz_traceendmask;
- dev->begingroup = fz_tracebegingroup;
- dev->endgroup = fz_traceendgroup;
+ dev->begin_mask = fz_trace_begin_mask;
+ dev->end_mask = fz_trace_end_mask;
+ dev->begin_group = fz_trace_begin_group;
+ dev->end_group = fz_trace_end_group;
- dev->begintile = fz_tracebegintile;
- dev->endtile = fz_traceendtile;
+ dev->begin_tile = fz_trace_begin_tile;
+ dev->end_tile = fz_trace_end_tile;
return dev;
}
diff --git a/fitz/filt_basic.c b/fitz/filt_basic.c
index 221d0846..391f06ab 100644
--- a/fitz/filt_basic.c
+++ b/fitz/filt_basic.c
@@ -3,23 +3,23 @@
/* Pretend we have a filter that just copies data forever */
fz_stream *
-fz_opencopy(fz_stream *chain)
+fz_open_copy(fz_stream *chain)
{
- return fz_keepstream(chain);
+ return fz_keep_stream(chain);
}
/* Null filter copies a specified amount of data */
-struct nullfilter
+struct null_filter
{
fz_stream *chain;
int remain;
};
static int
-readnull(fz_stream *stm, unsigned char *buf, int len)
+read_null(fz_stream *stm, unsigned char *buf, int len)
{
- struct nullfilter *state = stm->state;
+ struct null_filter *state = stm->state;
int amount = MIN(len, state->remain);
int n = fz_read(state->chain, buf, amount);
if (n < 0)
@@ -29,23 +29,23 @@ readnull(fz_stream *stm, unsigned char *buf, int len)
}
static void
-closenull(fz_stream *stm)
+close_null(fz_stream *stm)
{
- struct nullfilter *state = stm->state;
+ struct null_filter *state = stm->state;
fz_close(state->chain);
fz_free(state);
}
fz_stream *
-fz_opennull(fz_stream *chain, int len)
+fz_open_null(fz_stream *chain, int len)
{
- struct nullfilter *state;
+ struct null_filter *state;
- state = fz_malloc(sizeof(struct nullfilter));
+ state = fz_malloc(sizeof(struct null_filter));
state->chain = chain;
state->remain = len;
- return fz_newstream(state, readnull, closenull);
+ return fz_new_stream(state, read_null, close_null);
}
/* ASCII Hex Decode */
@@ -75,7 +75,7 @@ static inline int ishex(int a)
(a >= '0' && a <= '9');
}
-static inline int fromhex(int a)
+static inline int from_hex(int a)
{
if (a >= 'A' && a <= 'F')
return a - 'A' + 0xA;
@@ -87,7 +87,7 @@ static inline int fromhex(int a)
}
static int
-readahxd(fz_stream *stm, unsigned char *buf, int len)
+read_ahxd(fz_stream *stm, unsigned char *buf, int len)
{
fz_ahxd *state = stm->state;
unsigned char *p = buf;
@@ -101,7 +101,7 @@ readahxd(fz_stream *stm, unsigned char *buf, int len)
if (state->eod)
return p - buf;
- c = fz_readbyte(state->chain);
+ c = fz_read_byte(state->chain);
if (c < 0)
return p - buf;
@@ -109,12 +109,12 @@ readahxd(fz_stream *stm, unsigned char *buf, int len)
{
if (!odd)
{
- a = fromhex(c);
+ a = from_hex(c);
odd = 1;
}
else
{
- b = fromhex(c);
+ b = from_hex(c);
*p++ = (a << 4) | b;
odd = 0;
}
@@ -135,7 +135,7 @@ readahxd(fz_stream *stm, unsigned char *buf, int len)
}
static void
-closeahxd(fz_stream *stm)
+close_ahxd(fz_stream *stm)
{
fz_ahxd *state = stm->state;
fz_close(state->chain);
@@ -143,7 +143,7 @@ closeahxd(fz_stream *stm)
}
fz_stream *
-fz_openahxd(fz_stream *chain)
+fz_open_ahxd(fz_stream *chain)
{
fz_ahxd *state;
@@ -151,7 +151,7 @@ fz_openahxd(fz_stream *chain)
state->chain = chain;
state->eod = 0;
- return fz_newstream(state, readahxd, closeahxd);
+ return fz_new_stream(state, read_ahxd, close_ahxd);
}
/* ASCII 85 Decode */
@@ -167,7 +167,7 @@ struct fz_a85d_s
};
static int
-reada85d(fz_stream *stm, unsigned char *buf, int len)
+read_a85d(fz_stream *stm, unsigned char *buf, int len)
{
fz_a85d *state = stm->state;
unsigned char *p = buf;
@@ -184,7 +184,7 @@ reada85d(fz_stream *stm, unsigned char *buf, int len)
if (state->eod)
return p - buf;
- c = fz_readbyte(state->chain);
+ c = fz_read_byte(state->chain);
if (c < 0)
return p - buf;
@@ -223,7 +223,7 @@ reada85d(fz_stream *stm, unsigned char *buf, int len)
else if (c == '~')
{
- c = fz_readbyte(state->chain);
+ c = fz_read_byte(state->chain);
if (c != '>')
fz_warn("bad eod marker in a85d");
@@ -270,7 +270,7 @@ reada85d(fz_stream *stm, unsigned char *buf, int len)
}
static void
-closea85d(fz_stream *stm)
+close_a85d(fz_stream *stm)
{
fz_a85d *state = stm->state;
fz_close(state->chain);
@@ -278,7 +278,7 @@ closea85d(fz_stream *stm)
}
fz_stream *
-fz_opena85d(fz_stream *chain)
+fz_open_a85d(fz_stream *chain)
{
fz_a85d *state;
@@ -288,7 +288,7 @@ fz_opena85d(fz_stream *chain)
state->wp = state->bp;
state->eod = 0;
- return fz_newstream(state, reada85d, closea85d);
+ return fz_new_stream(state, read_a85d, close_a85d);
}
/* Run Length Decode */
@@ -302,7 +302,7 @@ struct fz_rld_s
};
static int
-readrld(fz_stream *stm, unsigned char *buf, int len)
+read_rld(fz_stream *stm, unsigned char *buf, int len)
{
fz_rld *state = stm->state;
unsigned char *p = buf;
@@ -315,7 +315,7 @@ readrld(fz_stream *stm, unsigned char *buf, int len)
if (state->n == 0)
{
- state->run = fz_readbyte(state->chain);
+ state->run = fz_read_byte(state->chain);
if (state->run < 0)
state->run = 128;
if (state->run < 128)
@@ -323,7 +323,7 @@ readrld(fz_stream *stm, unsigned char *buf, int len)
if (state->run > 128)
{
state->n = 257 - state->run;
- state->c = fz_readbyte(state->chain);
+ state->c = fz_read_byte(state->chain);
if (state->c < 0)
return fz_throw("premature end of data in run length decode");
}
@@ -333,7 +333,7 @@ readrld(fz_stream *stm, unsigned char *buf, int len)
{
while (p < ep && state->n)
{
- int c = fz_readbyte(state->chain);
+ int c = fz_read_byte(state->chain);
if (c < 0)
return fz_throw("premature end of data in run length decode");
*p++ = c;
@@ -355,7 +355,7 @@ readrld(fz_stream *stm, unsigned char *buf, int len)
}
static void
-closerld(fz_stream *stm)
+close_rld(fz_stream *stm)
{
fz_rld *state = stm->state;
fz_close(state->chain);
@@ -363,7 +363,7 @@ closerld(fz_stream *stm)
}
fz_stream *
-fz_openrld(fz_stream *chain)
+fz_open_rld(fz_stream *chain)
{
fz_rld *state;
@@ -373,7 +373,7 @@ fz_openrld(fz_stream *chain)
state->n = 0;
state->c = 0;
- return fz_newstream(state, readrld, closerld);
+ return fz_new_stream(state, read_rld, close_rld);
}
/* RC4 Filter */
@@ -387,7 +387,7 @@ struct fz_arc4c_s
};
static int
-readarc4(fz_stream *stm, unsigned char *buf, int len)
+read_arc4(fz_stream *stm, unsigned char *buf, int len)
{
fz_arc4c *state = stm->state;
int n;
@@ -396,13 +396,13 @@ readarc4(fz_stream *stm, unsigned char *buf, int len)
if (n < 0)
return fz_rethrow(n, "read error in arc4 filter");
- fz_arc4encrypt(&state->arc4, buf, buf, n);
+ fz_arc4_encrypt(&state->arc4, buf, buf, n);
return n;
}
static void
-closearc4(fz_stream *stm)
+close_arc4(fz_stream *stm)
{
fz_arc4c *state = stm->state;
fz_close(state->chain);
@@ -410,15 +410,15 @@ closearc4(fz_stream *stm)
}
fz_stream *
-fz_openarc4(fz_stream *chain, unsigned char *key, unsigned keylen)
+fz_open_arc4(fz_stream *chain, unsigned char *key, unsigned keylen)
{
fz_arc4c *state;
state = fz_malloc(sizeof(fz_arc4c));
state->chain = chain;
- fz_arc4init(&state->arc4, key, keylen);
+ fz_arc4_init(&state->arc4, key, keylen);
- return fz_newstream(state, readarc4, closearc4);
+ return fz_new_stream(state, read_arc4, close_arc4);
}
/* AES Filter */
@@ -436,7 +436,7 @@ struct fz_aesd_s
};
static int
-readaesd(fz_stream *stm, unsigned char *buf, int len)
+read_aesd(fz_stream *stm, unsigned char *buf, int len)
{
fz_aesd *state = stm->state;
unsigned char *p = buf;
@@ -444,7 +444,7 @@ readaesd(fz_stream *stm, unsigned char *buf, int len)
while (state->ivcount < 16)
{
- int c = fz_readbyte(state->chain);
+ int c = fz_read_byte(state->chain);
if (c < 0)
return fz_throw("premature end in aes filter");
state->iv[state->ivcount++] = c;
@@ -468,7 +468,7 @@ readaesd(fz_stream *stm, unsigned char *buf, int len)
state->wp = state->bp + 16;
/* strip padding at end of file */
- if (fz_iseof(state->chain))
+ if (fz_is_eof(state->chain))
{
int pad = state->bp[15];
if (pad < 1 || pad > 16)
@@ -484,7 +484,7 @@ readaesd(fz_stream *stm, unsigned char *buf, int len)
}
static void
-closeaesd(fz_stream *stm)
+close_aesd(fz_stream *stm)
{
fz_aesd *state = stm->state;
fz_close(state->chain);
@@ -492,7 +492,7 @@ closeaesd(fz_stream *stm)
}
fz_stream *
-fz_openaesd(fz_stream *chain, unsigned char *key, unsigned keylen)
+fz_open_aesd(fz_stream *chain, unsigned char *key, unsigned keylen)
{
fz_aesd *state;
@@ -503,5 +503,5 @@ fz_openaesd(fz_stream *chain, unsigned char *key, unsigned keylen)
state->rp = state->bp;
state->wp = state->bp;
- return fz_newstream(state, readaesd, closeaesd);
+ return fz_new_stream(state, read_aesd, close_aesd);
}
diff --git a/fitz/filt_dctd.c b/fitz/filt_dctd.c
index 05c3db4d..0e24b794 100644
--- a/fitz/filt_dctd.c
+++ b/fitz/filt_dctd.c
@@ -8,7 +8,7 @@ typedef struct fz_dctd_s fz_dctd;
struct fz_dctd_s
{
fz_stream *chain;
- int colortransform;
+ int color_transform;
int init;
int stride;
unsigned char *scanline;
@@ -44,7 +44,7 @@ static boolean fill_input_buffer(j_decompress_ptr cinfo)
fz_stream *chain = state->chain;
chain->rp = chain->wp;
- fz_fillbuffer(chain);
+ fz_fill_buffer(chain);
src->next_input_byte = chain->rp;
src->bytes_in_buffer = chain->wp - chain->rp;
@@ -75,7 +75,7 @@ static void skip_input_data(j_decompress_ptr cinfo, long num_bytes)
}
static int
-readdctd(fz_stream *stm, unsigned char *buf, int len)
+read_dctd(fz_stream *stm, unsigned char *buf, int len)
{
fz_dctd *state = stm->state;
j_decompress_ptr cinfo = &state->cinfo;
@@ -113,28 +113,28 @@ readdctd(fz_stream *stm, unsigned char *buf, int len)
cinfo->do_fancy_upsampling = FALSE;
/* default value if ColorTransform is not set */
- if (state->colortransform == -1)
+ if (state->color_transform == -1)
{
if (state->cinfo.num_components == 3)
- state->colortransform = 1;
+ state->color_transform = 1;
else
- state->colortransform = 0;
+ state->color_transform = 0;
}
if (cinfo->saw_Adobe_marker)
- state->colortransform = cinfo->Adobe_transform;
+ state->color_transform = cinfo->Adobe_transform;
/* Guess the input colorspace, and set output colorspace accordingly */
switch (cinfo->num_components)
{
case 3:
- if (state->colortransform)
+ if (state->color_transform)
cinfo->jpeg_color_space = JCS_YCbCr;
else
cinfo->jpeg_color_space = JCS_RGB;
break;
case 4:
- if (state->colortransform)
+ if (state->color_transform)
cinfo->jpeg_color_space = JCS_YCCK;
else
cinfo->jpeg_color_space = JCS_CMYK;
@@ -179,7 +179,7 @@ readdctd(fz_stream *stm, unsigned char *buf, int len)
}
static void
-closedctd(fz_stream *stm)
+close_dctd(fz_stream *stm)
{
fz_dctd *state = stm->state;
@@ -202,7 +202,7 @@ skip:
}
fz_stream *
-fz_opendctd(fz_stream *chain, fz_obj *params)
+fz_open_dctd(fz_stream *chain, fz_obj *params)
{
fz_dctd *state;
fz_obj *obj;
@@ -210,12 +210,12 @@ fz_opendctd(fz_stream *chain, fz_obj *params)
state = fz_malloc(sizeof(fz_dctd));
memset(state, 0, sizeof(fz_dctd));
state->chain = chain;
- state->colortransform = -1; /* unset */
+ state->color_transform = -1; /* unset */
state->init = 0;
- obj = fz_dictgets(params, "ColorTransform");
+ obj = fz_dict_gets(params, "ColorTransform");
if (obj)
- state->colortransform = fz_toint(obj);
+ state->color_transform = fz_to_int(obj);
- return fz_newstream(state, readdctd, closedctd);
+ return fz_new_stream(state, read_dctd, close_dctd);
}
diff --git a/fitz/filt_faxd.c b/fitz/filt_faxd.c
index 714629e7..97076f89 100644
--- a/fitz/filt_faxd.c
+++ b/fitz/filt_faxd.c
@@ -171,7 +171,7 @@ const cfd_node cf_uncompressed_decode[] = {
/* bit magic */
static inline void
-printbits(FILE *f, int code, int nbits)
+print_bits(FILE *f, int code, int nbits)
{
int n, b;
for (n = nbits - 1; n >= 0; n--)
@@ -188,7 +188,7 @@ getbit(const unsigned char *buf, int x)
}
static inline void
-printline(FILE *f, unsigned char *line, int w)
+print_line(FILE *f, unsigned char *line, int w)
{
int i;
for (i = 0; i < w; i++)
@@ -197,7 +197,7 @@ printline(FILE *f, unsigned char *line, int w)
}
static inline int
-findchanging(const unsigned char *line, int x, int w)
+find_changing(const unsigned char *line, int x, int w)
{
int a, b;
@@ -227,15 +227,15 @@ findchanging(const unsigned char *line, int x, int w)
}
static inline int
-findchangingcolor(const unsigned char *line, int x, int w, int color)
+find_changing_color(const unsigned char *line, int x, int w, int color)
{
if (!line)
return w;
- x = findchanging(line, x, w);
+ x = find_changing(line, x, w);
if (x < w && getbit(line, x) != color)
- x = findchanging(line, x, w);
+ x = find_changing(line, x, w);
return x;
}
@@ -278,11 +278,11 @@ typedef struct fz_faxd_s fz_faxd;
enum
{
- SNORMAL, /* neutral state, waiting for any code */
- SMAKEUP, /* got a 1d makeup code, waiting for terminating code */
- SEOL, /* at eol, needs output buffer space */
- SH1, SH2, /* in H part 1 and 2 (both makeup and terminating codes) */
- SDONE /* all done */
+ STATE_NORMAL, /* neutral state, waiting for any code */
+ STATE_MAKEUP, /* got a 1d makeup code, waiting for terminating code */
+ STATE_EOL, /* at eol, needs output buffer space */
+ STATE_H1, STATE_H2, /* in H part 1 and 2 (both makeup and terminating codes) */
+ STATE_DONE /* all done */
};
struct fz_faxd_s
@@ -290,12 +290,12 @@ struct fz_faxd_s
fz_stream *chain;
int k;
- int endofline;
- int encodedbytealign;
+ int end_of_line;
+ int encoded_byte_align;
int columns;
int rows;
- int endofblock;
- int blackis1;
+ int end_of_block;
+ int black_is_1;
int stride;
int ridx;
@@ -312,18 +312,18 @@ struct fz_faxd_s
};
static inline void
-eatbits(fz_faxd *fax, int nbits)
+eat_bits(fz_faxd *fax, int nbits)
{
fax->word <<= nbits;
fax->bidx += nbits;
}
static inline int
-fillbits(fz_faxd *fax)
+fill_bits(fz_faxd *fax)
{
while (fax->bidx >= 8)
{
- int c = fz_readbyte(fax->chain);
+ int c = fz_read_byte(fax->chain);
if (c == EOF)
return EOF;
fax->bidx -= 8;
@@ -348,7 +348,7 @@ getcode(fz_faxd *fax, const cfd_node *table, int initialbits)
nbits = initialbits + table[tidx].nbits;
}
- eatbits(fax, nbits);
+ eat_bits(fax, nbits);
return val;
}
@@ -384,10 +384,10 @@ dec1d(fz_faxd *fax)
if (code < 64)
{
fax->c = !fax->c;
- fax->stage = SNORMAL;
+ fax->stage = STATE_NORMAL;
}
else
- fax->stage = SMAKEUP;
+ fax->stage = STATE_MAKEUP;
return fz_okay;
}
@@ -398,7 +398,7 @@ dec2d(fz_faxd *fax)
{
int code, b1, b2;
- if (fax->stage == SH1 || fax->stage == SH2)
+ if (fax->stage == STATE_H1 || fax->stage == STATE_H2)
{
if (fax->a == -1)
fax->a = 0;
@@ -425,10 +425,10 @@ dec2d(fz_faxd *fax)
if (code < 64)
{
fax->c = !fax->c;
- if (fax->stage == SH1)
- fax->stage = SH2;
- else if (fax->stage == SH2)
- fax->stage = SNORMAL;
+ if (fax->stage == STATE_H1)
+ fax->stage = STATE_H2;
+ else if (fax->stage == STATE_H2)
+ fax->stage = STATE_NORMAL;
}
return fz_okay;
@@ -439,28 +439,28 @@ dec2d(fz_faxd *fax)
switch (code)
{
case H:
- fax->stage = SH1;
+ fax->stage = STATE_H1;
break;
case P:
- b1 = findchangingcolor(fax->ref, fax->a, fax->columns, !fax->c);
+ b1 = find_changing_color(fax->ref, fax->a, fax->columns, !fax->c);
if (b1 >= fax->columns)
b2 = fax->columns;
else
- b2 = findchanging(fax->ref, b1, fax->columns);
+ b2 = find_changing(fax->ref, b1, fax->columns);
if (fax->c) setbits(fax->dst, fax->a, b2);
fax->a = b2;
break;
case V0:
- b1 = findchangingcolor(fax->ref, fax->a, fax->columns, !fax->c);
+ b1 = find_changing_color(fax->ref, fax->a, fax->columns, !fax->c);
if (fax->c) setbits(fax->dst, fax->a, b1);
fax->a = b1;
fax->c = !fax->c;
break;
case VR1:
- b1 = 1 + findchangingcolor(fax->ref, fax->a, fax->columns, !fax->c);
+ b1 = 1 + find_changing_color(fax->ref, fax->a, fax->columns, !fax->c);
if (b1 >= fax->columns) b1 = fax->columns;
if (fax->c) setbits(fax->dst, fax->a, b1);
fax->a = b1;
@@ -468,7 +468,7 @@ dec2d(fz_faxd *fax)
break;
case VR2:
- b1 = 2 + findchangingcolor(fax->ref, fax->a, fax->columns, !fax->c);
+ b1 = 2 + find_changing_color(fax->ref, fax->a, fax->columns, !fax->c);
if (b1 >= fax->columns) b1 = fax->columns;
if (fax->c) setbits(fax->dst, fax->a, b1);
fax->a = b1;
@@ -476,7 +476,7 @@ dec2d(fz_faxd *fax)
break;
case VR3:
- b1 = 3 + findchangingcolor(fax->ref, fax->a, fax->columns, !fax->c);
+ b1 = 3 + find_changing_color(fax->ref, fax->a, fax->columns, !fax->c);
if (b1 >= fax->columns) b1 = fax->columns;
if (fax->c) setbits(fax->dst, fax->a, b1);
fax->a = b1;
@@ -484,7 +484,7 @@ dec2d(fz_faxd *fax)
break;
case VL1:
- b1 = -1 + findchangingcolor(fax->ref, fax->a, fax->columns, !fax->c);
+ b1 = -1 + find_changing_color(fax->ref, fax->a, fax->columns, !fax->c);
if (b1 < 0) b1 = 0;
if (fax->c) setbits(fax->dst, fax->a, b1);
fax->a = b1;
@@ -492,7 +492,7 @@ dec2d(fz_faxd *fax)
break;
case VL2:
- b1 = -2 + findchangingcolor(fax->ref, fax->a, fax->columns, !fax->c);
+ b1 = -2 + find_changing_color(fax->ref, fax->a, fax->columns, !fax->c);
if (b1 < 0) b1 = 0;
if (fax->c) setbits(fax->dst, fax->a, b1);
fax->a = b1;
@@ -500,7 +500,7 @@ dec2d(fz_faxd *fax)
break;
case VL3:
- b1 = -3 + findchangingcolor(fax->ref, fax->a, fax->columns, !fax->c);
+ b1 = -3 + find_changing_color(fax->ref, fax->a, fax->columns, !fax->c);
if (b1 < 0) b1 = 0;
if (fax->c) setbits(fax->dst, fax->a, b1);
fax->a = b1;
@@ -521,7 +521,7 @@ dec2d(fz_faxd *fax)
}
static int
-readfaxd(fz_stream *stm, unsigned char *buf, int len)
+read_faxd(fz_stream *stm, unsigned char *buf, int len)
{
fz_faxd *fax = stm->state;
unsigned char *p = buf;
@@ -529,15 +529,15 @@ readfaxd(fz_stream *stm, unsigned char *buf, int len)
unsigned char *tmp;
fz_error error;
- if (fax->stage == SDONE)
+ if (fax->stage == STATE_DONE)
return 0;
- if (fax->stage == SEOL)
+ if (fax->stage == STATE_EOL)
goto eol;
loop:
- if (fillbits(fax))
+ if (fill_bits(fax))
{
if (fax->bidx > 31)
{
@@ -549,13 +549,13 @@ loop:
if ((fax->word >> (32 - 12)) == 0)
{
- eatbits(fax, 1);
+ eat_bits(fax, 1);
goto loop;
}
if ((fax->word >> (32 - 12)) == 1)
{
- eatbits(fax, 12);
+ eat_bits(fax, 12);
fax->eolc ++;
if (fax->k > 0)
@@ -566,7 +566,7 @@ loop:
fax->dim = 1;
else
fax->dim = 2;
- eatbits(fax, 1);
+ eat_bits(fax, 1);
}
}
else if (fax->k > 0 && fax->a == -1)
@@ -576,7 +576,7 @@ loop:
fax->dim = 1;
else
fax->dim = 2;
- eatbits(fax, 1);
+ eat_bits(fax, 1);
}
else if (fax->dim == 1)
{
@@ -594,7 +594,7 @@ loop:
}
/* no eol check after makeup codes nor in the middle of an H code */
- if (fax->stage == SMAKEUP || fax->stage == SH1 || fax->stage == SH2)
+ if (fax->stage == STATE_MAKEUP || fax->stage == STATE_H1 || fax->stage == STATE_H2)
goto loop;
/* check for eol conditions */
@@ -609,9 +609,9 @@ loop:
goto loop;
eol:
- fax->stage = SEOL;
+ fax->stage = STATE_EOL;
- if (fax->blackis1)
+ if (fax->black_is_1)
{
while (fax->rp < fax->wp && p < ep)
*p++ = *fax->rp++;
@@ -625,7 +625,6 @@ eol:
if (fax->rp < fax->wp)
return p - buf;
-
tmp = fax->ref;
fax->ref = fax->dst;
fax->dst = tmp;
@@ -634,12 +633,12 @@ eol:
fax->rp = fax->dst;
fax->wp = fax->dst + fax->stride;
- fax->stage = SNORMAL;
+ fax->stage = STATE_NORMAL;
fax->c = 0;
fax->a = -1;
fax->ridx ++;
- if (!fax->endofblock && fax->rows)
+ if (!fax->end_of_block && fax->rows)
{
if (fax->ridx >= fax->rows)
goto rtc;
@@ -654,13 +653,13 @@ eol:
fax->dim = 2;
}
- /* if endofline & encodedbytealign, EOLs are *not* optional */
- if (fax->encodedbytealign)
+ /* if end_of_line & encoded_byte_align, EOLs are *not* optional */
+ if (fax->encoded_byte_align)
{
- if (fax->endofline)
- eatbits(fax, (12 - fax->bidx) & 7);
+ if (fax->end_of_line)
+ eat_bits(fax, (12 - fax->bidx) & 7);
else
- eatbits(fax, (8 - fax->bidx) & 7);
+ eat_bits(fax, (8 - fax->bidx) & 7);
}
/* no more space in output, don't decode the next row yet */
@@ -670,12 +669,12 @@ eol:
goto loop;
rtc:
- fax->stage = SDONE;
+ fax->stage = STATE_DONE;
return p - buf;
}
static void
-closefaxd(fz_stream *stm)
+close_faxd(fz_stream *stm)
{
fz_faxd *fax = stm->state;
int i;
@@ -683,7 +682,7 @@ closefaxd(fz_stream *stm)
/* if we read any extra bytes, try to put them back */
i = (32 - fax->bidx) / 8;
while (i--)
- fz_unreadbyte(fax->chain);
+ fz_unread_byte(fax->chain);
fz_close(fax->chain);
fz_free(fax->ref);
@@ -692,7 +691,7 @@ closefaxd(fz_stream *stm)
}
fz_stream *
-fz_openfaxd(fz_stream *chain, fz_obj *params)
+fz_open_faxd(fz_stream *chain, fz_obj *params)
{
fz_faxd *fax;
fz_obj *obj;
@@ -700,44 +699,44 @@ fz_openfaxd(fz_stream *chain, fz_obj *params)
fax = fz_malloc(sizeof(fz_faxd));
fax->chain = chain;
- fax->ref = nil;
- fax->dst = nil;
+ fax->ref = NULL;
+ fax->dst = NULL;
fax->k = 0;
- fax->endofline = 0;
- fax->encodedbytealign = 0;
+ fax->end_of_line = 0;
+ fax->encoded_byte_align = 0;
fax->columns = 1728;
fax->rows = 0;
- fax->endofblock = 1;
- fax->blackis1 = 0;
+ fax->end_of_block = 1;
+ fax->black_is_1 = 0;
- obj = fz_dictgets(params, "K");
- if (obj) fax->k = fz_toint(obj);
+ obj = fz_dict_gets(params, "K");
+ if (obj) fax->k = fz_to_int(obj);
- obj = fz_dictgets(params, "EndOfLine");
- if (obj) fax->endofline = fz_tobool(obj);
+ obj = fz_dict_gets(params, "EndOfLine");
+ if (obj) fax->end_of_line = fz_to_bool(obj);
- obj = fz_dictgets(params, "EncodedByteAlign");
- if (obj) fax->encodedbytealign = fz_tobool(obj);
+ obj = fz_dict_gets(params, "EncodedByteAlign");
+ if (obj) fax->encoded_byte_align = fz_to_bool(obj);
- obj = fz_dictgets(params, "Columns");
- if (obj) fax->columns = fz_toint(obj);
+ obj = fz_dict_gets(params, "Columns");
+ if (obj) fax->columns = fz_to_int(obj);
- obj = fz_dictgets(params, "Rows");
- if (obj) fax->rows = fz_toint(obj);
+ obj = fz_dict_gets(params, "Rows");
+ if (obj) fax->rows = fz_to_int(obj);
- obj = fz_dictgets(params, "EndOfBlock");
- if (obj) fax->endofblock = fz_tobool(obj);
+ obj = fz_dict_gets(params, "EndOfBlock");
+ if (obj) fax->end_of_block = fz_to_bool(obj);
- obj = fz_dictgets(params, "BlackIs1");
- if (obj) fax->blackis1 = fz_tobool(obj);
+ obj = fz_dict_gets(params, "BlackIs1");
+ if (obj) fax->black_is_1 = fz_to_bool(obj);
fax->stride = ((fax->columns - 1) >> 3) + 1;
fax->ridx = 0;
fax->bidx = 32;
fax->word = 0;
- fax->stage = SNORMAL;
+ fax->stage = STATE_NORMAL;
fax->a = -1;
fax->c = 0;
fax->dim = fax->k < 0 ? 2 : 1;
@@ -751,5 +750,5 @@ fz_openfaxd(fz_stream *chain, fz_obj *params)
memset(fax->ref, 0, fax->stride);
memset(fax->dst, 0, fax->stride);
- return fz_newstream(fax, readfaxd, closefaxd);
+ return fz_new_stream(fax, read_faxd, close_faxd);
}
diff --git a/fitz/filt_flate.c b/fitz/filt_flate.c
index 0d14a75c..e7d4c9f7 100644
--- a/fitz/filt_flate.c
+++ b/fitz/filt_flate.c
@@ -21,7 +21,7 @@ static void zfree(void *opaque, void *ptr)
}
static int
-readflated(fz_stream *stm, unsigned char *outbuf, int outlen)
+read_flated(fz_stream *stm, unsigned char *outbuf, int outlen)
{
fz_flate *state = stm->state;
fz_stream *chain = state->chain;
@@ -34,7 +34,7 @@ readflated(fz_stream *stm, unsigned char *outbuf, int outlen)
while (zp->avail_out > 0)
{
if (chain->rp == chain->wp)
- fz_fillbuffer(chain);
+ fz_fill_buffer(chain);
zp->next_in = chain->rp;
zp->avail_in = chain->wp - chain->rp;
@@ -67,7 +67,7 @@ readflated(fz_stream *stm, unsigned char *outbuf, int outlen)
}
static void
-closeflated(fz_stream *stm)
+close_flated(fz_stream *stm)
{
fz_flate *state = stm->state;
int code;
@@ -81,7 +81,7 @@ closeflated(fz_stream *stm)
}
fz_stream *
-fz_openflated(fz_stream *chain)
+fz_open_flated(fz_stream *chain)
{
fz_flate *state;
int code;
@@ -91,13 +91,13 @@ fz_openflated(fz_stream *chain)
state->z.zalloc = zalloc;
state->z.zfree = zfree;
- state->z.opaque = nil;
- state->z.next_in = nil;
+ state->z.opaque = NULL;
+ state->z.next_in = NULL;
state->z.avail_in = 0;
code = inflateInit(&state->z);
if (code != Z_OK)
fz_warn("zlib error: inflateInit: %s", state->z.msg);
- return fz_newstream(state, readflated, closeflated);
+ return fz_new_stream(state, read_flated, close_flated);
}
diff --git a/fitz/filt_jbig2d.c b/fitz/filt_jbig2d.c
index 8804ef29..4dbe542c 100644
--- a/fitz/filt_jbig2d.c
+++ b/fitz/filt_jbig2d.c
@@ -29,7 +29,7 @@ struct fz_jbig2d_s
};
static void
-closejbig2d(fz_stream *stm)
+close_jbig2d(fz_stream *stm)
{
fz_jbig2d *state = stm->state;
if (state->page)
@@ -42,7 +42,7 @@ closejbig2d(fz_stream *stm)
}
static int
-readjbig2d(fz_stream *stm, unsigned char *buf, int len)
+read_jbig2d(fz_stream *stm, unsigned char *buf, int len)
{
fz_jbig2d *state = stm->state;
unsigned char tmp[4096];
@@ -81,23 +81,23 @@ readjbig2d(fz_stream *stm, unsigned char *buf, int len)
}
fz_stream *
-fz_openjbig2d(fz_stream *chain, fz_buffer *globals)
+fz_open_jbig2d(fz_stream *chain, fz_buffer *globals)
{
fz_jbig2d *state;
state = fz_malloc(sizeof(fz_jbig2d));
state->chain = chain;
- state->ctx = jbig2_ctx_new(nil, JBIG2_OPTIONS_EMBEDDED, nil, nil, nil);
- state->gctx = nil;
- state->page = nil;
+ state->ctx = jbig2_ctx_new(NULL, JBIG2_OPTIONS_EMBEDDED, NULL, NULL, NULL);
+ state->gctx = NULL;
+ state->page = NULL;
state->idx = 0;
if (globals)
{
jbig2_data_in(state->ctx, globals->data, globals->len);
state->gctx = jbig2_make_global_ctx(state->ctx);
- state->ctx = jbig2_ctx_new(nil, JBIG2_OPTIONS_EMBEDDED, state->gctx, nil, nil);
+ state->ctx = jbig2_ctx_new(NULL, JBIG2_OPTIONS_EMBEDDED, state->gctx, NULL, NULL);
}
- return fz_newstream(state, readjbig2d, closejbig2d);
+ return fz_new_stream(state, read_jbig2d, close_jbig2d);
}
diff --git a/fitz/filt_jpxd.c b/fitz/filt_jpxd.c
index 3ec06ab3..f5a65851 100644
--- a/fitz/filt_jpxd.c
+++ b/fitz/filt_jpxd.c
@@ -19,7 +19,7 @@ static void fz_opj_info_callback(const char *msg, void *client_data)
}
fz_error
-fz_loadjpximage(fz_pixmap **imgp, unsigned char *data, int size)
+fz_load_jpx_image(fz_pixmap **imgp, unsigned char *data, int size)
{
fz_pixmap *img;
opj_event_mgr_t evtmgr;
@@ -81,16 +81,16 @@ fz_loadjpximage(fz_pixmap **imgp, unsigned char *data, int size)
switch (n)
{
- case 1: colorspace = fz_devicegray; break;
- case 3: colorspace = fz_devicergb; break;
- case 4: colorspace = fz_devicecmyk; break;
+ case 1: colorspace = fz_device_gray; break;
+ case 3: colorspace = fz_device_rgb; break;
+ case 4: colorspace = fz_device_cmyk; break;
default:
/* TODO: SMaskInData */
opj_image_destroy(jpx);
return fz_throw("unknown jpx colorspace (%d components)", n);
}
- img = fz_newpixmap(colorspace, 0, 0, w, h);
+ img = fz_new_pixmap(colorspace, 0, 0, w, h);
p = img->samples;
for (y = 0; y < h; y++)
diff --git a/fitz/filt_lzwd.c b/fitz/filt_lzwd.c
index 23cb7520..942e5837 100644
--- a/fitz/filt_lzwd.c
+++ b/fitz/filt_lzwd.c
@@ -4,13 +4,13 @@
enum
{
- MINBITS = 9,
- MAXBITS = 12,
- NUMCODES = (1 << MAXBITS),
+ MIN_BITS = 9,
+ MAX_BITS = 12,
+ NUM_CODES = (1 << MAX_BITS),
LZW_CLEAR = 256,
LZW_EOD = 257,
LZW_FIRST = 258,
- MAXLENGTH = 4097
+ MAX_LENGTH = 4097
};
typedef struct lzw_code_s lzw_code;
@@ -20,7 +20,7 @@ struct lzw_code_s
int prev; /* prev code (in string) */
unsigned short length; /* string len, including this token */
unsigned char value; /* data value */
- unsigned char firstchar; /* first token of string */
+ unsigned char first_char; /* first token of string */
};
typedef struct fz_lzwd_s fz_lzwd;
@@ -30,21 +30,21 @@ struct fz_lzwd_s
fz_stream *chain;
int eod;
- int earlychange;
+ int early_change;
- int codebits; /* num bits/code */
+ int code_bits; /* num bits/code */
int code; /* current code */
- int oldcode; /* previously recognized code */
- int nextcode; /* next free entry */
+ int old_code; /* previously recognized code */
+ int next_code; /* next free entry */
- lzw_code table[NUMCODES];
+ lzw_code table[NUM_CODES];
- unsigned char bp[MAXLENGTH];
+ unsigned char bp[MAX_LENGTH];
unsigned char *rp, *wp;
};
static int
-readlzwd(fz_stream *stm, unsigned char *buf, int len)
+read_lzwd(fz_stream *stm, unsigned char *buf, int len)
{
fz_lzwd *lzw = stm->state;
lzw_code *table = lzw->table;
@@ -53,10 +53,10 @@ readlzwd(fz_stream *stm, unsigned char *buf, int len)
unsigned char *s;
int codelen;
- int codebits = lzw->codebits;
+ int code_bits = lzw->code_bits;
int code = lzw->code;
- int oldcode = lzw->oldcode;
- int nextcode = lzw->nextcode;
+ int old_code = lzw->old_code;
+ int next_code = lzw->next_code;
while (lzw->rp < lzw->wp && p < ep)
*p++ = *lzw->rp++;
@@ -66,9 +66,9 @@ readlzwd(fz_stream *stm, unsigned char *buf, int len)
if (lzw->eod)
return 0;
- code = fz_readbits(lzw->chain, codebits);
+ code = fz_read_bits(lzw->chain, code_bits);
- if (fz_iseofbits(lzw->chain))
+ if (fz_is_eof_bits(lzw->chain))
{
lzw->eod = 1;
break;
@@ -82,40 +82,40 @@ readlzwd(fz_stream *stm, unsigned char *buf, int len)
if (code == LZW_CLEAR)
{
- codebits = MINBITS;
- nextcode = LZW_FIRST;
- oldcode = -1;
+ code_bits = MIN_BITS;
+ next_code = LZW_FIRST;
+ old_code = -1;
continue;
}
- /* if stream starts without a clear code, oldcode is undefined... */
- if (oldcode == -1)
+ /* if stream starts without a clear code, old_code is undefined... */
+ if (old_code == -1)
{
- oldcode = code;
+ old_code = code;
}
else
{
/* add new entry to the code table */
- table[nextcode].prev = oldcode;
- table[nextcode].firstchar = table[oldcode].firstchar;
- table[nextcode].length = table[oldcode].length + 1;
- if (code < nextcode)
- table[nextcode].value = table[code].firstchar;
- else if (code == nextcode)
- table[nextcode].value = table[nextcode].firstchar;
+ table[next_code].prev = old_code;
+ table[next_code].first_char = table[old_code].first_char;
+ table[next_code].length = table[old_code].length + 1;
+ if (code < next_code)
+ table[next_code].value = table[code].first_char;
+ else if (code == next_code)
+ table[next_code].value = table[next_code].first_char;
else
fz_warn("out of range code encountered in lzw decode");
- nextcode ++;
+ next_code ++;
- if (nextcode > (1 << codebits) - lzw->earlychange - 1)
+ if (next_code > (1 << code_bits) - lzw->early_change - 1)
{
- codebits ++;
- if (codebits > MAXBITS)
- codebits = MAXBITS; /* FIXME */
+ code_bits ++;
+ if (code_bits > MAX_BITS)
+ code_bits = MAX_BITS; /* FIXME */
}
- oldcode = code;
+ old_code = code;
}
/* code maps to a string, copy to output (in reverse...) */
@@ -125,7 +125,7 @@ readlzwd(fz_stream *stm, unsigned char *buf, int len)
lzw->rp = lzw->bp;
lzw->wp = lzw->bp + codelen;
- assert(codelen < MAXLENGTH);
+ assert(codelen < MAX_LENGTH);
s = lzw->wp;
do {
@@ -147,16 +147,16 @@ readlzwd(fz_stream *stm, unsigned char *buf, int len)
*p++ = *lzw->rp++;
}
- lzw->codebits = codebits;
+ lzw->code_bits = code_bits;
lzw->code = code;
- lzw->oldcode = oldcode;
- lzw->nextcode = nextcode;
+ lzw->old_code = old_code;
+ lzw->next_code = next_code;
return p - buf;
}
static void
-closelzwd(fz_stream *stm)
+close_lzwd(fz_stream *stm)
{
fz_lzwd *lzw = stm->state;
fz_close(lzw->chain);
@@ -164,7 +164,7 @@ closelzwd(fz_stream *stm)
}
fz_stream *
-fz_openlzwd(fz_stream *chain, fz_obj *params)
+fz_open_lzwd(fz_stream *chain, fz_obj *params)
{
fz_lzwd *lzw;
fz_obj *obj;
@@ -173,34 +173,34 @@ fz_openlzwd(fz_stream *chain, fz_obj *params)
lzw = fz_malloc(sizeof(fz_lzwd));
lzw->chain = chain;
lzw->eod = 0;
- lzw->earlychange = 1;
+ lzw->early_change = 1;
- obj = fz_dictgets(params, "EarlyChange");
+ obj = fz_dict_gets(params, "EarlyChange");
if (obj)
- lzw->earlychange = !!fz_toint(obj);
+ lzw->early_change = !!fz_to_int(obj);
for (i = 0; i < 256; i++)
{
lzw->table[i].value = i;
- lzw->table[i].firstchar = i;
+ lzw->table[i].first_char = i;
lzw->table[i].length = 1;
lzw->table[i].prev = -1;
}
- for (i = 256; i < NUMCODES; i++)
+ for (i = 256; i < NUM_CODES; i++)
{
lzw->table[i].value = 0;
- lzw->table[i].firstchar = 0;
+ lzw->table[i].first_char = 0;
lzw->table[i].length = 0;
lzw->table[i].prev = -1;
}
- lzw->codebits = MINBITS;
+ lzw->code_bits = MIN_BITS;
lzw->code = -1;
- lzw->nextcode = LZW_FIRST;
- lzw->oldcode = -1;
+ lzw->next_code = LZW_FIRST;
+ lzw->old_code = -1;
lzw->rp = lzw->bp;
lzw->wp = lzw->bp;
- return fz_newstream(lzw, readlzwd, closelzwd);
+ return fz_new_stream(lzw, read_lzwd, close_lzwd);
}
diff --git a/fitz/filt_predict.c b/fitz/filt_predict.c
index ae2d1aaf..1501fc09 100644
--- a/fitz/filt_predict.c
+++ b/fitz/filt_predict.c
@@ -60,7 +60,7 @@ paeth(int a, int b, int c)
}
static void
-fz_predicttiff(fz_predict *state, unsigned char *out, unsigned char *in, int len)
+fz_predict_tiff(fz_predict *state, unsigned char *out, unsigned char *in, int len)
{
int left[MAXC];
int i, k;
@@ -82,7 +82,7 @@ fz_predicttiff(fz_predict *state, unsigned char *out, unsigned char *in, int len
}
static void
-fz_predictpng(fz_predict *state, unsigned char *out, unsigned char *in, int len, int predictor)
+fz_predict_png(fz_predict *state, unsigned char *out, unsigned char *in, int len, int predictor)
{
int bpp = state->bpp;
int i;
@@ -141,7 +141,7 @@ fz_predictpng(fz_predict *state, unsigned char *out, unsigned char *in, int len,
}
static int
-readpredict(fz_stream *stm, unsigned char *buf, int len)
+read_predict(fz_stream *stm, unsigned char *buf, int len)
{
fz_predict *state = stm->state;
unsigned char *p = buf;
@@ -163,10 +163,10 @@ readpredict(fz_stream *stm, unsigned char *buf, int len)
if (state->predictor == 1)
memcpy(state->out, state->in, n);
else if (state->predictor == 2)
- fz_predicttiff(state, state->out, state->in, n);
+ fz_predict_tiff(state, state->out, state->in, n);
else
{
- fz_predictpng(state, state->out, state->in + 1, n - 1, state->in[0]);
+ fz_predict_png(state, state->out, state->in + 1, n - 1, state->in[0]);
memcpy(state->ref, state->out, state->stride);
}
@@ -181,7 +181,7 @@ readpredict(fz_stream *stm, unsigned char *buf, int len)
}
static void
-closepredict(fz_stream *stm)
+close_predict(fz_stream *stm)
{
fz_predict *state = stm->state;
fz_close(state->chain);
@@ -192,7 +192,7 @@ closepredict(fz_stream *stm)
}
fz_stream *
-fz_openpredict(fz_stream *chain, fz_obj *params)
+fz_open_predict(fz_stream *chain, fz_obj *params)
{
fz_predict *state;
fz_obj *obj;
@@ -205,9 +205,9 @@ fz_openpredict(fz_stream *chain, fz_obj *params)
state->colors = 1;
state->bpc = 8;
- obj = fz_dictgets(params, "Predictor");
+ obj = fz_dict_gets(params, "Predictor");
if (obj)
- state->predictor = fz_toint(obj);
+ state->predictor = fz_to_int(obj);
if (state->predictor != 1 && state->predictor != 2 &&
state->predictor != 10 && state->predictor != 11 &&
@@ -218,17 +218,17 @@ fz_openpredict(fz_stream *chain, fz_obj *params)
state->predictor = 1;
}
- obj = fz_dictgets(params, "Columns");
+ obj = fz_dict_gets(params, "Columns");
if (obj)
- state->columns = fz_toint(obj);
+ state->columns = fz_to_int(obj);
- obj = fz_dictgets(params, "Colors");
+ obj = fz_dict_gets(params, "Colors");
if (obj)
- state->colors = fz_toint(obj);
+ state->colors = fz_to_int(obj);
- obj = fz_dictgets(params, "BitsPerComponent");
+ obj = fz_dict_gets(params, "BitsPerComponent");
if (obj)
- state->bpc = fz_toint(obj);
+ state->bpc = fz_to_int(obj);
state->stride = (state->bpc * state->colors * state->columns + 7) / 8;
state->bpp = (state->bpc * state->colors + 7) / 8;
@@ -241,5 +241,5 @@ fz_openpredict(fz_stream *chain, fz_obj *params)
memset(state->ref, 0, state->stride);
- return fz_newstream(state, readpredict, closepredict);
+ return fz_new_stream(state, read_predict, close_predict);
}
diff --git a/fitz/fitz.h b/fitz/fitz.h
index b8972871..c765da87 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -18,8 +18,6 @@
#include <float.h> /* FLT_EPSILON */
#include <fcntl.h> /* O_RDONLY & co */
-#define nil ((void*)0)
-
#define nelem(x) (sizeof(x)/sizeof((x)[0]))
/*
@@ -63,33 +61,33 @@ int gettimeofday(struct timeval *tv, struct timezone *tz);
#if __STDC_VERSION__ == 199901L /* C99 */
-#define fz_throw(...) fz_throwimp(__FILE__, __LINE__, __func__, __VA_ARGS__)
-#define fz_rethrow(cause, ...) fz_rethrowimp(__FILE__, __LINE__, __func__, cause, __VA_ARGS__)
-#define fz_catch(cause, ...) fz_catchimp(__FILE__, __LINE__, __func__, cause, __VA_ARGS__)
+#define fz_throw(...) fz_throw_imp(__FILE__, __LINE__, __func__, __VA_ARGS__)
+#define fz_rethrow(cause, ...) fz_rethrow_imp(__FILE__, __LINE__, __func__, cause, __VA_ARGS__)
+#define fz_catch(cause, ...) fz_catch_imp(__FILE__, __LINE__, __func__, cause, __VA_ARGS__)
#elif _MSC_VER >= 1500 /* MSVC 9 or newer */
#define inline __inline
#define restrict __restrict
-#define fz_throw(...) fz_throwimp(__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
-#define fz_rethrow(cause, ...) fz_rethrowimp(__FILE__, __LINE__, __FUNCTION__, cause, __VA_ARGS__)
-#define fz_catch(cause, ...) fz_catchimp(__FILE__, __LINE__, __FUNCTION__, cause, __VA_ARGS__)
+#define fz_throw(...) fz_throw_imp(__FILE__, __LINE__, __FUNCTION__, __VA_ARGS__)
+#define fz_rethrow(cause, ...) fz_rethrow_imp(__FILE__, __LINE__, __FUNCTION__, cause, __VA_ARGS__)
+#define fz_catch(cause, ...) fz_catch_imp(__FILE__, __LINE__, __FUNCTION__, cause, __VA_ARGS__)
#elif __GNUC__ >= 3 /* GCC 3 or newer */
#define inline __inline
#define restrict __restrict
-#define fz_throw(fmt...) fz_throwimp(__FILE__, __LINE__, __FUNCTION__, fmt)
-#define fz_rethrow(cause, fmt...) fz_rethrowimp(__FILE__, __LINE__, __FUNCTION__, cause, fmt)
-#define fz_catch(cause, fmt...) fz_catchimp(__FILE__, __LINE__, __FUNCTION__, cause, fmt)
+#define fz_throw(fmt...) fz_throw_imp(__FILE__, __LINE__, __FUNCTION__, fmt)
+#define fz_rethrow(cause, fmt...) fz_rethrow_imp(__FILE__, __LINE__, __FUNCTION__, cause, fmt)
+#define fz_catch(cause, fmt...) fz_catch_imp(__FILE__, __LINE__, __FUNCTION__, cause, fmt)
#else /* Unknown or ancient */
#define inline
#define restrict
-#define fz_throw fz_throwimpx
-#define fz_rethrow fz_rethrowimpx
-#define fz_catch fz_catchimpx
+#define fz_throw fz_throw_impx
+#define fz_rethrow fz_rethrow_impx
+#define fz_catch fz_catch_impx
#endif
@@ -113,21 +111,21 @@ int gettimeofday(struct timeval *tv, struct timezone *tz);
typedef int fz_error;
void fz_warn(char *fmt, ...) __printflike(1, 2);
-void fz_flushwarnings(void);
+void fz_flush_warnings(void);
-fz_error fz_throwimp(const char *file, int line, const char *func, char *fmt, ...) __printflike(4, 5);
-fz_error fz_rethrowimp(const char *file, int line, const char *func, fz_error cause, char *fmt, ...) __printflike(5, 6);
-void fz_catchimp(const char *file, int line, const char *func, fz_error cause, char *fmt, ...) __printflike(5, 6);
+fz_error fz_throw_imp(const char *file, int line, const char *func, char *fmt, ...) __printflike(4, 5);
+fz_error fz_rethrow_imp(const char *file, int line, const char *func, fz_error cause, char *fmt, ...) __printflike(5, 6);
+void fz_catch_imp(const char *file, int line, const char *func, fz_error cause, char *fmt, ...) __printflike(5, 6);
-fz_error fz_throwimpx(char *fmt, ...) __printflike(1, 2);
-fz_error fz_rethrowimpx(fz_error cause, char *fmt, ...) __printflike(2, 3);
-void fz_catchimpx(fz_error cause, char *fmt, ...) __printflike(2, 3);
+fz_error fz_throw_impx(char *fmt, ...) __printflike(1, 2);
+fz_error fz_rethrow_impx(fz_error cause, char *fmt, ...) __printflike(2, 3);
+void fz_catch_impx(fz_error cause, char *fmt, ...) __printflike(2, 3);
#define fz_okay ((fz_error)0)
/* extract the last error stack trace */
-int fz_geterrorcount(void);
-char *fz_geterrorline(int n);
+int fz_get_error_count(void);
+char *fz_get_error_line(int n);
/*
* Basic runtime and utility functions
@@ -146,7 +144,7 @@ void fz_free(void *p);
char *fz_strdup(char *s);
/* runtime (hah!) test for endian-ness */
-int fz_isbigendian(void);
+int fz_is_big_endian(void);
/* safe string functions */
char *fz_strsep(char **stringp, const char *delim);
@@ -167,20 +165,20 @@ extern char *fz_optarg;
* Generic hash-table with fixed-length keys.
*/
-typedef struct fz_hashtable_s fz_hashtable;
+typedef struct fz_hash_table_s fz_hash_table;
-fz_hashtable *fz_newhash(int initialsize, int keylen);
-void fz_debughash(fz_hashtable *table);
-void fz_emptyhash(fz_hashtable *table);
-void fz_freehash(fz_hashtable *table);
+fz_hash_table *fz_new_hash_table(int initialsize, int keylen);
+void fz_debug_hash(fz_hash_table *table);
+void fz_empty_hash(fz_hash_table *table);
+void fz_free_hash(fz_hash_table *table);
-void *fz_hashfind(fz_hashtable *table, void *key);
-void fz_hashinsert(fz_hashtable *table, void *key, void *val);
-void fz_hashremove(fz_hashtable *table, void *key);
+void *fz_hash_find(fz_hash_table *table, void *key);
+void fz_hash_insert(fz_hash_table *table, void *key, void *val);
+void fz_hash_remove(fz_hash_table *table, void *key);
-int fz_hashlen(fz_hashtable *table);
-void *fz_hashgetkey(fz_hashtable *table, int idx);
-void *fz_hashgetval(fz_hashtable *table, int idx);
+int fz_hash_len(fz_hash_table *table);
+void *fz_hash_get_key(fz_hash_table *table, int idx);
+void *fz_hash_get_val(fz_hash_table *table, int idx);
/*
* Math and geometry
@@ -203,7 +201,7 @@ static inline int fz_mul255(int a, int b)
#define FZ_COMBINE(A,B) (((A)*(B))>>8)
/* Combine values A and C (in the same (any) range) and B and D (in the
- * 0..256 range), to give a single value in the same range as A and C were. */
+ * 0..256 range), to give a single value in the same range as A and C were. */
#define FZ_COMBINE2(A,B,C,D) (FZ_COMBINE((A), (B)) + FZ_COMBINE((C), (D)))
/* Blend SRC and DST (in the same range) together according to
@@ -215,18 +213,18 @@ typedef struct fz_point_s fz_point;
typedef struct fz_rect_s fz_rect;
typedef struct fz_bbox_s fz_bbox;
-extern const fz_rect fz_unitrect;
-extern const fz_rect fz_emptyrect;
-extern const fz_rect fz_infiniterect;
+extern const fz_rect fz_unit_rect;
+extern const fz_rect fz_empty_rect;
+extern const fz_rect fz_infinite_rect;
-extern const fz_bbox fz_unitbbox;
-extern const fz_bbox fz_emptybbox;
-extern const fz_bbox fz_infinitebbox;
+extern const fz_bbox fz_unit_bbox;
+extern const fz_bbox fz_empty_bbox;
+extern const fz_bbox fz_infinite_bbox;
-#define fz_isemptyrect(r) ((r).x0 == (r).x1)
-#define fz_isinfiniterect(r) ((r).x0 > (r).x1)
-#define fz_isemptybbox(b) ((b).x0 == (b).x1)
-#define fz_isinfinitebbox(b) ((b).x0 > (b).x1)
+#define fz_is_empty_rect(r) ((r).x0 == (r).x1)
+#define fz_is_infinite_rect(r) ((r).x0 > (r).x1)
+#define fz_is_empty_bbox(b) ((b).x0 == (b).x1)
+#define fz_is_infinite_bbox(b) ((b).x0 > (b).x1)
struct fz_matrix_s
{
@@ -256,18 +254,18 @@ fz_matrix fz_concat(fz_matrix one, fz_matrix two);
fz_matrix fz_scale(float sx, float sy);
fz_matrix fz_rotate(float theta);
fz_matrix fz_translate(float tx, float ty);
-fz_matrix fz_invertmatrix(fz_matrix m);
-int fz_isrectilinear(fz_matrix m);
-float fz_matrixexpansion(fz_matrix m);
+fz_matrix fz_invert_matrix(fz_matrix m);
+int fz_is_rectilinear(fz_matrix m);
+float fz_matrix_expansion(fz_matrix m);
-fz_bbox fz_roundrect(fz_rect r);
-fz_bbox fz_intersectbbox(fz_bbox a, fz_bbox b);
-fz_bbox fz_unionbbox(fz_bbox a, fz_bbox b);
+fz_bbox fz_round_rect(fz_rect r);
+fz_bbox fz_intersect_bbox(fz_bbox a, fz_bbox b);
+fz_bbox fz_union_bbox(fz_bbox a, fz_bbox b);
-fz_point fz_transformpoint(fz_matrix m, fz_point p);
-fz_point fz_transformvector(fz_matrix m, fz_point p);
-fz_rect fz_transformrect(fz_matrix m, fz_rect r);
-fz_bbox fz_transformbbox(fz_matrix m, fz_bbox b);
+fz_point fz_transform_point(fz_matrix m, fz_point p);
+fz_point fz_transform_vector(fz_matrix m, fz_point p);
+fz_rect fz_transform_rect(fz_matrix m, fz_rect r);
+fz_bbox fz_transform_bbox(fz_matrix m, fz_bbox b);
/*
* Basic crypto functions.
@@ -286,9 +284,9 @@ struct fz_md5_s
unsigned char buffer[64];
};
-void fz_md5init(fz_md5 *state);
-void fz_md5update(fz_md5 *state, const unsigned char *input, const unsigned inlen);
-void fz_md5final(fz_md5 *state, unsigned char digest[16]);
+void fz_md5_init(fz_md5 *state);
+void fz_md5_update(fz_md5 *state, const unsigned char *input, const unsigned inlen);
+void fz_md5_final(fz_md5 *state, unsigned char digest[16]);
/* sha-256 digests */
@@ -304,9 +302,9 @@ struct fz_sha256_s
} buffer;
};
-void fz_sha256init(fz_sha256 *state);
-void fz_sha256update(fz_sha256 *state, const unsigned char *input, unsigned int inlen);
-void fz_sha256final(fz_sha256 *state, unsigned char digest[32]);
+void fz_sha256_init(fz_sha256 *state);
+void fz_sha256_update(fz_sha256 *state, const unsigned char *input, unsigned int inlen);
+void fz_sha256_final(fz_sha256 *state, unsigned char digest[32]);
/* arc4 crypto */
@@ -319,8 +317,8 @@ struct fz_arc4_s
unsigned char state[256];
};
-void fz_arc4init(fz_arc4 *state, const unsigned char *key, const unsigned len);
-void fz_arc4encrypt(fz_arc4 *state, unsigned char *dest, const unsigned char *src, const unsigned len);
+void fz_arc4_init(fz_arc4 *state, const unsigned char *key, const unsigned len);
+void fz_arc4_encrypt(fz_arc4 *state, unsigned char *dest, const unsigned char *src, const unsigned len);
/* AES block cipher implementation from XYSSL */
@@ -406,69 +404,69 @@ struct fz_obj_s
} u;
};
-extern fz_obj* (*fz_resolveindirect)(fz_obj*);
+extern fz_obj* (*fz_resolve_indirect)(fz_obj*);
-fz_obj *fz_newnull(void);
-fz_obj *fz_newbool(int b);
-fz_obj *fz_newint(int i);
-fz_obj *fz_newreal(float f);
-fz_obj *fz_newname(char *str);
-fz_obj *fz_newstring(char *str, int len);
-fz_obj *fz_newindirect(int num, int gen, void *xref);
+fz_obj *fz_new_null(void);
+fz_obj *fz_new_bool(int b);
+fz_obj *fz_new_int(int i);
+fz_obj *fz_new_real(float f);
+fz_obj *fz_new_name(char *str);
+fz_obj *fz_new_string(char *str, int len);
+fz_obj *fz_new_indirect(int num, int gen, void *xref);
-fz_obj *fz_newarray(int initialcap);
-fz_obj *fz_newdict(int initialcap);
-fz_obj *fz_copyarray(fz_obj *array);
-fz_obj *fz_copydict(fz_obj *dict);
+fz_obj *fz_new_array(int initialcap);
+fz_obj *fz_new_dict(int initialcap);
+fz_obj *fz_copy_array(fz_obj *array);
+fz_obj *fz_copy_dict(fz_obj *dict);
-fz_obj *fz_keepobj(fz_obj *obj);
-void fz_dropobj(fz_obj *obj);
+fz_obj *fz_keep_obj(fz_obj *obj);
+void fz_drop_obj(fz_obj *obj);
/* type queries */
-int fz_isnull(fz_obj *obj);
-int fz_isbool(fz_obj *obj);
-int fz_isint(fz_obj *obj);
-int fz_isreal(fz_obj *obj);
-int fz_isname(fz_obj *obj);
-int fz_isstring(fz_obj *obj);
-int fz_isarray(fz_obj *obj);
-int fz_isdict(fz_obj *obj);
-int fz_isindirect(fz_obj *obj);
+int fz_is_null(fz_obj *obj);
+int fz_is_bool(fz_obj *obj);
+int fz_is_int(fz_obj *obj);
+int fz_is_real(fz_obj *obj);
+int fz_is_name(fz_obj *obj);
+int fz_is_string(fz_obj *obj);
+int fz_is_array(fz_obj *obj);
+int fz_is_dict(fz_obj *obj);
+int fz_is_indirect(fz_obj *obj);
int fz_objcmp(fz_obj *a, fz_obj *b);
/* silent failure, no error reporting */
-int fz_tobool(fz_obj *obj);
-int fz_toint(fz_obj *obj);
-float fz_toreal(fz_obj *obj);
-char *fz_toname(fz_obj *obj);
-char *fz_tostrbuf(fz_obj *obj);
-int fz_tostrlen(fz_obj *obj);
-int fz_tonum(fz_obj *obj);
-int fz_togen(fz_obj *obj);
-
-int fz_arraylen(fz_obj *array);
-fz_obj *fz_arrayget(fz_obj *array, int i);
-void fz_arrayput(fz_obj *array, int i, fz_obj *obj);
-void fz_arraypush(fz_obj *array, fz_obj *obj);
-void fz_arraydrop(fz_obj *array);
-void fz_arrayinsert(fz_obj *array, fz_obj *obj);
-
-int fz_dictlen(fz_obj *dict);
-fz_obj *fz_dictgetkey(fz_obj *dict, int idx);
-fz_obj *fz_dictgetval(fz_obj *dict, int idx);
-fz_obj *fz_dictget(fz_obj *dict, fz_obj *key);
-fz_obj *fz_dictgets(fz_obj *dict, char *key);
-fz_obj *fz_dictgetsa(fz_obj *dict, char *key, char *abbrev);
-void fz_dictput(fz_obj *dict, fz_obj *key, fz_obj *val);
-void fz_dictputs(fz_obj *dict, char *key, fz_obj *val);
-void fz_dictdel(fz_obj *dict, fz_obj *key);
-void fz_dictdels(fz_obj *dict, char *key);
-void fz_sortdict(fz_obj *dict);
-
-int fz_fprintobj(FILE *fp, fz_obj *obj, int tight);
-void fz_debugobj(fz_obj *obj);
-void fz_debugref(fz_obj *obj);
+int fz_to_bool(fz_obj *obj);
+int fz_to_int(fz_obj *obj);
+float fz_to_real(fz_obj *obj);
+char *fz_to_name(fz_obj *obj);
+char *fz_to_str_buf(fz_obj *obj);
+int fz_to_str_len(fz_obj *obj);
+int fz_to_num(fz_obj *obj);
+int fz_to_gen(fz_obj *obj);
+
+int fz_array_len(fz_obj *array);
+fz_obj *fz_array_get(fz_obj *array, int i);
+void fz_array_put(fz_obj *array, int i, fz_obj *obj);
+void fz_array_push(fz_obj *array, fz_obj *obj);
+void fz_array_drop(fz_obj *array);
+void fz_array_insert(fz_obj *array, fz_obj *obj);
+
+int fz_dict_len(fz_obj *dict);
+fz_obj *fz_dict_get_key(fz_obj *dict, int idx);
+fz_obj *fz_dict_get_val(fz_obj *dict, int idx);
+fz_obj *fz_dict_get(fz_obj *dict, fz_obj *key);
+fz_obj *fz_dict_gets(fz_obj *dict, char *key);
+fz_obj *fz_dict_getsa(fz_obj *dict, char *key, char *abbrev);
+void fz_dict_put(fz_obj *dict, fz_obj *key, fz_obj *val);
+void fz_dict_puts(fz_obj *dict, char *key, fz_obj *val);
+void fz_dict_del(fz_obj *dict, fz_obj *key);
+void fz_dict_dels(fz_obj *dict, char *key);
+void fz_sort_dict(fz_obj *dict);
+
+int fz_fprint_obj(FILE *fp, fz_obj *obj, int tight);
+void fz_debug_obj(fz_obj *obj);
+void fz_debug_ref(fz_obj *obj);
char *fz_objkindstr(fz_obj *obj);
@@ -485,12 +483,12 @@ struct fz_buffer_s
int cap, len;
};
-fz_buffer *fz_newbuffer(int size);
-fz_buffer *fz_keepbuffer(fz_buffer *buf);
-void fz_dropbuffer(fz_buffer *buf);
+fz_buffer *fz_new_buffer(int size);
+fz_buffer *fz_keep_buffer(fz_buffer *buf);
+void fz_drop_buffer(fz_buffer *buf);
-void fz_resizebuffer(fz_buffer *buf, int size);
-void fz_growbuffer(fz_buffer *buf);
+void fz_resize_buffer(fz_buffer *buf, int size);
+void fz_grow_buffer(fz_buffer *buf);
/*
* Buffered reader.
@@ -515,62 +513,62 @@ struct fz_stream_s
unsigned char buf[4096];
};
-fz_stream *fz_openfd(int file);
-fz_stream *fz_openfile(const char *filename);
-fz_stream *fz_openfilew(const wchar_t *filename); /* only on win32 */
-fz_stream *fz_openbuffer(fz_buffer *buf);
-fz_stream *fz_openmemory(unsigned char *data, int len);
+fz_stream *fz_open_fd(int file);
+fz_stream *fz_open_file(const char *filename);
+fz_stream *fz_open_file_w(const wchar_t *filename); /* only on win32 */
+fz_stream *fz_open_buffer(fz_buffer *buf);
+fz_stream *fz_open_memory(unsigned char *data, int len);
void fz_close(fz_stream *stm);
-fz_stream *fz_newstream(void*, int(*)(fz_stream*, unsigned char*, int), void(*)(fz_stream *));
-fz_stream *fz_keepstream(fz_stream *stm);
-void fz_fillbuffer(fz_stream *stm);
+fz_stream *fz_new_stream(void*, int(*)(fz_stream*, unsigned char*, int), void(*)(fz_stream *));
+fz_stream *fz_keep_stream(fz_stream *stm);
+void fz_fill_buffer(fz_stream *stm);
int fz_tell(fz_stream *stm);
void fz_seek(fz_stream *stm, int offset, int whence);
int fz_read(fz_stream *stm, unsigned char *buf, int len);
-void fz_readline(fz_stream *stm, char *buf, int max);
-fz_error fz_readall(fz_buffer **bufp, fz_stream *stm, int initial);
+void fz_read_line(fz_stream *stm, char *buf, int max);
+fz_error fz_read_all(fz_buffer **bufp, fz_stream *stm, int initial);
-static inline int fz_readbyte(fz_stream *stm)
+static inline int fz_read_byte(fz_stream *stm)
{
if (stm->rp == stm->wp)
{
- fz_fillbuffer(stm);
+ fz_fill_buffer(stm);
return stm->rp < stm->wp ? *stm->rp++ : EOF;
}
return *stm->rp++;
}
-static inline int fz_peekbyte(fz_stream *stm)
+static inline int fz_peek_byte(fz_stream *stm)
{
if (stm->rp == stm->wp)
{
- fz_fillbuffer(stm);
+ fz_fill_buffer(stm);
return stm->rp < stm->wp ? *stm->rp : EOF;
}
return *stm->rp;
}
-static inline void fz_unreadbyte(fz_stream *stm)
+static inline void fz_unread_byte(fz_stream *stm)
{
if (stm->rp > stm->bp)
stm->rp--;
}
-static inline int fz_iseof(fz_stream *stm)
+static inline int fz_is_eof(fz_stream *stm)
{
if (stm->rp == stm->wp)
{
if (stm->eof)
return 1;
- return fz_peekbyte(stm) == EOF;
+ return fz_peek_byte(stm) == EOF;
}
return 0;
}
-static inline unsigned int fz_readbits(fz_stream *stm, int n)
+static inline unsigned int fz_read_bits(fz_stream *stm, int n)
{
unsigned int x;
@@ -587,13 +585,13 @@ static inline unsigned int fz_readbits(fz_stream *stm, int n)
while (n > 8)
{
- x = (x << 8) | fz_readbyte(stm);
+ x = (x << 8) | fz_read_byte(stm);
n -= 8;
}
if (n > 0)
{
- stm->bits = fz_readbyte(stm);
+ stm->bits = fz_read_byte(stm);
stm->avail = 8 - n;
x = (x << n) | (stm->bits >> stm->avail);
}
@@ -602,64 +600,64 @@ static inline unsigned int fz_readbits(fz_stream *stm, int n)
return x;
}
-static inline void fz_syncbits(fz_stream *stm)
+static inline void fz_sync_bits(fz_stream *stm)
{
stm->avail = 0;
}
-static inline int fz_iseofbits(fz_stream *stm)
+static inline int fz_is_eof_bits(fz_stream *stm)
{
- return fz_iseof(stm) && (stm->avail == 0 || stm->bits == EOF);
+ return fz_is_eof(stm) && (stm->avail == 0 || stm->bits == EOF);
}
/*
* Data filters.
*/
-fz_stream *fz_opencopy(fz_stream *chain);
-fz_stream *fz_opennull(fz_stream *chain, int len);
-fz_stream *fz_openarc4(fz_stream *chain, unsigned char *key, unsigned keylen);
-fz_stream *fz_openaesd(fz_stream *chain, unsigned char *key, unsigned keylen);
-fz_stream *fz_opena85d(fz_stream *chain);
-fz_stream *fz_openahxd(fz_stream *chain);
-fz_stream *fz_openrld(fz_stream *chain);
-fz_stream *fz_opendctd(fz_stream *chain, fz_obj *param);
-fz_stream *fz_openfaxd(fz_stream *chain, fz_obj *param);
-fz_stream *fz_openflated(fz_stream *chain);
-fz_stream *fz_openlzwd(fz_stream *chain, fz_obj *param);
-fz_stream *fz_openpredict(fz_stream *chain, fz_obj *param);
-fz_stream *fz_openjbig2d(fz_stream *chain, fz_buffer *global);
+fz_stream *fz_open_copy(fz_stream *chain);
+fz_stream *fz_open_null(fz_stream *chain, int len);
+fz_stream *fz_open_arc4(fz_stream *chain, unsigned char *key, unsigned keylen);
+fz_stream *fz_open_aesd(fz_stream *chain, unsigned char *key, unsigned keylen);
+fz_stream *fz_open_a85d(fz_stream *chain);
+fz_stream *fz_open_ahxd(fz_stream *chain);
+fz_stream *fz_open_rld(fz_stream *chain);
+fz_stream *fz_open_dctd(fz_stream *chain, fz_obj *param);
+fz_stream *fz_open_faxd(fz_stream *chain, fz_obj *param);
+fz_stream *fz_open_flated(fz_stream *chain);
+fz_stream *fz_open_lzwd(fz_stream *chain, fz_obj *param);
+fz_stream *fz_open_predict(fz_stream *chain, fz_obj *param);
+fz_stream *fz_open_jbig2d(fz_stream *chain, fz_buffer *global);
/*
* Resources and other graphics related objects.
*/
-enum { FZ_MAXCOLORS = 32 };
+enum { FZ_MAX_COLORS = 32 };
typedef enum fz_blendmode_e
{
/* PDF 1.4 -- standard separable */
- FZ_BNORMAL,
- FZ_BMULTIPLY,
- FZ_BSCREEN,
- FZ_BOVERLAY,
- FZ_BDARKEN,
- FZ_BLIGHTEN,
- FZ_BCOLORDODGE,
- FZ_BCOLORBURN,
- FZ_BHARDLIGHT,
- FZ_BSOFTLIGHT,
- FZ_BDIFFERENCE,
- FZ_BEXCLUSION,
+ FZ_BLEND_NORMAL,
+ FZ_BLEND_MULTIPLY,
+ FZ_BLEND_SCREEN,
+ FZ_BLEND_OVERLAY,
+ FZ_BLEND_DARKEN,
+ FZ_BLEND_LIGHTEN,
+ FZ_BLEND_COLOR_DODGE,
+ FZ_BLEND_COLOR_BURN,
+ FZ_BLEND_HARD_LIGHT,
+ FZ_BLEND_SOFT_LIGHT,
+ FZ_BLEND_DIFFERENCE,
+ FZ_BLEND_EXCLUSION,
/* PDF 1.4 -- standard non-separable */
- FZ_BHUE,
- FZ_BSATURATION,
- FZ_BCOLOR,
- FZ_BLUMINOSITY,
+ FZ_BLEND_HUE,
+ FZ_BLEND_SATURATION,
+ FZ_BLEND_COLOR,
+ FZ_BLEND_LUMINOSITY,
} fz_blendmode;
-extern const char *fz_blendnames[];
+extern const char *fz_blendmode_names[];
/*
* Pixmaps have n components per pixel. the last is always alpha.
@@ -679,54 +677,54 @@ struct fz_pixmap_s
int xres, yres;
fz_colorspace *colorspace;
unsigned char *samples;
- int freesamples;
+ int free_samples;
};
-fz_pixmap *fz_newpixmapwithdata(fz_colorspace *colorspace, int x, int y, int w, int h, unsigned char *samples);
-fz_pixmap *fz_newpixmapwithrect(fz_colorspace *, fz_bbox bbox);
-fz_pixmap *fz_newpixmap(fz_colorspace *, int x, int y, int w, int h);
-fz_pixmap *fz_keeppixmap(fz_pixmap *pix);
-void fz_droppixmap(fz_pixmap *pix);
-void fz_clearpixmap(fz_pixmap *pix);
-void fz_clearpixmapwithcolor(fz_pixmap *pix, int value);
-void fz_premultiplypixmap(fz_pixmap *pix);
-fz_pixmap *fz_alphafromgray(fz_pixmap *gray, int luminosity);
-fz_bbox fz_boundpixmap(fz_pixmap *pix);
+fz_pixmap *fz_new_pixmap_with_data(fz_colorspace *colorspace, int x, int y, int w, int h, unsigned char *samples);
+fz_pixmap *fz_new_pixmap_with_rect(fz_colorspace *, fz_bbox bbox);
+fz_pixmap *fz_new_pixmap(fz_colorspace *, int x, int y, int w, int h);
+fz_pixmap *fz_keep_pixmap(fz_pixmap *pix);
+void fz_drop_pixmap(fz_pixmap *pix);
+void fz_clear_pixmap(fz_pixmap *pix);
+void fz_clear_pixmap_with_color(fz_pixmap *pix, int value);
+void fz_premultiply_pixmap(fz_pixmap *pix);
+fz_pixmap *fz_alpha_from_gray(fz_pixmap *gray, int luminosity);
+fz_bbox fz_bound_pixmap(fz_pixmap *pix);
-fz_pixmap *fz_scalepixmap(fz_pixmap *src, float x, float y, float w, float h);
+fz_pixmap *fz_scale_pixmap(fz_pixmap *src, float x, float y, float w, float h);
-fz_error fz_writepnm(fz_pixmap *pixmap, char *filename);
-fz_error fz_writepam(fz_pixmap *pixmap, char *filename, int savealpha);
-fz_error fz_writepng(fz_pixmap *pixmap, char *filename, int savealpha);
+fz_error fz_write_pnm(fz_pixmap *pixmap, char *filename);
+fz_error fz_write_pam(fz_pixmap *pixmap, char *filename, int savealpha);
+fz_error fz_write_png(fz_pixmap *pixmap, char *filename, int savealpha);
-fz_error fz_loadjpximage(fz_pixmap **imgp, unsigned char *data, int size);
+fz_error fz_load_jpx_image(fz_pixmap **imgp, unsigned char *data, int size);
/*
* Colorspace resources.
*/
-extern fz_colorspace *fz_devicegray;
-extern fz_colorspace *fz_devicergb;
-extern fz_colorspace *fz_devicebgr;
-extern fz_colorspace *fz_devicecmyk;
+extern fz_colorspace *fz_device_gray;
+extern fz_colorspace *fz_device_rgb;
+extern fz_colorspace *fz_device_bgr;
+extern fz_colorspace *fz_device_cmyk;
struct fz_colorspace_s
{
int refs;
char name[16];
int n;
- void (*toxyz)(fz_colorspace *, float *src, float *xyz);
- void (*fromxyz)(fz_colorspace *, float *xyz, float *dst);
- void (*freedata)(fz_colorspace *);
+ void (*to_xyz)(fz_colorspace *, float *src, float *xyz);
+ void (*from_xyz)(fz_colorspace *, float *xyz, float *dst);
+ void (*free_data)(fz_colorspace *);
void *data;
};
-fz_colorspace *fz_newcolorspace(char *name, int n);
-fz_colorspace *fz_keepcolorspace(fz_colorspace *colorspace);
-void fz_dropcolorspace(fz_colorspace *colorspace);
+fz_colorspace *fz_new_colorspace(char *name, int n);
+fz_colorspace *fz_keep_colorspace(fz_colorspace *colorspace);
+void fz_drop_colorspace(fz_colorspace *colorspace);
-void fz_convertcolor(fz_colorspace *srcs, float *srcv, fz_colorspace *dsts, float *dstv);
-void fz_convertpixmap(fz_pixmap *src, fz_pixmap *dst);
+void fz_convert_color(fz_colorspace *srcs, float *srcv, fz_colorspace *dsts, float *dstv);
+void fz_convert_pixmap(fz_pixmap *src, fz_pixmap *dst);
/*
* Fonts come in two variants:
@@ -737,21 +735,21 @@ void fz_convertpixmap(fz_pixmap *src, fz_pixmap *dst);
struct fz_device_s;
typedef struct fz_font_s fz_font;
-char *ft_errorstring(int err);
+char *ft_error_string(int err);
struct fz_font_s
{
int refs;
char name[32];
- void *ftface; /* has an FT_Face if used */
- int ftsubstitute; /* ... substitute metrics */
- int fthint; /* ... force hinting for DynaLab fonts */
+ void *ft_face; /* has an FT_Face if used */
+ int ft_substitute; /* ... substitute metrics */
+ int ft_hint; /* ... force hinting for DynaLab fonts */
/* origin of font data */
- char *ftfile;
- unsigned char *ftdata;
- int ftsize;
+ char *ft_file;
+ unsigned char *ft_data;
+ int ft_size;
fz_matrix t3matrix;
fz_obj *t3resources;
@@ -764,81 +762,81 @@ struct fz_font_s
fz_rect bbox;
/* substitute metrics */
- int widthcount;
- int *widthtable;
+ int width_count;
+ int *width_table;
};
-fz_font *fz_newtype3font(char *name, fz_matrix matrix);
+fz_font *fz_new_type3_font(char *name, fz_matrix matrix);
-fz_error fz_newfontfrombuffer(fz_font **fontp, unsigned char *data, int len, int index);
-fz_error fz_newfontfromfile(fz_font **fontp, char *path, int index);
+fz_error fz_new_font_from_memory(fz_font **fontp, unsigned char *data, int len, int index);
+fz_error fz_new_font_from_file(fz_font **fontp, char *path, int index);
-fz_font *fz_keepfont(fz_font *font);
-void fz_dropfont(fz_font *font);
+fz_font *fz_keep_font(fz_font *font);
+void fz_drop_font(fz_font *font);
-void fz_debugfont(fz_font *font);
-void fz_setfontbbox(fz_font *font, float xmin, float ymin, float xmax, float ymax);
+void fz_debug_font(fz_font *font);
+void fz_set_font_bbox(fz_font *font, float xmin, float ymin, float xmax, float ymax);
/*
* Vector path buffer.
* It can be stroked and dashed, or be filled.
- * It has a fill rule (nonzero or evenodd).
+ * It has a fill rule (nonzero or even_odd).
*
* When rendering, they are flattened, stroked and dashed straight
* into the Global Edge List.
*/
typedef struct fz_path_s fz_path;
-typedef struct fz_strokestate_s fz_strokestate;
+typedef struct fz_stroke_state_s fz_stroke_state;
-typedef union fz_pathel_s fz_pathel;
+typedef union fz_path_item_s fz_path_item;
-typedef enum fz_pathelkind_e
+typedef enum fz_path_item_kind_e
{
FZ_MOVETO,
FZ_LINETO,
FZ_CURVETO,
- FZ_CLOSEPATH
-} fz_pathelkind;
+ FZ_CLOSE_PATH
+} fz_path_item_kind;
-union fz_pathel_s
+union fz_path_item_s
{
- fz_pathelkind k;
+ fz_path_item_kind k;
float v;
};
struct fz_path_s
{
int len, cap;
- fz_pathel *els;
+ fz_path_item *items;
};
-struct fz_strokestate_s
+struct fz_stroke_state_s
{
int linecap;
int linejoin;
float linewidth;
float miterlimit;
- float dashphase;
- int dashlen;
- float dashlist[32];
+ float dash_phase;
+ int dash_len;
+ float dash_list[32];
};
-fz_path *fz_newpath(void);
+fz_path *fz_new_path(void);
void fz_moveto(fz_path*, float x, float y);
void fz_lineto(fz_path*, float x, float y);
void fz_curveto(fz_path*, float, float, float, float, float, float);
void fz_curvetov(fz_path*, float, float, float, float);
void fz_curvetoy(fz_path*, float, float, float, float);
void fz_closepath(fz_path*);
-void fz_freepath(fz_path *path);
+void fz_free_path(fz_path *path);
-void fz_transformpath(fz_path *path, fz_matrix transform);
+void fz_transform_path(fz_path *path, fz_matrix transform);
-fz_path *fz_clonepath(fz_path *old);
+fz_path *fz_clone_path(fz_path *old);
-fz_rect fz_boundpath(fz_path *path, fz_strokestate *stroke, fz_matrix ctm);
-void fz_debugpath(fz_path *, int indent);
+fz_rect fz_bound_path(fz_path *path, fz_stroke_state *stroke, fz_matrix ctm);
+void fz_debug_path(fz_path *, int indent);
/*
* Text buffer.
@@ -853,9 +851,9 @@ void fz_debugpath(fz_path *, int indent);
*/
typedef struct fz_text_s fz_text;
-typedef struct fz_textel_s fz_textel;
+typedef struct fz_text_item_s fz_text_item;
-struct fz_textel_s
+struct fz_text_item_s
{
float x, y;
int gid; /* -1 for one gid to many ucs mappings */
@@ -868,15 +866,15 @@ struct fz_text_s
fz_matrix trm;
int wmode;
int len, cap;
- fz_textel *els;
+ fz_text_item *items;
};
-fz_text *fz_newtext(fz_font *face, fz_matrix trm, int wmode);
-void fz_addtext(fz_text *text, int gid, int ucs, float x, float y);
-void fz_freetext(fz_text *text);
-void fz_debugtext(fz_text*, int indent);
-fz_rect fz_boundtext(fz_text *text, fz_matrix ctm);
-fz_text *fz_clonetext(fz_text *old);
+fz_text *fz_new_text(fz_font *face, fz_matrix trm, int wmode);
+void fz_add_text(fz_text *text, int gid, int ucs, float x, float y);
+void fz_free_text(fz_text *text);
+void fz_debug_text(fz_text*, int indent);
+fz_rect fz_bound_text(fz_text *text, fz_matrix ctm);
+fz_text *fz_clone_text(fz_text *old);
/*
* The shading code uses gouraud shaded triangle meshes.
@@ -895,44 +893,44 @@ struct fz_shade_s
{
int refs;
- fz_rect bbox; /* can be fz_infiniterect */
+ fz_rect bbox; /* can be fz_infinite_rect */
fz_colorspace *colorspace;
fz_matrix matrix; /* matrix from pattern dict */
- int usebackground; /* background color for fills but not 'sh' */
- float background[FZ_MAXCOLORS];
+ int use_background; /* background color for fills but not 'sh' */
+ float background[FZ_MAX_COLORS];
- int usefunction;
- float function[256][FZ_MAXCOLORS + 1];
+ int use_function;
+ float function[256][FZ_MAX_COLORS + 1];
int type; /* linear, radial, mesh */
int extend[2];
- int meshlen;
- int meshcap;
+ int mesh_len;
+ int mesh_cap;
float *mesh; /* [x y 0], [x y r], [x y t] or [x y c1 ... cn] */
};
-fz_shade *fz_keepshade(fz_shade *shade);
-void fz_dropshade(fz_shade *shade);
-void fz_debugshade(fz_shade *shade);
+fz_shade *fz_keep_shade(fz_shade *shade);
+void fz_drop_shade(fz_shade *shade);
+void fz_debug_shade(fz_shade *shade);
-fz_rect fz_boundshade(fz_shade *shade, fz_matrix ctm);
-void fz_paintshade(fz_shade *shade, fz_matrix ctm, fz_pixmap *dest, fz_bbox bbox);
+fz_rect fz_bound_shade(fz_shade *shade, fz_matrix ctm);
+void fz_paint_shade(fz_shade *shade, fz_matrix ctm, fz_pixmap *dest, fz_bbox bbox);
/*
* Glyph cache
*/
-typedef struct fz_glyphcache_s fz_glyphcache;
+typedef struct fz_glyph_cache_s fz_glyph_cache;
-fz_glyphcache *fz_newglyphcache(void);
-fz_pixmap *fz_renderftglyph(fz_font *font, int cid, fz_matrix trm);
-fz_pixmap *fz_rendert3glyph(fz_font *font, int cid, fz_matrix trm);
-fz_pixmap *fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz_strokestate *state);
-fz_pixmap *fz_renderglyph(fz_glyphcache*, fz_font*, int, fz_matrix);
-fz_pixmap *fz_renderstrokedglyph(fz_glyphcache*, fz_font*, int, fz_matrix, fz_matrix, fz_strokestate *stroke);
-void fz_freeglyphcache(fz_glyphcache *);
+fz_glyph_cache *fz_new_glyph_cache(void);
+fz_pixmap *fz_render_ft_glyph(fz_font *font, int cid, fz_matrix trm);
+fz_pixmap *fz_render_t3_glyph(fz_font *font, int cid, fz_matrix trm);
+fz_pixmap *fz_render_ft_stroked_glyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz_stroke_state *state);
+fz_pixmap *fz_render_glyph(fz_glyph_cache*, fz_font*, int, fz_matrix);
+fz_pixmap *fz_render_stroked_glyph(fz_glyph_cache*, fz_font*, int, fz_matrix, fz_matrix, fz_stroke_state *stroke);
+void fz_free_glyph_cache(fz_glyph_cache *);
/*
* Scan converter
@@ -945,7 +943,7 @@ typedef struct fz_ael_s fz_ael;
struct fz_edge_s
{
int x, e, h, y;
- int adjup, adjdown;
+ int adj_up, adj_down;
int xmove;
int xdir, ydir; /* -1 or +1 */
};
@@ -966,23 +964,23 @@ struct fz_ael_s
fz_edge **edges;
};
-fz_gel *fz_newgel(void);
-void fz_insertgel(fz_gel *gel, float x0, float y0, float x1, float y1);
-fz_bbox fz_boundgel(fz_gel *gel);
-void fz_resetgel(fz_gel *gel, fz_bbox clip);
-void fz_sortgel(fz_gel *gel);
-void fz_freegel(fz_gel *gel);
-int fz_isrectgel(fz_gel *gel);
+fz_gel *fz_new_gel(void);
+void fz_insert_gel(fz_gel *gel, float x0, float y0, float x1, float y1);
+fz_bbox fz_bound_gel(fz_gel *gel);
+void fz_reset_gel(fz_gel *gel, fz_bbox clip);
+void fz_sort_gel(fz_gel *gel);
+void fz_free_gel(fz_gel *gel);
+int fz_is_rect_gel(fz_gel *gel);
-fz_ael *fz_newael(void);
-void fz_freeael(fz_ael *ael);
+fz_ael *fz_new_ael(void);
+void fz_free_ael(fz_ael *ael);
-fz_error fz_scanconvert(fz_gel *gel, fz_ael *ael, int eofill,
+fz_error fz_scan_convert(fz_gel *gel, fz_ael *ael, int eofill,
fz_bbox clip, fz_pixmap *pix, unsigned char *colorbv);
-void fz_fillpath(fz_gel *gel, fz_path *path, fz_matrix ctm, float flatness);
-void fz_strokepath(fz_gel *gel, fz_path *path, fz_strokestate *stroke, fz_matrix ctm, float flatness, float linewidth);
-void fz_dashpath(fz_gel *gel, fz_path *path, fz_strokestate *stroke, fz_matrix ctm, float flatness, float linewidth);
+void fz_fill_path(fz_gel *gel, fz_path *path, fz_matrix ctm, float flatness);
+void fz_stroke_path(fz_gel *gel, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm, float flatness, float linewidth);
+void fz_dash_path(fz_gel *gel, fz_path *path, fz_stroke_state *stroke, fz_matrix ctm, float flatness, float linewidth);
/*
* The device interface.
@@ -990,8 +988,8 @@ void fz_dashpath(fz_gel *gel, fz_path *path, fz_strokestate *stroke, fz_matrix c
enum
{
- FZ_IGNOREIMAGE = 1,
- FZ_IGNORESHADE = 2,
+ FZ_IGNORE_IMAGE = 1,
+ FZ_IGNORE_SHADE = 2,
};
typedef struct fz_device_s fz_device;
@@ -1001,110 +999,110 @@ struct fz_device_s
int hints;
void *user;
- void (*freeuser)(void *);
+ void (*free_user)(void *);
- void (*fillpath)(void *, fz_path *, int evenodd, fz_matrix, fz_colorspace *, float *color, float alpha);
- void (*strokepath)(void *, fz_path *, fz_strokestate *, fz_matrix, fz_colorspace *, float *color, float alpha);
- void (*clippath)(void *, fz_path *, int evenodd, fz_matrix);
- void (*clipstrokepath)(void *, fz_path *, fz_strokestate *, fz_matrix);
+ void (*fill_path)(void *, fz_path *, int even_odd, fz_matrix, fz_colorspace *, float *color, float alpha);
+ void (*stroke_path)(void *, fz_path *, fz_stroke_state *, fz_matrix, fz_colorspace *, float *color, float alpha);
+ void (*clip_path)(void *, fz_path *, int even_odd, fz_matrix);
+ void (*clip_stroke_path)(void *, fz_path *, fz_stroke_state *, fz_matrix);
- void (*filltext)(void *, fz_text *, fz_matrix, fz_colorspace *, float *color, float alpha);
- void (*stroketext)(void *, fz_text *, fz_strokestate *, fz_matrix, fz_colorspace *, float *color, float alpha);
- void (*cliptext)(void *, fz_text *, fz_matrix, int accumulate);
- void (*clipstroketext)(void *, fz_text *, fz_strokestate *, fz_matrix);
- void (*ignoretext)(void *, fz_text *, fz_matrix);
+ void (*fill_text)(void *, fz_text *, fz_matrix, fz_colorspace *, float *color, float alpha);
+ void (*stroke_text)(void *, fz_text *, fz_stroke_state *, fz_matrix, fz_colorspace *, float *color, float alpha);
+ void (*clip_text)(void *, fz_text *, fz_matrix, int accumulate);
+ void (*clip_stroke_text)(void *, fz_text *, fz_stroke_state *, fz_matrix);
+ void (*ignore_text)(void *, fz_text *, fz_matrix);
- void (*fillshade)(void *, fz_shade *shd, fz_matrix ctm, float alpha);
- void (*fillimage)(void *, fz_pixmap *img, fz_matrix ctm, float alpha);
- void (*fillimagemask)(void *, fz_pixmap *img, fz_matrix ctm, fz_colorspace *, float *color, float alpha);
- void (*clipimagemask)(void *, fz_pixmap *img, fz_matrix ctm);
+ void (*fill_shade)(void *, fz_shade *shd, fz_matrix ctm, float alpha);
+ void (*fill_image)(void *, fz_pixmap *img, fz_matrix ctm, float alpha);
+ void (*fill_image_mask)(void *, fz_pixmap *img, fz_matrix ctm, fz_colorspace *, float *color, float alpha);
+ void (*clip_image_mask)(void *, fz_pixmap *img, fz_matrix ctm);
- void (*popclip)(void *);
+ void (*pop_clip)(void *);
- void (*beginmask)(void *, fz_rect, int luminosity, fz_colorspace *, float *bc);
- void (*endmask)(void *);
- void (*begingroup)(void *, fz_rect, int isolated, int knockout, fz_blendmode blendmode, float alpha);
- void (*endgroup)(void *);
+ void (*begin_mask)(void *, fz_rect, int luminosity, fz_colorspace *, float *bc);
+ void (*end_mask)(void *);
+ void (*begin_group)(void *, fz_rect, int isolated, int knockout, fz_blendmode blendmode, float alpha);
+ void (*end_group)(void *);
- void (*begintile)(void *, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm);
- void (*endtile)(void *);
+ void (*begin_tile)(void *, fz_rect area, fz_rect view, float xstep, float ystep, fz_matrix ctm);
+ void (*end_tile)(void *);
};
-fz_device *fz_newdevice(void *user);
-void fz_freedevice(fz_device *dev);
+fz_device *fz_new_device(void *user);
+void fz_free_device(fz_device *dev);
-fz_device *fz_newtracedevice(void);
+fz_device *fz_new_trace_device(void);
-fz_device *fz_newbboxdevice(fz_bbox *bboxp);
+fz_device *fz_new_bbox_device(fz_bbox *bboxp);
-fz_device *fz_newdrawdevice(fz_glyphcache *cache, fz_pixmap *dest);
+fz_device *fz_new_draw_device(fz_glyph_cache *cache, fz_pixmap *dest);
/*
* Text extraction device
*/
-typedef struct fz_textspan_s fz_textspan;
-typedef struct fz_textchar_s fz_textchar;
+typedef struct fz_text_span_s fz_text_span;
+typedef struct fz_text_char_s fz_text_char;
-struct fz_textchar_s
+struct fz_text_char_s
{
int c;
fz_bbox bbox;
};
-struct fz_textspan_s
+struct fz_text_span_s
{
fz_font *font;
float size;
int wmode;
int len, cap;
- fz_textchar *text;
- fz_textspan *next;
+ fz_text_char *text;
+ fz_text_span *next;
int eol;
};
-fz_textspan *fz_newtextspan(void);
-void fz_freetextspan(fz_textspan *line);
-void fz_debugtextspan(fz_textspan *line);
-void fz_debugtextspanxml(fz_textspan *span);
+fz_text_span *fz_new_text_span(void);
+void fz_free_text_span(fz_text_span *line);
+void fz_debug_text_span(fz_text_span *line);
+void fz_debug_text_span_xml(fz_text_span *span);
-fz_device *fz_newtextdevice(fz_textspan *text);
+fz_device *fz_new_text_device(fz_text_span *text);
/*
* Display list device -- record and play back device commands.
*/
-typedef struct fz_displaylist_s fz_displaylist;
-typedef struct fz_displaynode_s fz_displaynode;
+typedef struct fz_display_list_s fz_display_list;
+typedef struct fz_display_node_s fz_display_node;
-typedef enum fz_displaycommand_e
+typedef enum fz_display_command_e
{
- FZ_CMDFILLPATH,
- FZ_CMDSTROKEPATH,
- FZ_CMDCLIPPATH,
- FZ_CMDCLIPSTROKEPATH,
- FZ_CMDFILLTEXT,
- FZ_CMDSTROKETEXT,
- FZ_CMDCLIPTEXT,
- FZ_CMDCLIPSTROKETEXT,
- FZ_CMDIGNORETEXT,
- FZ_CMDFILLSHADE,
- FZ_CMDFILLIMAGE,
- FZ_CMDFILLIMAGEMASK,
- FZ_CMDCLIPIMAGEMASK,
- FZ_CMDPOPCLIP,
- FZ_CMDBEGINMASK,
- FZ_CMDENDMASK,
- FZ_CMDBEGINGROUP,
- FZ_CMDENDGROUP,
- FZ_CMDBEGINTILE,
- FZ_CMDENDTILE
-} fz_displaycommand;
-
-struct fz_displaynode_s
+ FZ_CMD_FILL_PATH,
+ FZ_CMD_STROKE_PATH,
+ FZ_CMD_CLIP_PATH,
+ FZ_CMD_CLIP_STROKE_PATH,
+ FZ_CMD_FILL_TEXT,
+ FZ_CMD_STROKE_TEXT,
+ FZ_CMD_CLIP_TEXT,
+ FZ_CMD_CLIP_STROKE_TEXT,
+ FZ_CMD_IGNORE_TEXT,
+ FZ_CMD_FILL_SHADE,
+ FZ_CMD_FILL_IMAGE,
+ FZ_CMD_FILL_IMAGE_MASK,
+ FZ_CMD_CLIP_IMAGE_MASK,
+ FZ_CMD_POP_CLIP,
+ FZ_CMD_BEGIN_MASK,
+ FZ_CMD_END_MASK,
+ FZ_CMD_BEGIN_GROUP,
+ FZ_CMD_END_GROUP,
+ FZ_CMD_BEGIN_TILE,
+ FZ_CMD_END_TILE
+} fz_display_command;
+
+struct fz_display_node_s
{
- fz_displaycommand cmd;
- fz_displaynode *next;
+ fz_display_command cmd;
+ fz_display_node *next;
fz_rect rect;
union {
fz_path *path;
@@ -1113,93 +1111,46 @@ struct fz_displaynode_s
fz_pixmap *image;
fz_blendmode blendmode;
} item;
- fz_strokestate *stroke;
- int flag; /* evenodd, accumulate, isolated/knockout... */
+ fz_stroke_state *stroke;
+ int flag; /* even_odd, accumulate, isolated/knockout... */
fz_matrix ctm;
fz_colorspace *colorspace;
float alpha;
- float color[FZ_MAXCOLORS];
+ float color[FZ_MAX_COLORS];
};
-struct fz_displaylist_s
+struct fz_display_list_s
{
- fz_displaynode *first;
- fz_displaynode *last;
+ fz_display_node *first;
+ fz_display_node *last;
};
-fz_displaylist *fz_newdisplaylist(void);
-void fz_freedisplaylist(fz_displaylist *list);
-fz_device *fz_newlistdevice(fz_displaylist *list);
-void fz_executedisplaylist(fz_displaylist *list, fz_device *dev, fz_matrix ctm, fz_bbox area);
+fz_display_list *fz_new_display_list(void);
+void fz_free_display_list(fz_display_list *list);
+fz_device *fz_new_list_device(fz_display_list *list);
+void fz_execute_display_list(fz_display_list *list, fz_device *dev, fz_matrix ctm, fz_bbox area);
/*
- * Function pointers for plotting functions.
- * They can be replaced by cpu-optimized versions.
+ * Plotting functions.
*/
-/*
-These are the blending primitives:
-
-span over span (text and path drawing to clip mask)
-span in alpha over span
-span in span over span
-color in span over span (text and path drawing)
-
- fz_paintspan(dp, sp);
- fz_paintspanalpha(dp, sp, alpha)
- fz_paintspanmask(dp, sp, mask);
- fz_paintspancolor(dp, color, mask);
-
-pixmap over pixmap (shading with function lookup)
-pixmap in alpha over pixmap (xobject/shading with ca)
-pixmap in pixmap over pixmap (xobject with softmask / clip)
-
- fz_paintpixmap()
- fz_paintpixmapalpha()
- fz_paintpixmapmask()
-
-affine over span
-affine in alpha over span
-color in affine over span
-
- fz_paintaffine()
- fz_paintaffinealpha()
- fz_paintaffinecolor()
-
-image over pixmap (image fill)
-image in alpha over pixmap (image fill with ca)
-color in image over pixmap (image mask fill)
-
- fz_paintimage()
- fz_paintimagealpha()
- fz_paintimagecolor()
-
-pixmap BLEND pixmap
-pixmap in alpha BLEND pixmap
-
- fz_blendpixmap()
- fz_blendpixmapalpha()
-*/
-
void fz_accelerate(void);
-void fz_acceleratearch(void);
-
-void fz_decodetile(fz_pixmap *pix, float *decode);
-void fz_decodeindexedtile(fz_pixmap *pix, float *decode, int maxval);
-void fz_unpacktile(fz_pixmap *dst, unsigned char * restrict src, int n, int depth, int stride, int scale);
+void fz_accelerate_arch(void);
-void fz_paintspan(unsigned char * restrict dp, unsigned char * restrict sp, int n, int w, int alpha);
-void fz_paintspancolor(unsigned char * restrict dp, unsigned char * restrict mp, int n, int w, unsigned char *color);
+void fz_decode_tile(fz_pixmap *pix, float *decode);
+void fz_decode_indexed_tile(fz_pixmap *pix, float *decode, int maxval);
+void fz_unpack_tile(fz_pixmap *dst, unsigned char * restrict src, int n, int depth, int stride, int scale);
-void fz_paintaffinecolor(unsigned char *dp, unsigned char *sp, int sw, int sh, int u, int v, int fa, int fb, int w, int n, unsigned char *color);
+void fz_paint_span(unsigned char * restrict dp, unsigned char * restrict sp, int n, int w, int alpha);
+void fz_paint_span_with_color(unsigned char * restrict dp, unsigned char * restrict mp, int n, int w, unsigned char *color);
-void fz_paintimage(fz_pixmap *dst, fz_bbox scissor, fz_pixmap *img, fz_matrix ctm, int alpha);
-void fz_paintimagecolor(fz_pixmap *dst, fz_bbox scissor, fz_pixmap *img, fz_matrix ctm, unsigned char *colorbv);
+void fz_paint_image(fz_pixmap *dst, fz_bbox scissor, fz_pixmap *img, fz_matrix ctm, int alpha);
+void fz_paint_image_with_color(fz_pixmap *dst, fz_bbox scissor, fz_pixmap *img, fz_matrix ctm, unsigned char *colorbv);
-void fz_paintpixmap(fz_pixmap *dst, fz_pixmap *src, int alpha);
-void fz_paintpixmapmask(fz_pixmap *dst, fz_pixmap *src, fz_pixmap *msk);
-void fz_paintpixmapbbox(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_bbox bbox);
+void fz_paint_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha);
+void fz_paint_pixmap_with_mask(fz_pixmap *dst, fz_pixmap *src, fz_pixmap *msk);
+void fz_paint_pixmap_with_rect(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_bbox bbox);
-void fz_blendpixmap(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_blendmode blendmode);
+void fz_blend_pixmap(fz_pixmap *dst, fz_pixmap *src, int alpha, fz_blendmode blendmode);
#endif
diff --git a/fitz/obj_array.c b/fitz/obj_array.c
index 391c1dd8..d6ffb687 100644
--- a/fitz/obj_array.c
+++ b/fitz/obj_array.c
@@ -1,7 +1,7 @@
#include "fitz.h"
fz_obj *
-fz_newarray(int initialcap)
+fz_new_array(int initialcap)
{
fz_obj *obj;
int i;
@@ -15,56 +15,56 @@ fz_newarray(int initialcap)
obj->u.a.items = fz_calloc(obj->u.a.cap, sizeof(fz_obj*));
for (i = 0; i < obj->u.a.cap; i++)
- obj->u.a.items[i] = nil;
+ obj->u.a.items[i] = NULL;
return obj;
}
fz_obj *
-fz_copyarray(fz_obj *obj)
+fz_copy_array(fz_obj *obj)
{
fz_obj *new;
int i;
- if (fz_isindirect(obj) || !fz_isarray(obj))
+ if (fz_is_indirect(obj) || !fz_is_array(obj))
fz_warn("assert: not an array (%s)", fz_objkindstr(obj));
- new = fz_newarray(fz_arraylen(obj));
- for (i = 0; i < fz_arraylen(obj); i++)
- fz_arraypush(new, fz_arrayget(obj, i));
+ new = fz_new_array(fz_array_len(obj));
+ for (i = 0; i < fz_array_len(obj); i++)
+ fz_array_push(new, fz_array_get(obj, i));
return new;
}
int
-fz_arraylen(fz_obj *obj)
+fz_array_len(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (!fz_isarray(obj))
+ obj = fz_resolve_indirect(obj);
+ if (!fz_is_array(obj))
return 0;
return obj->u.a.len;
}
fz_obj *
-fz_arrayget(fz_obj *obj, int i)
+fz_array_get(fz_obj *obj, int i)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isarray(obj))
- return nil;
+ if (!fz_is_array(obj))
+ return NULL;
if (i < 0 || i >= obj->u.a.len)
- return nil;
+ return NULL;
return obj->u.a.items[i];
}
void
-fz_arrayput(fz_obj *obj, int i, fz_obj *item)
+fz_array_put(fz_obj *obj, int i, fz_obj *item)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isarray(obj))
+ if (!fz_is_array(obj))
fz_warn("assert: not an array (%s)", fz_objkindstr(obj));
else if (i < 0)
fz_warn("assert: index %d < 0", i);
@@ -73,17 +73,17 @@ fz_arrayput(fz_obj *obj, int i, fz_obj *item)
else
{
if (obj->u.a.items[i])
- fz_dropobj(obj->u.a.items[i]);
- obj->u.a.items[i] = fz_keepobj(item);
+ fz_drop_obj(obj->u.a.items[i]);
+ obj->u.a.items[i] = fz_keep_obj(item);
}
}
void
-fz_arraypush(fz_obj *obj, fz_obj *item)
+fz_array_push(fz_obj *obj, fz_obj *item)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isarray(obj))
+ if (!fz_is_array(obj))
fz_warn("assert: not an array (%s)", fz_objkindstr(obj));
else
{
@@ -93,35 +93,35 @@ fz_arraypush(fz_obj *obj, fz_obj *item)
obj->u.a.cap = (obj->u.a.cap * 3) / 2;
obj->u.a.items = fz_realloc(obj->u.a.items, obj->u.a.cap, sizeof(fz_obj*));
for (i = obj->u.a.len ; i < obj->u.a.cap; i++)
- obj->u.a.items[i] = nil;
+ obj->u.a.items[i] = NULL;
}
- obj->u.a.items[obj->u.a.len] = fz_keepobj(item);
+ obj->u.a.items[obj->u.a.len] = fz_keep_obj(item);
obj->u.a.len++;
}
}
void
-fz_arraydrop(fz_obj *obj)
+fz_array_drop(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isarray(obj))
+ if (!fz_is_array(obj))
fz_warn("assert: not an array (%s)", fz_objkindstr(obj));
else
{
if (obj->u.a.len > 0)
{
- fz_dropobj(obj->u.a.items[--obj->u.a.len]);
+ fz_drop_obj(obj->u.a.items[--obj->u.a.len]);
}
}
}
void
-fz_arrayinsert(fz_obj *obj, fz_obj *item)
+fz_array_insert(fz_obj *obj, fz_obj *item)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isarray(obj))
+ if (!fz_is_array(obj))
fz_warn("assert: not an array (%s)", fz_objkindstr(obj));
else
{
@@ -131,16 +131,16 @@ fz_arrayinsert(fz_obj *obj, fz_obj *item)
obj->u.a.cap = (obj->u.a.cap * 3) / 2;
obj->u.a.items = fz_realloc(obj->u.a.items, obj->u.a.cap, sizeof(fz_obj*));
for (i = obj->u.a.len ; i < obj->u.a.cap; i++)
- obj->u.a.items[i] = nil;
+ obj->u.a.items[i] = NULL;
}
memmove(obj->u.a.items + 1, obj->u.a.items, obj->u.a.len * sizeof(fz_obj*));
- obj->u.a.items[0] = fz_keepobj(item);
+ obj->u.a.items[0] = fz_keep_obj(item);
obj->u.a.len++;
}
}
void
-fz_freearray(fz_obj *obj)
+fz_free_array(fz_obj *obj)
{
int i;
@@ -148,7 +148,7 @@ fz_freearray(fz_obj *obj)
for (i = 0; i < obj->u.a.len; i++)
if (obj->u.a.items[i])
- fz_dropobj(obj->u.a.items[i]);
+ fz_drop_obj(obj->u.a.items[i]);
fz_free(obj->u.a.items);
fz_free(obj);
diff --git a/fitz/obj_dict.c b/fitz/obj_dict.c
index d1cc22cc..6f3ba9da 100644
--- a/fitz/obj_dict.c
+++ b/fitz/obj_dict.c
@@ -6,20 +6,20 @@ static int keyvalcmp(const void *ap, const void *bp)
{
const fz_keyval *a = ap;
const fz_keyval *b = bp;
- if (fz_isname(a->k) && fz_isname(b->k))
- return strcmp(fz_toname(a->k), fz_toname(b->k));
+ if (fz_is_name(a->k) && fz_is_name(b->k))
+ return strcmp(fz_to_name(a->k), fz_to_name(b->k));
return -1;
}
static inline int keystrcmp(fz_obj *key, char *s)
{
- if (fz_isname(key))
- return strcmp(fz_toname(key), s);
+ if (fz_is_name(key))
+ return strcmp(fz_to_name(key), s);
return -1;
}
fz_obj *
-fz_newdict(int initialcap)
+fz_new_dict(int initialcap)
{
fz_obj *obj;
int i;
@@ -35,68 +35,68 @@ fz_newdict(int initialcap)
obj->u.d.items = fz_calloc(obj->u.d.cap, sizeof(fz_keyval));
for (i = 0; i < obj->u.d.cap; i++)
{
- obj->u.d.items[i].k = nil;
- obj->u.d.items[i].v = nil;
+ obj->u.d.items[i].k = NULL;
+ obj->u.d.items[i].v = NULL;
}
return obj;
}
fz_obj *
-fz_copydict(fz_obj *obj)
+fz_copy_dict(fz_obj *obj)
{
fz_obj *new;
int i;
- if (fz_isindirect(obj) || !fz_isdict(obj))
+ if (fz_is_indirect(obj) || !fz_is_dict(obj))
fz_throw("assert: not a dict (%s)", fz_objkindstr(obj));
- new = fz_newdict(fz_dictlen(obj));
- for (i = 0; i < fz_dictlen(obj); i++)
- fz_dictput(new, fz_dictgetkey(obj, i), fz_dictgetval(obj, i));
+ new = fz_new_dict(fz_dict_len(obj));
+ for (i = 0; i < fz_dict_len(obj); i++)
+ fz_dict_put(new, fz_dict_get_key(obj, i), fz_dict_get_val(obj, i));
return new;
}
int
-fz_dictlen(fz_obj *obj)
+fz_dict_len(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (!fz_isdict(obj))
+ obj = fz_resolve_indirect(obj);
+ if (!fz_is_dict(obj))
return 0;
return obj->u.d.len;
}
fz_obj *
-fz_dictgetkey(fz_obj *obj, int i)
+fz_dict_get_key(fz_obj *obj, int i)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isdict(obj))
- return nil;
+ if (!fz_is_dict(obj))
+ return NULL;
if (i < 0 || i >= obj->u.d.len)
- return nil;
+ return NULL;
return obj->u.d.items[i].k;
}
fz_obj *
-fz_dictgetval(fz_obj *obj, int i)
+fz_dict_get_val(fz_obj *obj, int i)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isdict(obj))
- return nil;
+ if (!fz_is_dict(obj))
+ return NULL;
if (i < 0 || i >= obj->u.d.len)
- return nil;
+ return NULL;
return obj->u.d.items[i].v;
}
static inline int
-fz_dictfinds(fz_obj *obj, char *key)
+fz_dict_finds(fz_obj *obj, char *key)
{
if (obj->u.d.sorted)
{
@@ -127,56 +127,56 @@ fz_dictfinds(fz_obj *obj, char *key)
}
fz_obj *
-fz_dictgets(fz_obj *obj, char *key)
+fz_dict_gets(fz_obj *obj, char *key)
{
int i;
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isdict(obj))
- return nil;
+ if (!fz_is_dict(obj))
+ return NULL;
- i = fz_dictfinds(obj, key);
+ i = fz_dict_finds(obj, key);
if (i >= 0)
return obj->u.d.items[i].v;
- return nil;
+ return NULL;
}
fz_obj *
-fz_dictget(fz_obj *obj, fz_obj *key)
+fz_dict_get(fz_obj *obj, fz_obj *key)
{
- if (fz_isname(key))
- return fz_dictgets(obj, fz_toname(key));
- return nil;
+ if (fz_is_name(key))
+ return fz_dict_gets(obj, fz_to_name(key));
+ return NULL;
}
fz_obj *
-fz_dictgetsa(fz_obj *obj, char *key, char *abbrev)
+fz_dict_getsa(fz_obj *obj, char *key, char *abbrev)
{
fz_obj *v;
- v = fz_dictgets(obj, key);
+ v = fz_dict_gets(obj, key);
if (v)
return v;
- return fz_dictgets(obj, abbrev);
+ return fz_dict_gets(obj, abbrev);
}
void
-fz_dictput(fz_obj *obj, fz_obj *key, fz_obj *val)
+fz_dict_put(fz_obj *obj, fz_obj *key, fz_obj *val)
{
char *s;
int i;
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isdict(obj))
+ if (!fz_is_dict(obj))
{
fz_warn("assert: not a dict (%s)", fz_objkindstr(obj));
return;
}
- if (fz_isname(key))
- s = fz_toname(key);
+ if (fz_is_name(key))
+ s = fz_to_name(key);
else
{
fz_warn("assert: key is not a name (%s)", fz_objkindstr(obj));
@@ -189,11 +189,11 @@ fz_dictput(fz_obj *obj, fz_obj *key, fz_obj *val)
return;
}
- i = fz_dictfinds(obj, s);
+ i = fz_dict_finds(obj, s);
if (i >= 0)
{
- fz_dropobj(obj->u.d.items[i].v);
- obj->u.d.items[i].v = fz_keepobj(val);
+ fz_drop_obj(obj->u.d.items[i].v);
+ obj->u.d.items[i].v = fz_keep_obj(val);
return;
}
@@ -203,8 +203,8 @@ fz_dictput(fz_obj *obj, fz_obj *key, fz_obj *val)
obj->u.d.items = fz_realloc(obj->u.d.items, obj->u.d.cap, sizeof(fz_keyval));
for (i = obj->u.d.len; i < obj->u.d.cap; i++)
{
- obj->u.d.items[i].k = nil;
- obj->u.d.items[i].v = nil;
+ obj->u.d.items[i].k = NULL;
+ obj->u.d.items[i].v = NULL;
}
}
@@ -213,33 +213,33 @@ fz_dictput(fz_obj *obj, fz_obj *key, fz_obj *val)
if (keystrcmp(obj->u.d.items[obj->u.d.len - 1].k, s) > 0)
obj->u.d.sorted = 0;
- obj->u.d.items[obj->u.d.len].k = fz_keepobj(key);
- obj->u.d.items[obj->u.d.len].v = fz_keepobj(val);
+ obj->u.d.items[obj->u.d.len].k = fz_keep_obj(key);
+ obj->u.d.items[obj->u.d.len].v = fz_keep_obj(val);
obj->u.d.len ++;
}
void
-fz_dictputs(fz_obj *obj, char *key, fz_obj *val)
+fz_dict_puts(fz_obj *obj, char *key, fz_obj *val)
{
- fz_obj *keyobj = fz_newname(key);
- fz_dictput(obj, keyobj, val);
- fz_dropobj(keyobj);
+ fz_obj *keyobj = fz_new_name(key);
+ fz_dict_put(obj, keyobj, val);
+ fz_drop_obj(keyobj);
}
void
-fz_dictdels(fz_obj *obj, char *key)
+fz_dict_dels(fz_obj *obj, char *key)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isdict(obj))
+ if (!fz_is_dict(obj))
fz_warn("assert: not a dict (%s)", fz_objkindstr(obj));
else
{
- int i = fz_dictfinds(obj, key);
+ int i = fz_dict_finds(obj, key);
if (i >= 0)
{
- fz_dropobj(obj->u.d.items[i].k);
- fz_dropobj(obj->u.d.items[i].v);
+ fz_drop_obj(obj->u.d.items[i].k);
+ fz_drop_obj(obj->u.d.items[i].v);
obj->u.d.sorted = 0;
obj->u.d.items[i] = obj->u.d.items[obj->u.d.len-1];
obj->u.d.len --;
@@ -248,29 +248,29 @@ fz_dictdels(fz_obj *obj, char *key)
}
void
-fz_dictdel(fz_obj *obj, fz_obj *key)
+fz_dict_del(fz_obj *obj, fz_obj *key)
{
- if (fz_isname(key))
- fz_dictdels(obj, fz_toname(key));
+ if (fz_is_name(key))
+ fz_dict_dels(obj, fz_to_name(key));
else
fz_warn("assert: key is not a name (%s)", fz_objkindstr(obj));
}
void
-fz_freedict(fz_obj *obj)
+fz_free_dict(fz_obj *obj)
{
int i;
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
- if (!fz_isdict(obj))
+ if (!fz_is_dict(obj))
return;
for (i = 0; i < obj->u.d.len; i++) {
if (obj->u.d.items[i].k)
- fz_dropobj(obj->u.d.items[i].k);
+ fz_drop_obj(obj->u.d.items[i].k);
if (obj->u.d.items[i].v)
- fz_dropobj(obj->u.d.items[i].v);
+ fz_drop_obj(obj->u.d.items[i].v);
}
fz_free(obj->u.d.items);
@@ -278,10 +278,10 @@ fz_freedict(fz_obj *obj)
}
void
-fz_sortdict(fz_obj *obj)
+fz_sort_dict(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (!fz_isdict(obj))
+ obj = fz_resolve_indirect(obj);
+ if (!fz_is_dict(obj))
return;
if (!obj->u.d.sorted)
{
diff --git a/fitz/obj_print.c b/fitz/obj_print.c
index 4233b80f..3433903c 100644
--- a/fitz/obj_print.c
+++ b/fitz/obj_print.c
@@ -12,7 +12,7 @@ struct fmt
int last;
};
-static void fmtobj(struct fmt *fmt, fz_obj *obj);
+static void fmt_obj(struct fmt *fmt, fz_obj *obj);
static inline int iswhite(int ch)
{
@@ -35,11 +35,11 @@ static inline int isdelim(int ch)
ch == '%';
}
-static inline void fmtputc(struct fmt *fmt, int c)
+static inline void fmt_putc(struct fmt *fmt, int c)
{
if (fmt->sep && !isdelim(fmt->last) && !isdelim(c)) {
fmt->sep = 0;
- fmtputc(fmt, ' ');
+ fmt_putc(fmt, ' ');
}
fmt->sep = 0;
@@ -56,195 +56,195 @@ static inline void fmtputc(struct fmt *fmt, int c)
fmt->last = c;
}
-static inline void fmtindent(struct fmt *fmt)
+static inline void fmt_indent(struct fmt *fmt)
{
int i = fmt->indent;
while (i--) {
- fmtputc(fmt, ' ');
- fmtputc(fmt, ' ');
+ fmt_putc(fmt, ' ');
+ fmt_putc(fmt, ' ');
}
}
-static inline void fmtputs(struct fmt *fmt, char *s)
+static inline void fmt_puts(struct fmt *fmt, char *s)
{
while (*s)
- fmtputc(fmt, *s++);
+ fmt_putc(fmt, *s++);
}
-static inline void fmtsep(struct fmt *fmt)
+static inline void fmt_sep(struct fmt *fmt)
{
fmt->sep = 1;
}
-static void fmtstr(struct fmt *fmt, fz_obj *obj)
+static void fmt_str(struct fmt *fmt, fz_obj *obj)
{
int i, c;
- fmtputc(fmt, '(');
+ fmt_putc(fmt, '(');
for (i = 0; i < obj->u.s.len; i++)
{
c = (unsigned char) obj->u.s.buf[i];
if (c == '\n')
- fmtputs(fmt, "\\n");
+ fmt_puts(fmt, "\\n");
else if (c == '\r')
- fmtputs(fmt, "\\r");
+ fmt_puts(fmt, "\\r");
else if (c == '\t')
- fmtputs(fmt, "\\t");
+ fmt_puts(fmt, "\\t");
else if (c == '\b')
- fmtputs(fmt, "\\b");
+ fmt_puts(fmt, "\\b");
else if (c == '\f')
- fmtputs(fmt, "\\f");
+ fmt_puts(fmt, "\\f");
else if (c == '(')
- fmtputs(fmt, "\\(");
+ fmt_puts(fmt, "\\(");
else if (c == ')')
- fmtputs(fmt, "\\)");
+ fmt_puts(fmt, "\\)");
else if (c < 32 || c > 126) {
char buf[16];
- fmtputc(fmt, '\\');
+ fmt_putc(fmt, '\\');
sprintf(buf, "%o", c);
- fmtputs(fmt, buf);
+ fmt_puts(fmt, buf);
}
else
- fmtputc(fmt, c);
+ fmt_putc(fmt, c);
}
- fmtputc(fmt, ')');
+ fmt_putc(fmt, ')');
}
-static void fmthex(struct fmt *fmt, fz_obj *obj)
+static void fmt_hex(struct fmt *fmt, fz_obj *obj)
{
int i, b, c;
- fmtputc(fmt, '<');
+ fmt_putc(fmt, '<');
for (i = 0; i < obj->u.s.len; i++) {
b = (unsigned char) obj->u.s.buf[i];
c = (b >> 4) & 0x0f;
- fmtputc(fmt, c < 0xA ? c + '0' : c + 'A' - 0xA);
+ fmt_putc(fmt, c < 0xA ? c + '0' : c + 'A' - 0xA);
c = (b) & 0x0f;
- fmtputc(fmt, c < 0xA ? c + '0' : c + 'A' - 0xA);
+ fmt_putc(fmt, c < 0xA ? c + '0' : c + 'A' - 0xA);
}
- fmtputc(fmt, '>');
+ fmt_putc(fmt, '>');
}
-static void fmtname(struct fmt *fmt, fz_obj *obj)
+static void fmt_name(struct fmt *fmt, fz_obj *obj)
{
- unsigned char *s = (unsigned char *) fz_toname(obj);
+ unsigned char *s = (unsigned char *) fz_to_name(obj);
int i, c;
- fmtputc(fmt, '/');
+ fmt_putc(fmt, '/');
for (i = 0; s[i]; i++)
{
if (isdelim(s[i]) || iswhite(s[i]) ||
s[i] == '#' || s[i] < 32 || s[i] > 127)
{
- fmtputc(fmt, '#');
+ fmt_putc(fmt, '#');
c = (s[i] >> 4) & 0xf;
- fmtputc(fmt, c < 0xA ? c + '0' : c + 'A' - 0xA);
+ fmt_putc(fmt, c < 0xA ? c + '0' : c + 'A' - 0xA);
c = s[i] & 0xf;
- fmtputc(fmt, c < 0xA ? c + '0' : c + 'A' - 0xA);
+ fmt_putc(fmt, c < 0xA ? c + '0' : c + 'A' - 0xA);
}
else
{
- fmtputc(fmt, s[i]);
+ fmt_putc(fmt, s[i]);
}
}
}
-static void fmtarray(struct fmt *fmt, fz_obj *obj)
+static void fmt_array(struct fmt *fmt, fz_obj *obj)
{
int i;
if (fmt->tight) {
- fmtputc(fmt, '[');
- for (i = 0; i < fz_arraylen(obj); i++) {
- fmtobj(fmt, fz_arrayget(obj, i));
- fmtsep(fmt);
+ fmt_putc(fmt, '[');
+ for (i = 0; i < fz_array_len(obj); i++) {
+ fmt_obj(fmt, fz_array_get(obj, i));
+ fmt_sep(fmt);
}
- fmtputc(fmt, ']');
+ fmt_putc(fmt, ']');
}
else {
- fmtputs(fmt, "[ ");
- for (i = 0; i < fz_arraylen(obj); i++) {
+ fmt_puts(fmt, "[ ");
+ for (i = 0; i < fz_array_len(obj); i++) {
if (fmt->col > 60) {
- fmtputc(fmt, '\n');
- fmtindent(fmt);
+ fmt_putc(fmt, '\n');
+ fmt_indent(fmt);
}
- fmtobj(fmt, fz_arrayget(obj, i));
- fmtputc(fmt, ' ');
+ fmt_obj(fmt, fz_array_get(obj, i));
+ fmt_putc(fmt, ' ');
}
- fmtputc(fmt, ']');
- fmtsep(fmt);
+ fmt_putc(fmt, ']');
+ fmt_sep(fmt);
}
}
-static void fmtdict(struct fmt *fmt, fz_obj *obj)
+static void fmt_dict(struct fmt *fmt, fz_obj *obj)
{
int i;
fz_obj *key, *val;
if (fmt->tight) {
- fmtputs(fmt, "<<");
- for (i = 0; i < fz_dictlen(obj); i++) {
- fmtobj(fmt, fz_dictgetkey(obj, i));
- fmtsep(fmt);
- fmtobj(fmt, fz_dictgetval(obj, i));
- fmtsep(fmt);
+ fmt_puts(fmt, "<<");
+ for (i = 0; i < fz_dict_len(obj); i++) {
+ fmt_obj(fmt, fz_dict_get_key(obj, i));
+ fmt_sep(fmt);
+ fmt_obj(fmt, fz_dict_get_val(obj, i));
+ fmt_sep(fmt);
}
- fmtputs(fmt, ">>");
+ fmt_puts(fmt, ">>");
}
else {
- fmtputs(fmt, "<<\n");
+ fmt_puts(fmt, "<<\n");
fmt->indent ++;
- for (i = 0; i < fz_dictlen(obj); i++) {
- key = fz_dictgetkey(obj, i);
- val = fz_dictgetval(obj, i);
- fmtindent(fmt);
- fmtobj(fmt, key);
- fmtputc(fmt, ' ');
- if (!fz_isindirect(val) && fz_isarray(val))
+ for (i = 0; i < fz_dict_len(obj); i++) {
+ key = fz_dict_get_key(obj, i);
+ val = fz_dict_get_val(obj, i);
+ fmt_indent(fmt);
+ fmt_obj(fmt, key);
+ fmt_putc(fmt, ' ');
+ if (!fz_is_indirect(val) && fz_is_array(val))
fmt->indent ++;
- fmtobj(fmt, val);
- fmtputc(fmt, '\n');
- if (!fz_isindirect(val) && fz_isarray(val))
+ fmt_obj(fmt, val);
+ fmt_putc(fmt, '\n');
+ if (!fz_is_indirect(val) && fz_is_array(val))
fmt->indent --;
}
fmt->indent --;
- fmtindent(fmt);
- fmtputs(fmt, ">>");
+ fmt_indent(fmt);
+ fmt_puts(fmt, ">>");
}
}
-static void fmtobj(struct fmt *fmt, fz_obj *obj)
+static void fmt_obj(struct fmt *fmt, fz_obj *obj)
{
char buf[256];
if (!obj)
- fmtputs(fmt, "<nil>");
- else if (fz_isindirect(obj))
+ fmt_puts(fmt, "<NULL>");
+ else if (fz_is_indirect(obj))
{
- sprintf(buf, "%d %d R", fz_tonum(obj), fz_togen(obj));
- fmtputs(fmt, buf);
+ sprintf(buf, "%d %d R", fz_to_num(obj), fz_to_gen(obj));
+ fmt_puts(fmt, buf);
}
- else if (fz_isnull(obj))
- fmtputs(fmt, "null");
- else if (fz_isbool(obj))
- fmtputs(fmt, fz_tobool(obj) ? "true" : "false");
- else if (fz_isint(obj))
+ else if (fz_is_null(obj))
+ fmt_puts(fmt, "null");
+ else if (fz_is_bool(obj))
+ fmt_puts(fmt, fz_to_bool(obj) ? "true" : "false");
+ else if (fz_is_int(obj))
{
- sprintf(buf, "%d", fz_toint(obj));
- fmtputs(fmt, buf);
+ sprintf(buf, "%d", fz_to_int(obj));
+ fmt_puts(fmt, buf);
}
- else if (fz_isreal(obj))
+ else if (fz_is_real(obj))
{
- sprintf(buf, "%g", fz_toreal(obj));
+ sprintf(buf, "%g", fz_to_real(obj));
if (strchr(buf, 'e')) /* bad news! */
- sprintf(buf, fabsf(fz_toreal(obj)) > 1 ? "%1.1f" : "%1.8f", fz_toreal(obj));
- fmtputs(fmt, buf);
+ sprintf(buf, fabsf(fz_to_real(obj)) > 1 ? "%1.1f" : "%1.8f", fz_to_real(obj));
+ fmt_puts(fmt, buf);
}
- else if (fz_isstring(obj))
+ else if (fz_is_string(obj))
{
- char *str = fz_tostrbuf(obj);
- int len = fz_tostrlen(obj);
+ char *str = fz_to_str_buf(obj);
+ int len = fz_to_str_len(obj);
int added = 0;
int i, c;
for (i = 0; i < len; i++) {
@@ -259,22 +259,22 @@ static void fmtobj(struct fmt *fmt, fz_obj *obj)
added += 3;
}
if (added < obj->u.s.len)
- fmtstr(fmt, obj);
+ fmt_str(fmt, obj);
else
- fmthex(fmt, obj);
+ fmt_hex(fmt, obj);
}
- else if (fz_isname(obj))
- fmtname(fmt, obj);
- else if (fz_isarray(obj))
- fmtarray(fmt, obj);
- else if (fz_isdict(obj))
- fmtdict(fmt, obj);
+ else if (fz_is_name(obj))
+ fmt_name(fmt, obj);
+ else if (fz_is_array(obj))
+ fmt_array(fmt, obj);
+ else if (fz_is_dict(obj))
+ fmt_dict(fmt, obj);
else
- fmtputs(fmt, "<unknown object>");
+ fmt_puts(fmt, "<unknown object>");
}
static int
-fz_sprintobj(char *s, int n, fz_obj *obj, int tight)
+fz_sprint_obj(char *s, int n, fz_obj *obj, int tight)
{
struct fmt fmt;
@@ -287,7 +287,7 @@ fz_sprintobj(char *s, int n, fz_obj *obj, int tight)
fmt.buf = s;
fmt.cap = n;
fmt.len = 0;
- fmtobj(&fmt, obj);
+ fmt_obj(&fmt, obj);
if (fmt.buf && fmt.len < fmt.cap)
fmt.buf[fmt.len] = '\0';
@@ -296,23 +296,23 @@ fz_sprintobj(char *s, int n, fz_obj *obj, int tight)
}
int
-fz_fprintobj(FILE *fp, fz_obj *obj, int tight)
+fz_fprint_obj(FILE *fp, fz_obj *obj, int tight)
{
char buf[1024];
char *ptr;
int n;
- n = fz_sprintobj(nil, 0, obj, tight);
+ n = fz_sprint_obj(NULL, 0, obj, tight);
if ((n + 1) < sizeof buf)
{
- fz_sprintobj(buf, sizeof buf, obj, tight);
+ fz_sprint_obj(buf, sizeof buf, obj, tight);
fputs(buf, fp);
fputc('\n', fp);
}
else
{
ptr = fz_malloc(n + 1);
- fz_sprintobj(ptr, n + 1, obj, tight);
+ fz_sprint_obj(ptr, n + 1, obj, tight);
fputs(ptr, fp);
fputc('\n', fp);
fz_free(ptr);
@@ -321,16 +321,15 @@ fz_fprintobj(FILE *fp, fz_obj *obj, int tight)
}
void
-fz_debugobj(fz_obj *obj)
+fz_debug_obj(fz_obj *obj)
{
- fz_fprintobj(stdout, obj, 0);
+ fz_fprint_obj(stdout, obj, 0);
}
void
-fz_debugref(fz_obj *ref)
+fz_debug_ref(fz_obj *ref)
{
fz_obj *obj;
- obj = fz_resolveindirect(ref);
- fz_debugobj(obj);
+ obj = fz_resolve_indirect(ref);
+ fz_debug_obj(obj);
}
-
diff --git a/fitz/obj_simple.c b/fitz/obj_simple.c
index b629974e..2dc9d686 100644
--- a/fitz/obj_simple.c
+++ b/fitz/obj_simple.c
@@ -1,17 +1,17 @@
#include "fitz.h"
-extern void fz_freearray(fz_obj *array);
-extern void fz_freedict(fz_obj *dict);
+extern void fz_free_array(fz_obj *array);
+extern void fz_free_dict(fz_obj *dict);
static fz_obj *fz_resolve_indirect_null(fz_obj *ref)
{
return ref;
}
-fz_obj* (*fz_resolveindirect)(fz_obj*) = fz_resolve_indirect_null;
+fz_obj* (*fz_resolve_indirect)(fz_obj*) = fz_resolve_indirect_null;
fz_obj *
-fz_newnull(void)
+fz_new_null(void)
{
fz_obj *o = fz_malloc(sizeof(fz_obj));
o->refs = 1;
@@ -20,7 +20,7 @@ fz_newnull(void)
}
fz_obj *
-fz_newbool(int b)
+fz_new_bool(int b)
{
fz_obj *o = fz_malloc(sizeof(fz_obj));
o->refs = 1;
@@ -30,7 +30,7 @@ fz_newbool(int b)
}
fz_obj *
-fz_newint(int i)
+fz_new_int(int i)
{
fz_obj *o = fz_malloc(sizeof(fz_obj));
o->refs = 1;
@@ -40,7 +40,7 @@ fz_newint(int i)
}
fz_obj *
-fz_newreal(float f)
+fz_new_real(float f)
{
fz_obj *o = fz_malloc(sizeof(fz_obj));
o->refs = 1;
@@ -50,7 +50,7 @@ fz_newreal(float f)
}
fz_obj *
-fz_newstring(char *str, int len)
+fz_new_string(char *str, int len)
{
fz_obj *o = fz_malloc(offsetof(fz_obj, u.s.buf) + len + 1);
o->refs = 1;
@@ -62,7 +62,7 @@ fz_newstring(char *str, int len)
}
fz_obj *
-fz_newname(char *str)
+fz_new_name(char *str)
{
fz_obj *o = fz_malloc(offsetof(fz_obj, u.n) + strlen(str) + 1);
o->refs = 1;
@@ -72,7 +72,7 @@ fz_newname(char *str)
}
fz_obj *
-fz_newindirect(int num, int gen, void *xref)
+fz_new_indirect(int num, int gen, void *xref)
{
fz_obj *o = fz_malloc(sizeof(fz_obj));
o->refs = 1;
@@ -84,143 +84,143 @@ fz_newindirect(int num, int gen, void *xref)
}
fz_obj *
-fz_keepobj(fz_obj *o)
+fz_keep_obj(fz_obj *o)
{
- assert(o != nil);
+ assert(o != NULL);
o->refs ++;
return o;
}
void
-fz_dropobj(fz_obj *o)
+fz_drop_obj(fz_obj *o)
{
- assert(o != nil);
+ assert(o != NULL);
if (--o->refs == 0)
{
if (o->kind == FZ_ARRAY)
- fz_freearray(o);
+ fz_free_array(o);
else if (o->kind == FZ_DICT)
- fz_freedict(o);
+ fz_free_dict(o);
else
fz_free(o);
}
}
-int fz_isindirect(fz_obj *obj)
+int fz_is_indirect(fz_obj *obj)
{
return obj ? obj->kind == FZ_INDIRECT : 0;
}
-int fz_isnull(fz_obj *obj)
+int fz_is_null(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
return obj ? obj->kind == FZ_NULL : 0;
}
-int fz_isbool(fz_obj *obj)
+int fz_is_bool(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
return obj ? obj->kind == FZ_BOOL : 0;
}
-int fz_isint(fz_obj *obj)
+int fz_is_int(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
return obj ? obj->kind == FZ_INT : 0;
}
-int fz_isreal(fz_obj *obj)
+int fz_is_real(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
return obj ? obj->kind == FZ_REAL : 0;
}
-int fz_isstring(fz_obj *obj)
+int fz_is_string(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
return obj ? obj->kind == FZ_STRING : 0;
}
-int fz_isname(fz_obj *obj)
+int fz_is_name(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
return obj ? obj->kind == FZ_NAME : 0;
}
-int fz_isarray(fz_obj *obj)
+int fz_is_array(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
return obj ? obj->kind == FZ_ARRAY : 0;
}
-int fz_isdict(fz_obj *obj)
+int fz_is_dict(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
+ obj = fz_resolve_indirect(obj);
return obj ? obj->kind == FZ_DICT : 0;
}
-int fz_tobool(fz_obj *obj)
+int fz_to_bool(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (fz_isbool(obj))
+ obj = fz_resolve_indirect(obj);
+ if (fz_is_bool(obj))
return obj->u.b;
return 0;
}
-int fz_toint(fz_obj *obj)
+int fz_to_int(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (fz_isint(obj))
+ obj = fz_resolve_indirect(obj);
+ if (fz_is_int(obj))
return obj->u.i;
- if (fz_isreal(obj))
+ if (fz_is_real(obj))
return obj->u.f;
return 0;
}
-float fz_toreal(fz_obj *obj)
+float fz_to_real(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (fz_isreal(obj))
+ obj = fz_resolve_indirect(obj);
+ if (fz_is_real(obj))
return obj->u.f;
- if (fz_isint(obj))
+ if (fz_is_int(obj))
return obj->u.i;
return 0;
}
-char *fz_toname(fz_obj *obj)
+char *fz_to_name(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (fz_isname(obj))
+ obj = fz_resolve_indirect(obj);
+ if (fz_is_name(obj))
return obj->u.n;
return "";
}
-char *fz_tostrbuf(fz_obj *obj)
+char *fz_to_str_buf(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (fz_isstring(obj))
+ obj = fz_resolve_indirect(obj);
+ if (fz_is_string(obj))
return obj->u.s.buf;
return "";
}
-int fz_tostrlen(fz_obj *obj)
+int fz_to_str_len(fz_obj *obj)
{
- obj = fz_resolveindirect(obj);
- if (fz_isstring(obj))
+ obj = fz_resolve_indirect(obj);
+ if (fz_is_string(obj))
return obj->u.s.len;
return 0;
}
-int fz_tonum(fz_obj *obj)
+int fz_to_num(fz_obj *obj)
{
- if (fz_isindirect(obj))
+ if (fz_is_indirect(obj))
return obj->u.r.num;
return 0;
}
-int fz_togen(fz_obj *obj)
+int fz_to_gen(fz_obj *obj)
{
- if (fz_isindirect(obj))
+ if (fz_is_indirect(obj))
return obj->u.r.gen;
return 0;
}
@@ -306,8 +306,8 @@ fz_objcmp(fz_obj *a, fz_obj *b)
char *fz_objkindstr(fz_obj *obj)
{
- if (obj == nil)
- return "<nil>";
+ if (obj == NULL)
+ return "<NULL>";
switch (obj->kind)
{
case FZ_NULL: return "null";
diff --git a/fitz/res_colorspace.c b/fitz/res_colorspace.c
index 09e6c349..a98d568b 100644
--- a/fitz/res_colorspace.c
+++ b/fitz/res_colorspace.c
@@ -3,21 +3,21 @@
#define SLOWCMYK
fz_colorspace *
-fz_newcolorspace(char *name, int n)
+fz_new_colorspace(char *name, int n)
{
fz_colorspace *cs = fz_malloc(sizeof(fz_colorspace));
cs->refs = 1;
fz_strlcpy(cs->name, name, sizeof cs->name);
cs->n = n;
- cs->toxyz = nil;
- cs->fromxyz = nil;
- cs->freedata = nil;
- cs->data = nil;
+ cs->to_xyz = NULL;
+ cs->from_xyz = NULL;
+ cs->free_data = NULL;
+ cs->data = NULL;
return cs;
}
fz_colorspace *
-fz_keepcolorspace(fz_colorspace *cs)
+fz_keep_colorspace(fz_colorspace *cs)
{
if (cs->refs < 0)
return cs;
@@ -26,28 +26,28 @@ fz_keepcolorspace(fz_colorspace *cs)
}
void
-fz_dropcolorspace(fz_colorspace *cs)
+fz_drop_colorspace(fz_colorspace *cs)
{
if (cs && cs->refs < 0)
return;
if (cs && --cs->refs == 0)
{
- if (cs->freedata && cs->data)
- cs->freedata(cs);
+ if (cs->free_data && cs->data)
+ cs->free_data(cs);
fz_free(cs);
}
}
/* Device colorspace definitions */
-static void graytoxyz(fz_colorspace *cs, float *gray, float *xyz)
+static void gray_to_xyz(fz_colorspace *cs, float *gray, float *xyz)
{
xyz[0] = gray[0];
xyz[1] = gray[0];
xyz[2] = gray[0];
}
-static void xyztogray(fz_colorspace *cs, float *xyz, float *gray)
+static void xyz_to_gray(fz_colorspace *cs, float *xyz, float *gray)
{
float r = xyz[0];
float g = xyz[1];
@@ -55,35 +55,35 @@ static void xyztogray(fz_colorspace *cs, float *xyz, float *gray)
gray[0] = r * 0.3f + g * 0.59f + b * 0.11f;
}
-static void rgbtoxyz(fz_colorspace *cs, float *rgb, float *xyz)
+static void rgb_to_xyz(fz_colorspace *cs, float *rgb, float *xyz)
{
xyz[0] = rgb[0];
xyz[1] = rgb[1];
xyz[2] = rgb[2];
}
-static void xyztorgb(fz_colorspace *cs, float *xyz, float *rgb)
+static void xyz_to_rgb(fz_colorspace *cs, float *xyz, float *rgb)
{
rgb[0] = xyz[0];
rgb[1] = xyz[1];
rgb[2] = xyz[2];
}
-static void bgrtoxyz(fz_colorspace *cs, float *bgr, float *xyz)
+static void bgr_to_xyz(fz_colorspace *cs, float *bgr, float *xyz)
{
xyz[0] = bgr[2];
xyz[1] = bgr[1];
xyz[2] = bgr[0];
}
-static void xyztobgr(fz_colorspace *cs, float *xyz, float *bgr)
+static void xyz_to_bgr(fz_colorspace *cs, float *xyz, float *bgr)
{
bgr[0] = xyz[2];
bgr[1] = xyz[1];
bgr[2] = xyz[0];
}
-static void cmyktoxyz(fz_colorspace *cs, float *cmyk, float *xyz)
+static void cmyk_to_xyz(fz_colorspace *cs, float *cmyk, float *xyz)
{
#ifdef SLOWCMYK /* from poppler */
float c = cmyk[0], m = cmyk[1], y = cmyk[2], k = cmyk[3];
@@ -146,7 +146,7 @@ static void cmyktoxyz(fz_colorspace *cs, float *cmyk, float *xyz)
#endif
}
-static void xyztocmyk(fz_colorspace *cs, float *xyz, float *cmyk)
+static void xyz_to_cmyk(fz_colorspace *cs, float *xyz, float *cmyk)
{
float c, m, y, k;
c = 1 - xyz[0];
@@ -159,19 +159,19 @@ static void xyztocmyk(fz_colorspace *cs, float *xyz, float *cmyk)
cmyk[3] = k;
}
-static fz_colorspace kdevicegray = { -1, "DeviceGray", 1, graytoxyz, xyztogray };
-static fz_colorspace kdevicergb = { -1, "DeviceRGB", 3, rgbtoxyz, xyztorgb };
-static fz_colorspace kdevicebgr = { -1, "DeviceRGB", 3, bgrtoxyz, xyztobgr };
-static fz_colorspace kdevicecmyk = { -1, "DeviceCMYK", 4, cmyktoxyz, xyztocmyk };
+static fz_colorspace k_device_gray = { -1, "DeviceGray", 1, gray_to_xyz, xyz_to_gray };
+static fz_colorspace k_device_rgb = { -1, "DeviceRGB", 3, rgb_to_xyz, xyz_to_rgb };
+static fz_colorspace k_device_bgr = { -1, "DeviceRGB", 3, bgr_to_xyz, xyz_to_bgr };
+static fz_colorspace k_device_cmyk = { -1, "DeviceCMYK", 4, cmyk_to_xyz, xyz_to_cmyk };
-fz_colorspace *fz_devicegray = &kdevicegray;
-fz_colorspace *fz_devicergb = &kdevicergb;
-fz_colorspace *fz_devicebgr = &kdevicebgr;
-fz_colorspace *fz_devicecmyk = &kdevicecmyk;
+fz_colorspace *fz_device_gray = &k_device_gray;
+fz_colorspace *fz_device_rgb = &k_device_rgb;
+fz_colorspace *fz_device_bgr = &k_device_bgr;
+fz_colorspace *fz_device_cmyk = &k_device_cmyk;
/* Fast pixmap color conversions */
-static void fastgraytorgb(fz_pixmap *src, fz_pixmap *dst)
+static void fast_gray_to_rgb(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -187,7 +187,7 @@ static void fastgraytorgb(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastgraytocmyk(fz_pixmap *src, fz_pixmap *dst)
+static void fast_gray_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -204,7 +204,7 @@ static void fastgraytocmyk(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastrgbtogray(fz_pixmap *src, fz_pixmap *dst)
+static void fast_rgb_to_gray(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -218,7 +218,7 @@ static void fastrgbtogray(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastbgrtogray(fz_pixmap *src, fz_pixmap *dst)
+static void fast_bgr_to_gray(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -232,7 +232,7 @@ static void fastbgrtogray(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastrgbtocmyk(fz_pixmap *src, fz_pixmap *dst)
+static void fast_rgb_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -253,7 +253,7 @@ static void fastrgbtocmyk(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastbgrtocmyk(fz_pixmap *src, fz_pixmap *dst)
+static void fast_bgr_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -274,7 +274,7 @@ static void fastbgrtocmyk(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastcmyktogray(fz_pixmap *src, fz_pixmap *dst)
+static void fast_cmyk_to_gray(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -291,7 +291,7 @@ static void fastcmyktogray(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastcmyktorgb(fz_pixmap *src, fz_pixmap *dst)
+static void fast_cmyk_to_rgb(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -304,7 +304,7 @@ static void fastcmyktorgb(fz_pixmap *src, fz_pixmap *dst)
cmyk[1] = s[1] / 255.0f;
cmyk[2] = s[2] / 255.0f;
cmyk[3] = s[3] / 255.0f;
- cmyktoxyz(nil, cmyk, rgb);
+ cmyk_to_xyz(NULL, cmyk, rgb);
d[0] = rgb[0] * 255;
d[1] = rgb[1] * 255;
d[2] = rgb[2] * 255;
@@ -319,7 +319,7 @@ static void fastcmyktorgb(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastcmyktobgr(fz_pixmap *src, fz_pixmap *dst)
+static void fast_cmyk_to_bgr(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -332,7 +332,7 @@ static void fastcmyktobgr(fz_pixmap *src, fz_pixmap *dst)
cmyk[1] = s[1] / 255.0f;
cmyk[2] = s[2] / 255.0f;
cmyk[3] = s[3] / 255.0f;
- cmyktoxyz(nil, cmyk, rgb);
+ cmyk_to_xyz(NULL, cmyk, rgb);
d[0] = rgb[2] * 255;
d[1] = rgb[1] * 255;
d[2] = rgb[0] * 255;
@@ -347,7 +347,7 @@ static void fastcmyktobgr(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fastrgbtobgr(fz_pixmap *src, fz_pixmap *dst)
+static void fast_rgb_to_bgr(fz_pixmap *src, fz_pixmap *dst)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -364,10 +364,10 @@ static void fastrgbtobgr(fz_pixmap *src, fz_pixmap *dst)
}
static void
-fz_stdconvpixmap(fz_pixmap *src, fz_pixmap *dst)
+fz_std_conv_pixmap(fz_pixmap *src, fz_pixmap *dst)
{
- float srcv[FZ_MAXCOLORS];
- float dstv[FZ_MAXCOLORS];
+ float srcv[FZ_MAX_COLORS];
+ float dstv[FZ_MAX_COLORS];
int srcn, dstn;
int y, x, k, i;
@@ -395,7 +395,7 @@ fz_stdconvpixmap(fz_pixmap *src, fz_pixmap *dst)
srcv[1] = *s++ - 128;
srcv[2] = *s++ - 128;
- fz_convertcolor(ss, srcv, ds, dstv);
+ fz_convert_color(ss, srcv, ds, dstv);
for (k = 0; k < dstn; k++)
*d++ = dstv[k] * 255;
@@ -415,7 +415,7 @@ fz_stdconvpixmap(fz_pixmap *src, fz_pixmap *dst)
for (k = 0; k < srcn; k++)
srcv[k] = *s++ / 255.0f;
- fz_convertcolor(ss, srcv, ds, dstv);
+ fz_convert_color(ss, srcv, ds, dstv);
for (k = 0; k < dstn; k++)
*d++ = dstv[k] * 255;
@@ -428,12 +428,12 @@ fz_stdconvpixmap(fz_pixmap *src, fz_pixmap *dst)
/* 1-d lookup table for separation and similar colorspaces */
else if (srcn == 1)
{
- unsigned char lookup[FZ_MAXCOLORS * 256];
+ unsigned char lookup[FZ_MAX_COLORS * 256];
for (i = 0; i < 256; i++)
{
srcv[0] = i / 255.0f;
- fz_convertcolor(ss, srcv, ds, dstv);
+ fz_convert_color(ss, srcv, ds, dstv);
for (k = 0; k < dstn; k++)
lookup[i * dstn + k] = dstv[k] * 255;
}
@@ -453,16 +453,16 @@ fz_stdconvpixmap(fz_pixmap *src, fz_pixmap *dst)
/* Memoize colors using a hash table for the general case */
else
{
- fz_hashtable *lookup;
+ fz_hash_table *lookup;
unsigned char *color;
- lookup = fz_newhash(509, srcn);
+ lookup = fz_new_hash_table(509, srcn);
for (y = 0; y < src->h; y++)
{
for (x = 0; x < src->w; x++)
{
- color = fz_hashfind(lookup, s);
+ color = fz_hash_find(lookup, s);
if (color)
{
memcpy(d, color, dstn);
@@ -474,23 +474,23 @@ fz_stdconvpixmap(fz_pixmap *src, fz_pixmap *dst)
{
for (k = 0; k < srcn; k++)
srcv[k] = *s++ / 255.0f;
- fz_convertcolor(ss, srcv, ds, dstv);
+ fz_convert_color(ss, srcv, ds, dstv);
for (k = 0; k < dstn; k++)
*d++ = dstv[k] * 255;
- fz_hashinsert(lookup, s - srcn, d - dstn);
+ fz_hash_insert(lookup, s - srcn, d - dstn);
*d++ = *s++;
}
}
}
- fz_freehash(lookup);
+ fz_free_hash(lookup);
}
}
void
-fz_convertpixmap(fz_pixmap *sp, fz_pixmap *dp)
+fz_convert_pixmap(fz_pixmap *sp, fz_pixmap *dp)
{
fz_colorspace *ss = sp->colorspace;
fz_colorspace *ds = dp->colorspace;
@@ -498,57 +498,57 @@ fz_convertpixmap(fz_pixmap *sp, fz_pixmap *dp)
assert(ss && ds);
if (sp->mask)
- dp->mask = fz_keeppixmap(sp->mask);
+ dp->mask = fz_keep_pixmap(sp->mask);
dp->interpolate = sp->interpolate;
- if (ss == fz_devicegray)
+ if (ss == fz_device_gray)
{
- if (ds == fz_devicergb) fastgraytorgb(sp, dp);
- else if (ds == fz_devicebgr) fastgraytorgb(sp, dp); /* bgr == rgb here */
- else if (ds == fz_devicecmyk) fastgraytocmyk(sp, dp);
- else fz_stdconvpixmap(sp, dp);
+ if (ds == fz_device_rgb) fast_gray_to_rgb(sp, dp);
+ else if (ds == fz_device_bgr) fast_gray_to_rgb(sp, dp); /* bgr == rgb here */
+ else if (ds == fz_device_cmyk) fast_gray_to_cmyk(sp, dp);
+ else fz_std_conv_pixmap(sp, dp);
}
- else if (ss == fz_devicergb)
+ else if (ss == fz_device_rgb)
{
- if (ds == fz_devicegray) fastrgbtogray(sp, dp);
- else if (ds == fz_devicebgr) fastrgbtobgr(sp, dp);
- else if (ds == fz_devicecmyk) fastrgbtocmyk(sp, dp);
- else fz_stdconvpixmap(sp, dp);
+ if (ds == fz_device_gray) fast_rgb_to_gray(sp, dp);
+ else if (ds == fz_device_bgr) fast_rgb_to_bgr(sp, dp);
+ else if (ds == fz_device_cmyk) fast_rgb_to_cmyk(sp, dp);
+ else fz_std_conv_pixmap(sp, dp);
}
- else if (ss == fz_devicebgr)
+ else if (ss == fz_device_bgr)
{
- if (ds == fz_devicegray) fastbgrtogray(sp, dp);
- else if (ds == fz_devicergb) fastrgbtobgr(sp, dp); /* bgr = rgb here */
- else if (ds == fz_devicecmyk) fastbgrtocmyk(sp, dp);
- else fz_stdconvpixmap(sp, dp);
+ if (ds == fz_device_gray) fast_bgr_to_gray(sp, dp);
+ else if (ds == fz_device_rgb) fast_rgb_to_bgr(sp, dp); /* bgr = rgb here */
+ else if (ds == fz_device_cmyk) fast_bgr_to_cmyk(sp, dp);
+ else fz_std_conv_pixmap(sp, dp);
}
- else if (ss == fz_devicecmyk)
+ else if (ss == fz_device_cmyk)
{
- if (ds == fz_devicegray) fastcmyktogray(sp, dp);
- else if (ds == fz_devicebgr) fastcmyktobgr(sp, dp);
- else if (ds == fz_devicergb) fastcmyktorgb(sp, dp);
- else fz_stdconvpixmap(sp, dp);
+ if (ds == fz_device_gray) fast_cmyk_to_gray(sp, dp);
+ else if (ds == fz_device_bgr) fast_cmyk_to_bgr(sp, dp);
+ else if (ds == fz_device_rgb) fast_cmyk_to_rgb(sp, dp);
+ else fz_std_conv_pixmap(sp, dp);
}
- else fz_stdconvpixmap(sp, dp);
+ else fz_std_conv_pixmap(sp, dp);
}
/* Convert a single color */
static void
-fz_stdconvcolor(fz_colorspace *srcs, float *srcv, fz_colorspace *dsts, float *dstv)
+fz_std_conv_color(fz_colorspace *srcs, float *srcv, fz_colorspace *dsts, float *dstv)
{
float xyz[3];
int i;
if (srcs != dsts)
{
- assert(srcs->toxyz && dsts->fromxyz);
- srcs->toxyz(srcs, srcv, xyz);
- dsts->fromxyz(dsts, xyz, dstv);
+ assert(srcs->to_xyz && dsts->from_xyz);
+ srcs->to_xyz(srcs, srcv, xyz);
+ dsts->from_xyz(dsts, xyz, dstv);
for (i = 0; i < dsts->n; i++)
dstv[i] = CLAMP(dstv[i], 0, 1);
}
@@ -560,17 +560,17 @@ fz_stdconvcolor(fz_colorspace *srcs, float *srcv, fz_colorspace *dsts, float *ds
}
void
-fz_convertcolor(fz_colorspace *ss, float *sv, fz_colorspace *ds, float *dv)
+fz_convert_color(fz_colorspace *ss, float *sv, fz_colorspace *ds, float *dv)
{
- if (ss == fz_devicegray)
+ if (ss == fz_device_gray)
{
- if ((ds == fz_devicergb) || (ds == fz_devicebgr))
+ if ((ds == fz_device_rgb) || (ds == fz_device_bgr))
{
dv[0] = sv[0];
dv[1] = sv[0];
dv[2] = sv[0];
}
- else if (ds == fz_devicecmyk)
+ else if (ds == fz_device_cmyk)
{
dv[0] = 0;
dv[1] = 0;
@@ -578,22 +578,22 @@ fz_convertcolor(fz_colorspace *ss, float *sv, fz_colorspace *ds, float *dv)
dv[3] = sv[0];
}
else
- fz_stdconvcolor(ss, sv, ds, dv);
+ fz_std_conv_color(ss, sv, ds, dv);
}
- else if (ss == fz_devicergb)
+ else if (ss == fz_device_rgb)
{
- if (ds == fz_devicegray)
+ if (ds == fz_device_gray)
{
dv[0] = sv[0] * 0.3f + sv[1] * 0.59f + sv[2] * 0.11f;
}
- else if (ds == fz_devicebgr)
+ else if (ds == fz_device_bgr)
{
dv[0] = sv[2];
dv[1] = sv[1];
dv[2] = sv[0];
}
- else if (ds == fz_devicecmyk)
+ else if (ds == fz_device_cmyk)
{
float c = 1 - sv[0];
float m = 1 - sv[1];
@@ -605,22 +605,22 @@ fz_convertcolor(fz_colorspace *ss, float *sv, fz_colorspace *ds, float *dv)
dv[3] = k;
}
else
- fz_stdconvcolor(ss, sv, ds, dv);
+ fz_std_conv_color(ss, sv, ds, dv);
}
- else if (ss == fz_devicebgr)
+ else if (ss == fz_device_bgr)
{
- if (ds == fz_devicegray)
+ if (ds == fz_device_gray)
{
dv[0] = sv[0] * 0.11f + sv[1] * 0.59f + sv[2] * 0.3f;
}
- else if (ds == fz_devicebgr)
+ else if (ds == fz_device_bgr)
{
dv[0] = sv[2];
dv[1] = sv[1];
dv[2] = sv[0];
}
- else if (ds == fz_devicecmyk)
+ else if (ds == fz_device_cmyk)
{
float c = 1 - sv[2];
float m = 1 - sv[1];
@@ -632,33 +632,33 @@ fz_convertcolor(fz_colorspace *ss, float *sv, fz_colorspace *ds, float *dv)
dv[3] = k;
}
else
- fz_stdconvcolor(ss, sv, ds, dv);
+ fz_std_conv_color(ss, sv, ds, dv);
}
- else if (ss == fz_devicecmyk)
+ else if (ss == fz_device_cmyk)
{
- if (ds == fz_devicegray)
+ if (ds == fz_device_gray)
{
float c = sv[0] * 0.3f;
float m = sv[1] * 0.59f;
float y = sv[2] * 0.11f;
dv[0] = 1 - MIN(c + m + y + sv[3], 1);
}
- else if (ds == fz_devicergb)
+ else if (ds == fz_device_rgb)
{
#ifdef SLOWCMYK
- cmyktoxyz(nil, sv, dv);
+ cmyk_to_xyz(NULL, sv, dv);
#else
dv[0] = 1 - MIN(sv[0] + sv[3], 1);
dv[1] = 1 - MIN(sv[1] + sv[3], 1);
dv[2] = 1 - MIN(sv[2] + sv[3], 1);
#endif
}
- else if (ds == fz_devicebgr)
+ else if (ds == fz_device_bgr)
{
#ifdef SLOWCMYK
float rgb[3];
- cmyktoxyz(nil, sv, rgb);
+ cmyk_to_xyz(NULL, sv, rgb);
dv[0] = rgb[2];
dv[1] = rgb[1];
dv[2] = rgb[0];
@@ -669,9 +669,9 @@ fz_convertcolor(fz_colorspace *ss, float *sv, fz_colorspace *ds, float *dv)
#endif
}
else
- fz_stdconvcolor(ss, sv, ds, dv);
+ fz_std_conv_color(ss, sv, ds, dv);
}
else
- fz_stdconvcolor(ss, sv, ds, dv);
+ fz_std_conv_color(ss, sv, ds, dv);
}
diff --git a/fitz/res_font.c b/fitz/res_font.c
index f076a9e9..f94940a6 100644
--- a/fitz/res_font.c
+++ b/fitz/res_font.c
@@ -4,10 +4,10 @@
#include FT_FREETYPE_H
#include FT_STROKER_H
-static void fz_finalizefreetype(void);
+static void fz_finalize_freetype(void);
static fz_font *
-fz_newfont(void)
+fz_new_font(void)
{
fz_font *font;
@@ -15,41 +15,41 @@ fz_newfont(void)
font->refs = 1;
strcpy(font->name, "<unknown>");
- font->ftface = nil;
- font->ftsubstitute = 0;
- font->fthint = 0;
+ font->ft_face = NULL;
+ font->ft_substitute = 0;
+ font->ft_hint = 0;
- font->ftfile = nil;
- font->ftdata = nil;
- font->ftsize = 0;
+ font->ft_file = NULL;
+ font->ft_data = NULL;
+ font->ft_size = 0;
font->t3matrix = fz_identity;
- font->t3resources = nil;
- font->t3procs = nil;
- font->t3widths = nil;
- font->t3xref = nil;
- font->t3run = nil;
+ font->t3resources = NULL;
+ font->t3procs = NULL;
+ font->t3widths = NULL;
+ font->t3xref = NULL;
+ font->t3run = NULL;
font->bbox.x0 = 0;
font->bbox.y0 = 0;
font->bbox.x1 = 1000;
font->bbox.y1 = 1000;
- font->widthcount = 0;
- font->widthtable = nil;
+ font->width_count = 0;
+ font->width_table = NULL;
return font;
}
fz_font *
-fz_keepfont(fz_font *font)
+fz_keep_font(fz_font *font)
{
font->refs ++;
return font;
}
void
-fz_dropfont(fz_font *font)
+fz_drop_font(fz_font *font)
{
int fterr;
int i;
@@ -59,36 +59,36 @@ fz_dropfont(fz_font *font)
if (font->t3procs)
{
if (font->t3resources)
- fz_dropobj(font->t3resources);
+ fz_drop_obj(font->t3resources);
for (i = 0; i < 256; i++)
if (font->t3procs[i])
- fz_dropbuffer(font->t3procs[i]);
+ fz_drop_buffer(font->t3procs[i]);
fz_free(font->t3procs);
fz_free(font->t3widths);
}
- if (font->ftface)
+ if (font->ft_face)
{
- fterr = FT_Done_Face((FT_Face)font->ftface);
+ fterr = FT_Done_Face((FT_Face)font->ft_face);
if (fterr)
- fz_warn("freetype finalizing face: %s", ft_errorstring(fterr));
- fz_finalizefreetype();
+ fz_warn("freetype finalizing face: %s", ft_error_string(fterr));
+ fz_finalize_freetype();
}
- if (font->ftfile)
- fz_free(font->ftfile);
- if (font->ftdata)
- fz_free(font->ftdata);
+ if (font->ft_file)
+ fz_free(font->ft_file);
+ if (font->ft_data)
+ fz_free(font->ft_data);
- if (font->widthtable)
- fz_free(font->widthtable);
+ if (font->width_table)
+ fz_free(font->width_table);
fz_free(font);
}
}
void
-fz_setfontbbox(fz_font *font, float xmin, float ymin, float xmax, float ymax)
+fz_set_font_bbox(fz_font *font, float xmin, float ymin, float xmax, float ymax)
{
font->bbox.x0 = xmin;
font->bbox.y0 = ymin;
@@ -100,7 +100,7 @@ fz_setfontbbox(fz_font *font, float xmin, float ymin, float xmax, float ymax)
* Freetype hooks
*/
-static FT_Library fz_ftlib = nil;
+static FT_Library fz_ftlib = NULL;
static int fz_ftlib_refs = 0;
#undef __FTERRORS_H__
@@ -119,7 +119,7 @@ static const struct ft_error ft_errors[] =
#include FT_ERRORS_H
};
-char *ft_errorstring(int err)
+char *ft_error_string(int err)
{
const struct ft_error *e;
@@ -131,7 +131,7 @@ char *ft_errorstring(int err)
}
static fz_error
-fz_initfreetype(void)
+fz_init_freetype(void)
{
int fterr;
int maj, min, pat;
@@ -144,14 +144,14 @@ fz_initfreetype(void)
fterr = FT_Init_FreeType(&fz_ftlib);
if (fterr)
- return fz_throw("cannot init freetype: %s", ft_errorstring(fterr));
+ return fz_throw("cannot init freetype: %s", ft_error_string(fterr));
FT_Library_Version(fz_ftlib, &maj, &min, &pat);
if (maj == 2 && min == 1 && pat < 7)
{
fterr = FT_Done_FreeType(fz_ftlib);
if (fterr)
- fz_warn("freetype finalizing: %s", ft_errorstring(fterr));
+ fz_warn("freetype finalizing: %s", ft_error_string(fterr));
return fz_throw("freetype version too old: %d.%d.%d", maj, min, pat);
}
@@ -160,7 +160,7 @@ fz_initfreetype(void)
}
static void
-fz_finalizefreetype(void)
+fz_finalize_freetype(void)
{
int fterr;
@@ -168,29 +168,29 @@ fz_finalizefreetype(void)
{
fterr = FT_Done_FreeType(fz_ftlib);
if (fterr)
- fz_warn("freetype finalizing: %s", ft_errorstring(fterr));
- fz_ftlib = nil;
+ fz_warn("freetype finalizing: %s", ft_error_string(fterr));
+ fz_ftlib = NULL;
}
}
fz_error
-fz_newfontfromfile(fz_font **fontp, char *path, int index)
+fz_new_font_from_file(fz_font **fontp, char *path, int index)
{
FT_Face face;
fz_error error;
fz_font *font;
int fterr;
- error = fz_initfreetype();
+ error = fz_init_freetype();
if (error)
return fz_rethrow(error, "cannot init freetype library");
fterr = FT_New_Face(fz_ftlib, path, index, &face);
if (fterr)
- return fz_throw("freetype: cannot load font: %s", ft_errorstring(fterr));
+ return fz_throw("freetype: cannot load font: %s", ft_error_string(fterr));
- font = fz_newfont();
- font->ftface = face;
+ font = fz_new_font();
+ font->ft_face = face;
font->bbox.x0 = face->bbox.xMin * 1000 / face->units_per_EM;
font->bbox.y0 = face->bbox.yMin * 1000 / face->units_per_EM;
font->bbox.x1 = face->bbox.xMax * 1000 / face->units_per_EM;
@@ -201,23 +201,23 @@ fz_newfontfromfile(fz_font **fontp, char *path, int index)
}
fz_error
-fz_newfontfrombuffer(fz_font **fontp, unsigned char *data, int len, int index)
+fz_new_font_from_memory(fz_font **fontp, unsigned char *data, int len, int index)
{
FT_Face face;
fz_error error;
fz_font *font;
int fterr;
- error = fz_initfreetype();
+ error = fz_init_freetype();
if (error)
return fz_rethrow(error, "cannot init freetype library");
fterr = FT_New_Memory_Face(fz_ftlib, data, len, index, &face);
if (fterr)
- return fz_throw("freetype: cannot load font: %s", ft_errorstring(fterr));
+ return fz_throw("freetype: cannot load font: %s", ft_error_string(fterr));
- font = fz_newfont();
- font->ftface = face;
+ font = fz_new_font();
+ font->ft_face = face;
font->bbox.x0 = face->bbox.xMin * 1000 / face->units_per_EM;
font->bbox.y0 = face->bbox.yMin * 1000 / face->units_per_EM;
font->bbox.x1 = face->bbox.xMax * 1000 / face->units_per_EM;
@@ -228,10 +228,10 @@ fz_newfontfrombuffer(fz_font **fontp, unsigned char *data, int len, int index)
}
static fz_matrix
-fz_adjustftglyphwidth(fz_font *font, int gid, fz_matrix trm)
+fz_adjust_ft_glyph_width(fz_font *font, int gid, fz_matrix trm)
{
/* Fudge the font matrix to stretch the glyph if we've substituted the font. */
- if (font->ftsubstitute && gid < font->widthcount)
+ if (font->ft_substitute && gid < font->width_count)
{
FT_Error fterr;
int subw;
@@ -239,17 +239,17 @@ fz_adjustftglyphwidth(fz_font *font, int gid, fz_matrix trm)
float scale;
/* TODO: use FT_Get_Advance */
- fterr = FT_Set_Char_Size(font->ftface, 1000, 1000, 72, 72);
+ fterr = FT_Set_Char_Size(font->ft_face, 1000, 1000, 72, 72);
if (fterr)
- fz_warn("freetype setting character size: %s", ft_errorstring(fterr));
+ fz_warn("freetype setting character size: %s", ft_error_string(fterr));
- fterr = FT_Load_Glyph(font->ftface, gid,
+ fterr = FT_Load_Glyph(font->ft_face, gid,
FT_LOAD_NO_HINTING | FT_LOAD_NO_BITMAP | FT_LOAD_IGNORE_TRANSFORM);
if (fterr)
- fz_warn("freetype failed to load glyph: %s", ft_errorstring(fterr));
+ fz_warn("freetype failed to load glyph: %s", ft_error_string(fterr));
- realw = ((FT_Face)font->ftface)->glyph->metrics.horiAdvance;
- subw = font->widthtable[gid];
+ realw = ((FT_Face)font->ft_face)->glyph->metrics.horiAdvance;
+ subw = font->width_table[gid];
if (realw)
scale = (float) subw / realw;
else
@@ -262,16 +262,16 @@ fz_adjustftglyphwidth(fz_font *font, int gid, fz_matrix trm)
}
fz_pixmap *
-fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
+fz_render_ft_glyph(fz_font *font, int gid, fz_matrix trm)
{
- FT_Face face = font->ftface;
+ FT_Face face = font->ft_face;
FT_Matrix m;
FT_Vector v;
FT_Error fterr;
fz_pixmap *glyph;
int y;
- trm = fz_adjustftglyphwidth(font, gid, trm);
+ trm = fz_adjust_ft_glyph_width(font, gid, trm);
/*
Freetype mutilates complex glyphs if they are loaded
@@ -290,10 +290,10 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
fterr = FT_Set_Char_Size(face, 65536, 65536, 72, 72); /* should be 64, 64 */
if (fterr)
- fz_warn("freetype setting character size: %s", ft_errorstring(fterr));
+ fz_warn("freetype setting character size: %s", ft_error_string(fterr));
FT_Set_Transform(face, &m, &v);
- if (font->fthint)
+ if (font->ft_hint)
{
/*
Enable hinting, but keep the huge char size so that
@@ -304,7 +304,7 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
*/
#ifdef GRIDFIT
/* If you really want grid fitting, enable this code. */
- float scale = fz_matrixexpansion(trm);
+ float scale = fz_matrix_expansion(trm);
m.xx = trm.a * 65536 / scale;
m.xy = trm.b * 65536 / scale;
m.yx = trm.c * 65536 / scale;
@@ -314,31 +314,31 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
fterr = FT_Set_Char_Size(face, 64 * scale, 64 * scale, 72, 72);
if (fterr)
- fz_warn("freetype setting character size: %s", ft_errorstring(fterr));
+ fz_warn("freetype setting character size: %s", ft_error_string(fterr));
FT_Set_Transform(face, &m, &v);
#endif
fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP);
if (fterr)
- fz_warn("freetype load glyph (gid %d): %s", gid, ft_errorstring(fterr));
+ fz_warn("freetype load glyph (gid %d): %s", gid, ft_error_string(fterr));
}
else
{
fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING);
if (fterr)
{
- fz_warn("freetype load glyph (gid %d): %s", gid, ft_errorstring(fterr));
- return nil;
+ fz_warn("freetype load glyph (gid %d): %s", gid, ft_error_string(fterr));
+ return NULL;
}
}
fterr = FT_Render_Glyph(face->glyph, ft_render_mode_normal);
if (fterr)
{
- fz_warn("freetype render glyph (gid %d): %s", gid, ft_errorstring(fterr));
- return nil;
+ fz_warn("freetype render glyph (gid %d): %s", gid, ft_error_string(fterr));
+ return NULL;
}
- glyph = fz_newpixmap(nil,
+ glyph = fz_new_pixmap(NULL,
face->glyph->bitmap_left,
face->glyph->bitmap_top - face->glyph->bitmap.rows,
face->glyph->bitmap.width,
@@ -355,10 +355,10 @@ fz_renderftglyph(fz_font *font, int gid, fz_matrix trm)
}
fz_pixmap *
-fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz_strokestate *state)
+fz_render_ft_stroked_glyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz_stroke_state *state)
{
- FT_Face face = font->ftface;
- float expansion = fz_matrixexpansion(ctm);
+ FT_Face face = font->ft_face;
+ float expansion = fz_matrix_expansion(ctm);
int linewidth = state->linewidth * expansion * 64 / 2;
FT_Matrix m;
FT_Vector v;
@@ -369,7 +369,7 @@ fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz
fz_pixmap *pix;
int y;
- trm = fz_adjustftglyphwidth(font, gid, trm);
+ trm = fz_adjust_ft_glyph_width(font, gid, trm);
m.xx = trm.a * 64; /* should be 65536 */
m.yx = trm.b * 64;
@@ -381,8 +381,8 @@ fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz
fterr = FT_Set_Char_Size(face, 65536, 65536, 72, 72); /* should be 64, 64 */
if (fterr)
{
- fz_warn("FT_Set_Char_Size: %s", ft_errorstring(fterr));
- return nil;
+ fz_warn("FT_Set_Char_Size: %s", ft_error_string(fterr));
+ return NULL;
}
FT_Set_Transform(face, &m, &v);
@@ -390,15 +390,15 @@ fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz
fterr = FT_Load_Glyph(face, gid, FT_LOAD_NO_BITMAP | FT_LOAD_NO_HINTING);
if (fterr)
{
- fz_warn("FT_Load_Glyph(gid %d): %s", gid, ft_errorstring(fterr));
- return nil;
+ fz_warn("FT_Load_Glyph(gid %d): %s", gid, ft_error_string(fterr));
+ return NULL;
}
fterr = FT_Stroker_New(fz_ftlib, &stroker);
if (fterr)
{
- fz_warn("FT_Stroker_New: %s", ft_errorstring(fterr));
- return nil;
+ fz_warn("FT_Stroker_New: %s", ft_error_string(fterr));
+ return NULL;
}
FT_Stroker_Set(stroker, linewidth, state->linecap, state->linejoin, state->miterlimit * 65536);
@@ -406,31 +406,31 @@ fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz
fterr = FT_Get_Glyph(face->glyph, &glyph);
if (fterr)
{
- fz_warn("FT_Get_Glyph: %s", ft_errorstring(fterr));
+ fz_warn("FT_Get_Glyph: %s", ft_error_string(fterr));
FT_Stroker_Done(stroker);
- return nil;
+ return NULL;
}
fterr = FT_Glyph_Stroke(&glyph, stroker, 1);
if (fterr)
{
- fz_warn("FT_Glyph_Stroke: %s", ft_errorstring(fterr));
+ fz_warn("FT_Glyph_Stroke: %s", ft_error_string(fterr));
FT_Done_Glyph(glyph);
FT_Stroker_Done(stroker);
- return nil;
+ return NULL;
}
fterr = FT_Glyph_To_Bitmap(&glyph, FT_RENDER_MODE_NORMAL, 0, 1);
if (fterr)
{
- fz_warn("FT_Glyph_To_Bitmap: %s", ft_errorstring(fterr));
+ fz_warn("FT_Glyph_To_Bitmap: %s", ft_error_string(fterr));
FT_Done_Glyph(glyph);
FT_Stroker_Done(stroker);
- return nil;
+ return NULL;
}
bitmap = (FT_BitmapGlyph)glyph;
- pix = fz_newpixmap(nil,
+ pix = fz_new_pixmap(NULL,
bitmap->left,
bitmap->top - bitmap->bitmap.rows,
bitmap->bitmap.width,
@@ -454,12 +454,12 @@ fz_renderftstrokedglyph(fz_font *font, int gid, fz_matrix trm, fz_matrix ctm, fz
*/
fz_font *
-fz_newtype3font(char *name, fz_matrix matrix)
+fz_new_type3_font(char *name, fz_matrix matrix)
{
fz_font *font;
int i;
- font = fz_newfont();
+ font = fz_new_font();
font->t3procs = fz_calloc(256, sizeof(fz_buffer*));
font->t3widths = fz_calloc(256, sizeof(float));
@@ -467,7 +467,7 @@ fz_newtype3font(char *name, fz_matrix matrix)
font->t3matrix = matrix;
for (i = 0; i < 256; i++)
{
- font->t3procs[i] = nil;
+ font->t3procs[i] = NULL;
font->t3widths[i] = 0;
}
@@ -475,57 +475,57 @@ fz_newtype3font(char *name, fz_matrix matrix)
}
fz_pixmap *
-fz_rendert3glyph(fz_font *font, int gid, fz_matrix trm)
+fz_render_t3_glyph(fz_font *font, int gid, fz_matrix trm)
{
fz_error error;
fz_matrix ctm;
fz_buffer *contents;
fz_bbox bbox;
fz_device *dev;
- fz_glyphcache *cache;
+ fz_glyph_cache *cache;
fz_pixmap *glyph;
fz_pixmap *result;
if (gid < 0 || gid > 255)
- return nil;
+ return NULL;
contents = font->t3procs[gid];
if (!contents)
- return nil;
+ return NULL;
ctm = fz_concat(font->t3matrix, trm);
- dev = fz_newbboxdevice(&bbox);
+ dev = fz_new_bbox_device(&bbox);
error = font->t3run(font->t3xref, font->t3resources, contents, dev, ctm);
if (error)
fz_catch(error, "cannot draw type3 glyph");
- fz_freedevice(dev);
+ fz_free_device(dev);
- glyph = fz_newpixmap(fz_devicegray, bbox.x0-1, bbox.y0-1, bbox.x1 - bbox.x0 + 1, bbox.y1 - bbox.y0 + 1);
- fz_clearpixmap(glyph);
+ glyph = fz_new_pixmap(fz_device_gray, bbox.x0-1, bbox.y0-1, bbox.x1 - bbox.x0 + 1, bbox.y1 - bbox.y0 + 1);
+ fz_clear_pixmap(glyph);
- cache = fz_newglyphcache();
- dev = fz_newdrawdevice(cache, glyph);
+ cache = fz_new_glyph_cache();
+ dev = fz_new_draw_device(cache, glyph);
error = font->t3run(font->t3xref, font->t3resources, contents, dev, ctm);
if (error)
fz_catch(error, "cannot draw type3 glyph");
- fz_freedevice(dev);
- fz_freeglyphcache(cache);
+ fz_free_device(dev);
+ fz_free_glyph_cache(cache);
- result = fz_alphafromgray(glyph, 0);
- fz_droppixmap(glyph);
+ result = fz_alpha_from_gray(glyph, 0);
+ fz_drop_pixmap(glyph);
return result;
}
void
-fz_debugfont(fz_font *font)
+fz_debug_font(fz_font *font)
{
printf("font '%s' {\n", font->name);
- if (font->ftface)
+ if (font->ft_face)
{
- printf("\tfreetype face %p\n", font->ftface);
- if (font->ftsubstitute)
+ printf("\tfreetype face %p\n", font->ft_face);
+ if (font->ft_substitute)
printf("\tsubstitute font\n");
}
diff --git a/fitz/res_path.c b/fitz/res_path.c
index b4ac415a..4959754b 100644
--- a/fitz/res_path.c
+++ b/fitz/res_path.c
@@ -1,56 +1,56 @@
#include "fitz.h"
fz_path *
-fz_newpath(void)
+fz_new_path(void)
{
fz_path *path;
path = fz_malloc(sizeof(fz_path));
path->len = 0;
path->cap = 0;
- path->els = nil;
+ path->items = NULL;
return path;
}
fz_path *
-fz_clonepath(fz_path *old)
+fz_clone_path(fz_path *old)
{
fz_path *path;
path = fz_malloc(sizeof(fz_path));
path->len = old->len;
path->cap = old->len;
- path->els = fz_calloc(path->cap, sizeof(fz_pathel));
- memcpy(path->els, old->els, sizeof(fz_pathel) * path->len);
+ path->items = fz_calloc(path->cap, sizeof(fz_path_item));
+ memcpy(path->items, old->items, sizeof(fz_path_item) * path->len);
return path;
}
void
-fz_freepath(fz_path *path)
+fz_free_path(fz_path *path)
{
- fz_free(path->els);
+ fz_free(path->items);
fz_free(path);
}
static void
-growpath(fz_path *path, int n)
+grow_path(fz_path *path, int n)
{
if (path->len + n < path->cap)
return;
while (path->len + n > path->cap)
path->cap = path->cap + 36;
- path->els = fz_realloc(path->els, path->cap, sizeof(fz_pathel));
+ path->items = fz_realloc(path->items, path->cap, sizeof(fz_path_item));
}
void
fz_moveto(fz_path *path, float x, float y)
{
- growpath(path, 3);
- path->els[path->len++].k = FZ_MOVETO;
- path->els[path->len++].v = x;
- path->els[path->len++].v = y;
+ grow_path(path, 3);
+ path->items[path->len++].k = FZ_MOVETO;
+ path->items[path->len++].v = x;
+ path->items[path->len++].v = y;
}
void
@@ -58,10 +58,10 @@ fz_lineto(fz_path *path, float x, float y)
{
if (path->len == 0)
fz_moveto(path, 0, 0);
- growpath(path, 3);
- path->els[path->len++].k = FZ_LINETO;
- path->els[path->len++].v = x;
- path->els[path->len++].v = y;
+ grow_path(path, 3);
+ path->items[path->len++].k = FZ_LINETO;
+ path->items[path->len++].v = x;
+ path->items[path->len++].v = y;
}
void
@@ -72,21 +72,21 @@ fz_curveto(fz_path *path,
{
if (path->len == 0)
fz_moveto(path, 0, 0);
- growpath(path, 7);
- path->els[path->len++].k = FZ_CURVETO;
- path->els[path->len++].v = x1;
- path->els[path->len++].v = y1;
- path->els[path->len++].v = x2;
- path->els[path->len++].v = y2;
- path->els[path->len++].v = x3;
- path->els[path->len++].v = y3;
+ grow_path(path, 7);
+ path->items[path->len++].k = FZ_CURVETO;
+ path->items[path->len++].v = x1;
+ path->items[path->len++].v = y1;
+ path->items[path->len++].v = x2;
+ path->items[path->len++].v = y2;
+ path->items[path->len++].v = x3;
+ path->items[path->len++].v = y3;
}
void
fz_curvetov(fz_path *path, float x2, float y2, float x3, float y3)
{
- float x1 = path->els[path->len-2].v;
- float y1 = path->els[path->len-1].v;
+ float x1 = path->items[path->len-2].v;
+ float y1 = path->items[path->len-1].v;
fz_curveto(path, x1, y1, x2, y2, x3, y3);
}
@@ -101,11 +101,11 @@ fz_closepath(fz_path *path)
{
if (path->len == 0)
return;
- growpath(path, 1);
- path->els[path->len++].k = FZ_CLOSEPATH;
+ grow_path(path, 1);
+ path->items[path->len++].k = FZ_CLOSE_PATH;
}
-static inline fz_rect boundexpand(fz_rect r, fz_point p)
+static inline fz_rect bound_expand(fz_rect r, fz_point p)
{
if (p.x < r.x0) r.x0 = p.x;
if (p.y < r.y0) r.y0 = p.y;
@@ -115,43 +115,43 @@ static inline fz_rect boundexpand(fz_rect r, fz_point p)
}
fz_rect
-fz_boundpath(fz_path *path, fz_strokestate *stroke, fz_matrix ctm)
+fz_bound_path(fz_path *path, fz_stroke_state *stroke, fz_matrix ctm)
{
fz_point p;
- fz_rect r = fz_emptyrect;
+ fz_rect r = fz_empty_rect;
int i = 0;
if (path->len)
{
- p.x = path->els[1].v;
- p.y = path->els[2].v;
- p = fz_transformpoint(ctm, p);
+ p.x = path->items[1].v;
+ p.y = path->items[2].v;
+ p = fz_transform_point(ctm, p);
r.x0 = r.x1 = p.x;
r.y0 = r.y1 = p.y;
}
while (i < path->len)
{
- switch (path->els[i++].k)
+ switch (path->items[i++].k)
{
case FZ_CURVETO:
- p.x = path->els[i++].v;
- p.y = path->els[i++].v;
- r = boundexpand(r, fz_transformpoint(ctm, p));
- p.x = path->els[i++].v;
- p.y = path->els[i++].v;
- r = boundexpand(r, fz_transformpoint(ctm, p));
- p.x = path->els[i++].v;
- p.y = path->els[i++].v;
- r = boundexpand(r, fz_transformpoint(ctm, p));
+ p.x = path->items[i++].v;
+ p.y = path->items[i++].v;
+ r = bound_expand(r, fz_transform_point(ctm, p));
+ p.x = path->items[i++].v;
+ p.y = path->items[i++].v;
+ r = bound_expand(r, fz_transform_point(ctm, p));
+ p.x = path->items[i++].v;
+ p.y = path->items[i++].v;
+ r = bound_expand(r, fz_transform_point(ctm, p));
break;
case FZ_MOVETO:
case FZ_LINETO:
- p.x = path->els[i++].v;
- p.y = path->els[i++].v;
- r = boundexpand(r, fz_transformpoint(ctm, p));
+ p.x = path->items[i++].v;
+ p.y = path->items[i++].v;
+ r = bound_expand(r, fz_transform_point(ctm, p));
break;
- case FZ_CLOSEPATH:
+ case FZ_CLOSE_PATH:
break;
}
}
@@ -171,43 +171,43 @@ fz_boundpath(fz_path *path, fz_strokestate *stroke, fz_matrix ctm)
}
void
-fz_transformpath(fz_path *path, fz_matrix ctm)
+fz_transform_path(fz_path *path, fz_matrix ctm)
{
fz_point p;
int k, i = 0;
while (i < path->len)
{
- switch (path->els[i++].k)
+ switch (path->items[i++].k)
{
case FZ_CURVETO:
for (k = 0; k < 3; k++)
{
- p.x = path->els[i].v;
- p.y = path->els[i+1].v;
- p = fz_transformpoint(ctm, p);
- path->els[i].v = p.x;
- path->els[i+1].v = p.y;
+ p.x = path->items[i].v;
+ p.y = path->items[i+1].v;
+ p = fz_transform_point(ctm, p);
+ path->items[i].v = p.x;
+ path->items[i+1].v = p.y;
i += 2;
}
break;
case FZ_MOVETO:
case FZ_LINETO:
- p.x = path->els[i].v;
- p.y = path->els[i+1].v;
- p = fz_transformpoint(ctm, p);
- path->els[i].v = p.x;
- path->els[i+1].v = p.y;
+ p.x = path->items[i].v;
+ p.y = path->items[i+1].v;
+ p = fz_transform_point(ctm, p);
+ path->items[i].v = p.x;
+ path->items[i+1].v = p.y;
i += 2;
break;
- case FZ_CLOSEPATH:
+ case FZ_CLOSE_PATH:
break;
}
}
}
void
-fz_debugpath(fz_path *path, int indent)
+fz_debug_path(fz_path *path, int indent)
{
float x, y;
int i = 0;
@@ -216,30 +216,30 @@ fz_debugpath(fz_path *path, int indent)
{
for (n = 0; n < indent; n++)
putchar(' ');
- switch (path->els[i++].k)
+ switch (path->items[i++].k)
{
case FZ_MOVETO:
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("%g %g m\n", x, y);
break;
case FZ_LINETO:
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("%g %g l\n", x, y);
break;
case FZ_CURVETO:
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("%g %g ", x, y);
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("%g %g ", x, y);
- x = path->els[i++].v;
- y = path->els[i++].v;
+ x = path->items[i++].v;
+ y = path->items[i++].v;
printf("%g %g c\n", x, y);
break;
- case FZ_CLOSEPATH:
+ case FZ_CLOSE_PATH:
printf("h\n");
break;
}
diff --git a/fitz/res_pixmap.c b/fitz/res_pixmap.c
index 85138be1..7e689e07 100644
--- a/fitz/res_pixmap.c
+++ b/fitz/res_pixmap.c
@@ -1,7 +1,7 @@
#include "fitz.h"
fz_pixmap *
-fz_newpixmapwithdata(fz_colorspace *colorspace, int x, int y, int w, int h, unsigned char *samples)
+fz_new_pixmap_with_data(fz_colorspace *colorspace, int x, int y, int w, int h, unsigned char *samples)
{
fz_pixmap *pix;
@@ -11,75 +11,75 @@ fz_newpixmapwithdata(fz_colorspace *colorspace, int x, int y, int w, int h, unsi
pix->y = y;
pix->w = w;
pix->h = h;
- pix->mask = nil;
+ pix->mask = NULL;
pix->interpolate = 1;
pix->xres = 96;
pix->yres = 96;
- pix->colorspace = nil;
+ pix->colorspace = NULL;
pix->n = 1;
if (colorspace)
{
- pix->colorspace = fz_keepcolorspace(colorspace);
+ pix->colorspace = fz_keep_colorspace(colorspace);
pix->n = 1 + colorspace->n;
}
if (samples)
{
pix->samples = samples;
- pix->freesamples = 0;
+ pix->free_samples = 0;
}
else
{
pix->samples = fz_calloc(pix->h, pix->w * pix->n);
- pix->freesamples = 1;
+ pix->free_samples = 1;
}
return pix;
}
fz_pixmap *
-fz_newpixmap(fz_colorspace *colorspace, int x, int y, int w, int h)
+fz_new_pixmap(fz_colorspace *colorspace, int x, int y, int w, int h)
{
- return fz_newpixmapwithdata(colorspace, x, y, w, h, nil);
+ return fz_new_pixmap_with_data(colorspace, x, y, w, h, NULL);
}
fz_pixmap *
-fz_newpixmapwithrect(fz_colorspace *colorspace, fz_bbox r)
+fz_new_pixmap_with_rect(fz_colorspace *colorspace, fz_bbox r)
{
- return fz_newpixmap(colorspace, r.x0, r.y0, r.x1 - r.x0, r.y1 - r.y0);
+ return fz_new_pixmap(colorspace, r.x0, r.y0, r.x1 - r.x0, r.y1 - r.y0);
}
fz_pixmap *
-fz_keeppixmap(fz_pixmap *pix)
+fz_keep_pixmap(fz_pixmap *pix)
{
pix->refs++;
return pix;
}
void
-fz_droppixmap(fz_pixmap *pix)
+fz_drop_pixmap(fz_pixmap *pix)
{
if (pix && --pix->refs == 0)
{
if (pix->mask)
- fz_droppixmap(pix->mask);
+ fz_drop_pixmap(pix->mask);
if (pix->colorspace)
- fz_dropcolorspace(pix->colorspace);
- if (pix->freesamples)
+ fz_drop_colorspace(pix->colorspace);
+ if (pix->free_samples)
fz_free(pix->samples);
fz_free(pix);
}
}
void
-fz_clearpixmap(fz_pixmap *pix)
+fz_clear_pixmap(fz_pixmap *pix)
{
memset(pix->samples, 0, pix->w * pix->h * pix->n);
}
void
-fz_clearpixmapwithcolor(fz_pixmap *pix, int value)
+fz_clear_pixmap_with_color(fz_pixmap *pix, int value)
{
if (value == 255)
memset(pix->samples, 255, pix->w * pix->h * pix->n);
@@ -100,7 +100,7 @@ fz_clearpixmapwithcolor(fz_pixmap *pix, int value)
}
void
-fz_premultiplypixmap(fz_pixmap *pix)
+fz_premultiply_pixmap(fz_pixmap *pix)
{
unsigned char *s = pix->samples;
unsigned char a;
@@ -119,7 +119,7 @@ fz_premultiplypixmap(fz_pixmap *pix)
}
fz_bbox
-fz_boundpixmap(fz_pixmap *pix)
+fz_bound_pixmap(fz_pixmap *pix)
{
fz_bbox bbox;
bbox.x0 = pix->x;
@@ -130,7 +130,7 @@ fz_boundpixmap(fz_pixmap *pix)
}
fz_pixmap *
-fz_alphafromgray(fz_pixmap *gray, int luminosity)
+fz_alpha_from_gray(fz_pixmap *gray, int luminosity)
{
fz_pixmap *alpha;
unsigned char *sp, *dp;
@@ -138,7 +138,7 @@ fz_alphafromgray(fz_pixmap *gray, int luminosity)
assert(gray->n == 2);
- alpha = fz_newpixmap(nil, gray->x, gray->y, gray->w, gray->h);
+ alpha = fz_new_pixmap(NULL, gray->x, gray->y, gray->w, gray->h);
dp = alpha->samples;
sp = gray->samples;
if (!luminosity)
@@ -159,7 +159,7 @@ fz_alphafromgray(fz_pixmap *gray, int luminosity)
*/
fz_error
-fz_writepnm(fz_pixmap *pixmap, char *filename)
+fz_write_pnm(fz_pixmap *pixmap, char *filename)
{
FILE *fp;
unsigned char *p;
@@ -213,7 +213,7 @@ fz_writepnm(fz_pixmap *pixmap, char *filename)
*/
fz_error
-fz_writepam(fz_pixmap *pixmap, char *filename, int savealpha)
+fz_write_pam(fz_pixmap *pixmap, char *filename, int savealpha)
{
unsigned char *sp;
int y, w, k;
@@ -289,14 +289,14 @@ static void putchunk(char *tag, unsigned char *data, int size, FILE *fp)
put32(size, fp);
fwrite(tag, 1, 4, fp);
fwrite(data, 1, size, fp);
- sum = crc32(0, nil, 0);
+ sum = crc32(0, NULL, 0);
sum = crc32(sum, (unsigned char*)tag, 4);
sum = crc32(sum, data, size);
put32(sum, fp);
}
fz_error
-fz_writepng(fz_pixmap *pixmap, char *filename, int savealpha)
+fz_write_png(fz_pixmap *pixmap, char *filename, int savealpha)
{
static const unsigned char pngsig[8] = { 137, 80, 78, 71, 13, 10, 26, 10 };
FILE *fp;
diff --git a/fitz/res_shade.c b/fitz/res_shade.c
index e4afa14a..7faff3bf 100644
--- a/fitz/res_shade.c
+++ b/fitz/res_shade.c
@@ -1,26 +1,26 @@
#include "fitz.h"
fz_shade *
-fz_keepshade(fz_shade *shade)
+fz_keep_shade(fz_shade *shade)
{
shade->refs ++;
return shade;
}
void
-fz_dropshade(fz_shade *shade)
+fz_drop_shade(fz_shade *shade)
{
if (shade && --shade->refs == 0)
{
if (shade->colorspace)
- fz_dropcolorspace(shade->colorspace);
+ fz_drop_colorspace(shade->colorspace);
fz_free(shade->mesh);
fz_free(shade);
}
}
fz_rect
-fz_boundshade(fz_shade *shade, fz_matrix ctm)
+fz_bound_shade(fz_shade *shade, fz_matrix ctm)
{
float *v;
fz_rect r;
@@ -28,22 +28,22 @@ fz_boundshade(fz_shade *shade, fz_matrix ctm)
int i, ncomp, nvert;
ctm = fz_concat(shade->matrix, ctm);
- ncomp = shade->usefunction ? 3 : 2 + shade->colorspace->n;
- nvert = shade->meshlen / ncomp;
+ ncomp = shade->use_function ? 3 : 2 + shade->colorspace->n;
+ nvert = shade->mesh_len / ncomp;
v = shade->mesh;
if (shade->type == FZ_LINEAR)
- return fz_infiniterect;
+ return fz_infinite_rect;
if (shade->type == FZ_RADIAL)
- return fz_infiniterect;
+ return fz_infinite_rect;
if (nvert == 0)
- return fz_emptyrect;
+ return fz_empty_rect;
p.x = v[0];
p.y = v[1];
v += ncomp;
- p = fz_transformpoint(ctm, p);
+ p = fz_transform_point(ctm, p);
r.x0 = r.x1 = p.x;
r.y0 = r.y1 = p.y;
@@ -51,7 +51,7 @@ fz_boundshade(fz_shade *shade, fz_matrix ctm)
{
p.x = v[0];
p.y = v[1];
- p = fz_transformpoint(ctm, p);
+ p = fz_transform_point(ctm, p);
v += ncomp;
if (p.x < r.x0) r.x0 = p.x;
if (p.y < r.y0) r.y0 = p.y;
@@ -63,7 +63,7 @@ fz_boundshade(fz_shade *shade, fz_matrix ctm)
}
void
-fz_debugshade(fz_shade *shade)
+fz_debug_shade(fz_shade *shade)
{
int i, j, n;
float *vertex;
@@ -88,7 +88,7 @@ fz_debugshade(fz_shade *shade)
shade->matrix.a, shade->matrix.b, shade->matrix.c,
shade->matrix.d, shade->matrix.e, shade->matrix.f);
- if (shade->usebackground)
+ if (shade->use_background)
{
printf("\tbackground [");
for (i = 0; i < shade->colorspace->n; i++)
@@ -96,7 +96,7 @@ fz_debugshade(fz_shade *shade)
printf("]\n");
}
- if (shade->usefunction)
+ if (shade->use_function)
{
printf("\tfunction\n");
n = 3;
@@ -104,12 +104,12 @@ fz_debugshade(fz_shade *shade)
else
n = 2 + shade->colorspace->n;
- printf("\tvertices: %d\n", shade->meshlen);
+ printf("\tvertices: %d\n", shade->mesh_len);
vertex = shade->mesh;
triangle = 0;
i = 0;
- while (i < shade->meshlen)
+ while (i < shade->mesh_len)
{
printf("\t%d:(%g, %g): ", triangle, vertex[0], vertex[1]);
diff --git a/fitz/res_text.c b/fitz/res_text.c
index 8ba62669..d38637f1 100644
--- a/fitz/res_text.c
+++ b/fitz/res_text.c
@@ -1,48 +1,48 @@
#include "fitz.h"
fz_text *
-fz_newtext(fz_font *font, fz_matrix trm, int wmode)
+fz_new_text(fz_font *font, fz_matrix trm, int wmode)
{
fz_text *text;
text = fz_malloc(sizeof(fz_text));
- text->font = fz_keepfont(font);
+ text->font = fz_keep_font(font);
text->trm = trm;
text->wmode = wmode;
text->len = 0;
text->cap = 0;
- text->els = nil;
+ text->items = NULL;
return text;
}
void
-fz_freetext(fz_text *text)
+fz_free_text(fz_text *text)
{
- fz_dropfont(text->font);
- fz_free(text->els);
+ fz_drop_font(text->font);
+ fz_free(text->items);
fz_free(text);
}
fz_text *
-fz_clonetext(fz_text *old)
+fz_clone_text(fz_text *old)
{
fz_text *text;
text = fz_malloc(sizeof(fz_text));
- text->font = fz_keepfont(old->font);
+ text->font = fz_keep_font(old->font);
text->trm = old->trm;
text->wmode = old->wmode;
text->len = old->len;
text->cap = text->len;
- text->els = fz_calloc(text->len, sizeof(fz_textel));
- memcpy(text->els, old->els, text->len * sizeof(fz_textel));
+ text->items = fz_calloc(text->len, sizeof(fz_text_item));
+ memcpy(text->items, old->items, text->len * sizeof(fz_text_item));
return text;
}
fz_rect
-fz_boundtext(fz_text *text, fz_matrix ctm)
+fz_bound_text(fz_text *text, fz_matrix ctm)
{
fz_matrix trm;
fz_rect bbox;
@@ -50,22 +50,22 @@ fz_boundtext(fz_text *text, fz_matrix ctm)
int i;
if (text->len == 0)
- return fz_emptyrect;
+ return fz_empty_rect;
/* find bbox of glyph origins in ctm space */
- bbox.x0 = bbox.x1 = text->els[0].x;
- bbox.y0 = bbox.y1 = text->els[0].y;
+ bbox.x0 = bbox.x1 = text->items[0].x;
+ bbox.y0 = bbox.y1 = text->items[0].y;
for (i = 1; i < text->len; i++)
{
- bbox.x0 = MIN(bbox.x0, text->els[i].x);
- bbox.y0 = MIN(bbox.y0, text->els[i].y);
- bbox.x1 = MAX(bbox.x1, text->els[i].x);
- bbox.y1 = MAX(bbox.y1, text->els[i].y);
+ bbox.x0 = MIN(bbox.x0, text->items[i].x);
+ bbox.y0 = MIN(bbox.y0, text->items[i].y);
+ bbox.x1 = MAX(bbox.x1, text->items[i].x);
+ bbox.y1 = MAX(bbox.y1, text->items[i].y);
}
- bbox = fz_transformrect(ctm, bbox);
+ bbox = fz_transform_rect(ctm, bbox);
/* find bbox of font in trm * ctm space */
@@ -78,7 +78,7 @@ fz_boundtext(fz_text *text, fz_matrix ctm)
fbox.x1 = text->font->bbox.x1 * 0.001f;
fbox.y1 = text->font->bbox.y1 * 0.001f;
- fbox = fz_transformrect(trm, fbox);
+ fbox = fz_transform_rect(trm, fbox);
/* expand glyph origin bbox by font bbox */
@@ -91,23 +91,23 @@ fz_boundtext(fz_text *text, fz_matrix ctm)
}
static void
-fz_growtext(fz_text *text, int n)
+fz_grow_text(fz_text *text, int n)
{
if (text->len + n < text->cap)
return;
while (text->len + n > text->cap)
text->cap = text->cap + 36;
- text->els = fz_realloc(text->els, text->cap, sizeof(fz_textel));
+ text->items = fz_realloc(text->items, text->cap, sizeof(fz_text_item));
}
void
-fz_addtext(fz_text *text, int gid, int ucs, float x, float y)
+fz_add_text(fz_text *text, int gid, int ucs, float x, float y)
{
- fz_growtext(text, 1);
- text->els[text->len].ucs = ucs;
- text->els[text->len].gid = gid;
- text->els[text->len].x = x;
- text->els[text->len].y = y;
+ fz_grow_text(text, 1);
+ text->items[text->len].ucs = ucs;
+ text->items[text->len].gid = gid;
+ text->items[text->len].x = x;
+ text->items[text->len].y = y;
text->len++;
}
@@ -116,18 +116,18 @@ static int isxmlmeta(int c)
return c < 32 || c >= 128 || c == '&' || c == '<' || c == '>' || c == '\'' || c == '"';
}
-void fz_debugtext(fz_text *text, int indent)
+void fz_debug_text(fz_text *text, int indent)
{
int i, n;
for (i = 0; i < text->len; i++)
{
for (n = 0; n < indent; n++)
putchar(' ');
- if (!isxmlmeta(text->els[i].ucs))
+ if (!isxmlmeta(text->items[i].ucs))
printf("<g ucs=\"%c\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n",
- text->els[i].ucs, text->els[i].gid, text->els[i].x, text->els[i].y);
+ text->items[i].ucs, text->items[i].gid, text->items[i].x, text->items[i].y);
else
printf("<g ucs=\"U+%04X\" gid=\"%d\" x=\"%g\" y=\"%g\" />\n",
- text->els[i].ucs, text->els[i].gid, text->els[i].x, text->els[i].y);
+ text->items[i].ucs, text->items[i].gid, text->items[i].x, text->items[i].y);
}
}
diff --git a/fitz/stm_buffer.c b/fitz/stm_buffer.c
index 9b1ee469..4c7410c3 100644
--- a/fitz/stm_buffer.c
+++ b/fitz/stm_buffer.c
@@ -1,7 +1,7 @@
#include "fitz.h"
fz_buffer *
-fz_newbuffer(int size)
+fz_new_buffer(int size)
{
fz_buffer *b;
@@ -17,14 +17,14 @@ fz_newbuffer(int size)
}
fz_buffer *
-fz_keepbuffer(fz_buffer *buf)
+fz_keep_buffer(fz_buffer *buf)
{
buf->refs ++;
return buf;
}
void
-fz_dropbuffer(fz_buffer *buf)
+fz_drop_buffer(fz_buffer *buf)
{
if (--buf->refs == 0)
{
@@ -34,7 +34,7 @@ fz_dropbuffer(fz_buffer *buf)
}
void
-fz_resizebuffer(fz_buffer *buf, int size)
+fz_resize_buffer(fz_buffer *buf, int size)
{
buf->data = fz_realloc(buf->data, size, 1);
buf->cap = size;
@@ -43,7 +43,7 @@ fz_resizebuffer(fz_buffer *buf, int size)
}
void
-fz_growbuffer(fz_buffer *buf)
+fz_grow_buffer(fz_buffer *buf)
{
- fz_resizebuffer(buf, (buf->cap * 3) / 2);
+ fz_resize_buffer(buf, (buf->cap * 3) / 2);
}
diff --git a/fitz/stm_open.c b/fitz/stm_open.c
index c7cf8409..74346f73 100644
--- a/fitz/stm_open.c
+++ b/fitz/stm_open.c
@@ -1,7 +1,7 @@
#include "fitz.h"
fz_stream *
-fz_newstream(void *state,
+fz_new_stream(void *state,
int(*read)(fz_stream *stm, unsigned char *buf, int len),
void(*close)(fz_stream *stm))
{
@@ -25,13 +25,13 @@ fz_newstream(void *state,
stm->state = state;
stm->read = read;
stm->close = close;
- stm->seek = nil;
+ stm->seek = NULL;
return stm;
}
fz_stream *
-fz_keepstream(fz_stream *stm)
+fz_keep_stream(fz_stream *stm)
{
stm->refs ++;
return stm;
@@ -51,7 +51,7 @@ fz_close(fz_stream *stm)
/* File stream */
-static int readfile(fz_stream *stm, unsigned char *buf, int len)
+static int read_file(fz_stream *stm, unsigned char *buf, int len)
{
int n = read(*(int*)stm->state, buf, len);
if (n < 0)
@@ -59,7 +59,7 @@ static int readfile(fz_stream *stm, unsigned char *buf, int len)
return n;
}
-static void seekfile(fz_stream *stm, int offset, int whence)
+static void seek_file(fz_stream *stm, int offset, int whence)
{
int n = lseek(*(int*)stm->state, offset, whence);
if (n < 0)
@@ -69,7 +69,7 @@ static void seekfile(fz_stream *stm, int offset, int whence)
stm->wp = stm->bp;
}
-static void closefile(fz_stream *stm)
+static void close_file(fz_stream *stm)
{
int n = close(*(int*)stm->state);
if (n < 0)
@@ -78,7 +78,7 @@ static void closefile(fz_stream *stm)
}
fz_stream *
-fz_openfd(int fd)
+fz_open_fd(int fd)
{
fz_stream *stm;
int *state;
@@ -86,40 +86,40 @@ fz_openfd(int fd)
state = fz_malloc(sizeof(int));
*state = fd;
- stm = fz_newstream(state, readfile, closefile);
- stm->seek = seekfile;
+ stm = fz_new_stream(state, read_file, close_file);
+ stm->seek = seek_file;
return stm;
}
fz_stream *
-fz_openfile(const char *name)
+fz_open_file(const char *name)
{
int fd = open(name, O_BINARY | O_RDONLY, 0);
if (fd == -1)
- return nil;
- return fz_openfd(fd);
+ return NULL;
+ return fz_open_fd(fd);
}
#ifdef _WIN32
fz_stream *
-fz_openfilew(const wchar_t *name)
+fz_open_file_w(const wchar_t *name)
{
int fd = _wopen(name, O_BINARY | O_RDONLY, 0);
if (fd == -1)
- return nil;
- return fz_openfd(fd);
+ return NULL;
+ return fz_open_fd(fd);
}
#endif
/* Memory stream */
-static int readbuffer(fz_stream *stm, unsigned char *buf, int len)
+static int read_buffer(fz_stream *stm, unsigned char *buf, int len)
{
return 0;
}
-static void seekbuffer(fz_stream *stm, int offset, int whence)
+static void seek_buffer(fz_stream *stm, int offset, int whence)
{
if (whence == 0)
stm->rp = stm->bp + offset;
@@ -131,19 +131,19 @@ static void seekbuffer(fz_stream *stm, int offset, int whence)
stm->wp = stm->ep;
}
-static void closebuffer(fz_stream *stm)
+static void close_buffer(fz_stream *stm)
{
if (stm->state)
- fz_dropbuffer(stm->state);
+ fz_drop_buffer(stm->state);
}
fz_stream *
-fz_openbuffer(fz_buffer *buf)
+fz_open_buffer(fz_buffer *buf)
{
fz_stream *stm;
- stm = fz_newstream(fz_keepbuffer(buf), readbuffer, closebuffer);
- stm->seek = seekbuffer;
+ stm = fz_new_stream(fz_keep_buffer(buf), read_buffer, close_buffer);
+ stm->seek = seek_buffer;
stm->bp = buf->data;
stm->rp = buf->data;
@@ -156,12 +156,12 @@ fz_openbuffer(fz_buffer *buf)
}
fz_stream *
-fz_openmemory(unsigned char *data, int len)
+fz_open_memory(unsigned char *data, int len)
{
fz_stream *stm;
- stm = fz_newstream(nil, readbuffer, closebuffer);
- stm->seek = seekbuffer;
+ stm = fz_new_stream(NULL, read_buffer, close_buffer);
+ stm->seek = seek_buffer;
stm->bp = data;
stm->rp = data;
diff --git a/fitz/stm_read.c b/fitz/stm_read.c
index 10626e5d..4a81b9cd 100644
--- a/fitz/stm_read.c
+++ b/fitz/stm_read.c
@@ -67,7 +67,7 @@ fz_read(fz_stream *stm, unsigned char *buf, int len)
}
void
-fz_fillbuffer(fz_stream *stm)
+fz_fill_buffer(fz_stream *stm)
{
int n;
@@ -95,7 +95,7 @@ fz_fillbuffer(fz_stream *stm)
}
fz_error
-fz_readall(fz_buffer **bufp, fz_stream *stm, int initial)
+fz_read_all(fz_buffer **bufp, fz_stream *stm, int initial)
{
fz_buffer *buf;
int n;
@@ -103,23 +103,23 @@ fz_readall(fz_buffer **bufp, fz_stream *stm, int initial)
if (initial < 1024)
initial = 1024;
- buf = fz_newbuffer(initial);
+ buf = fz_new_buffer(initial);
while (1)
{
if (buf->len == buf->cap)
- fz_growbuffer(buf);
+ fz_grow_buffer(buf);
if (buf->len / 200 > initial)
{
- fz_dropbuffer(buf);
+ fz_drop_buffer(buf);
return fz_throw("compression bomb detected");
}
n = fz_read(stm, buf->data + buf->len, buf->cap - buf->len);
if (n < 0)
{
- fz_dropbuffer(buf);
+ fz_drop_buffer(buf);
return fz_rethrow(n, "read error");
}
if (n == 0)
@@ -133,19 +133,19 @@ fz_readall(fz_buffer **bufp, fz_stream *stm, int initial)
}
void
-fz_readline(fz_stream *stm, char *mem, int n)
+fz_read_line(fz_stream *stm, char *mem, int n)
{
char *s = mem;
int c = EOF;
while (n > 1)
{
- c = fz_readbyte(stm);
+ c = fz_read_byte(stm);
if (c == EOF)
break;
if (c == '\r') {
- c = fz_peekbyte(stm);
+ c = fz_peek_byte(stm);
if (c == '\n')
- fz_readbyte(stm);
+ fz_read_byte(stm);
break;
}
if (c == '\n')
@@ -184,7 +184,7 @@ fz_seek(fz_stream *stm, int offset, int whence)
fz_warn("cannot seek backwards");
/* dog slow, but rare enough */
while (offset-- > 0)
- fz_readbyte(stm);
+ fz_read_byte(stm);
}
else
fz_warn("cannot seek");