From 48652e529ed1c0ae23cfd45f14d9655ad2849c89 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 13 Mar 2012 13:57:11 +0100 Subject: Rename some functions and accessors to be more consistent. Debug printing functions: debug -> print. Accessors: get noun attribute -> noun attribute. Find -> lookup when the returned value is not reference counted. pixmap_with_rect -> pixmap_with_bbox. We are reserving the word "find" to mean lookups that give ownership of objects to the caller. Lookup is used in other places where the ownership is not transferred, or simple values are returned. The rename is done by the sed script in scripts/rename3.sed --- draw/draw_blend.c | 2 +- draw/draw_device.c | 58 +++++++++++++++++++++++++++--------------------------- draw/draw_edge.c | 34 ++++++++++++++++---------------- draw/draw_glyph.c | 2 +- draw/draw_mesh.c | 4 ++-- 5 files changed, 50 insertions(+), 50 deletions(-) (limited to 'draw') diff --git a/draw/draw_blend.c b/draw/draw_blend.c index 3e81568f..904de768 100644 --- a/draw/draw_blend.c +++ b/draw/draw_blend.c @@ -24,7 +24,7 @@ static const char *fz_blendmode_names[] = "Luminosity", }; -int fz_find_blendmode(char *name) +int fz_lookup_blendmode(char *name) { int i; for (i = 0; i < nelem(fz_blendmode_names); i++) diff --git a/draw/draw_device.c b/draw/draw_device.c index e2c22db1..ec4e2df5 100644 --- a/draw/draw_device.c +++ b/draw/draw_device.c @@ -123,7 +123,7 @@ fz_knockout_begin(fz_draw_device *dev) bbox = fz_bound_pixmap(state->dest); bbox = fz_intersect_bbox(bbox, state->scissor); - dest = fz_new_pixmap_with_rect(dev->ctx, state->dest->colorspace, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, state->dest->colorspace, bbox); if (isolated) { @@ -154,7 +154,7 @@ fz_knockout_begin(fz_draw_device *dev) } else { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } #ifdef DUMP_GROUP_BLENDS @@ -354,13 +354,13 @@ fz_draw_clip_path(fz_device *devp, fz_path *path, fz_rect *rect, int even_odd, f return; } - state[1].mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].mask); - state[1].dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + state[1].dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, state[1].dest); if (state[1].shape) { - state[1].shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].shape); } @@ -399,13 +399,13 @@ fz_draw_clip_stroke_path(fz_device *devp, fz_path *path, fz_rect *rect, fz_strok if (rect) bbox = fz_intersect_bbox(bbox, fz_round_rect(*rect)); - state[1].mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].mask); - state[1].dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + state[1].dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, state[1].dest); if (state->shape) { - state[1].shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].shape); } @@ -600,13 +600,13 @@ fz_draw_clip_text(fz_device *devp, fz_text *text, fz_matrix ctm, int accumulate) if (accumulate == 0 || accumulate == 1) { - mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, mask); - dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, dest); if (state->shape) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } else @@ -673,13 +673,13 @@ fz_draw_clip_stroke_text(fz_device *devp, fz_text *text, fz_stroke_state *stroke bbox = fz_round_rect(fz_bound_text(dev->ctx, text, ctm)); bbox = fz_intersect_bbox(bbox, state->scissor); - mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, mask); - dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, dest); if (state->shape) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } else @@ -762,11 +762,11 @@ fz_draw_fill_shade(fz_device *devp, fz_shade *shade, fz_matrix ctm, float alpha) if (alpha < 1) { - dest = fz_new_pixmap_with_rect(dev->ctx, state->dest->colorspace, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, state->dest->colorspace, bbox); fz_clear_pixmap(dev->ctx, dest); if (shape) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } } @@ -926,7 +926,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, fz_matrix ctm, float alpha) if (pixmap->colorspace != model && !after) { - converted = fz_new_pixmap_with_rect(ctx, model, fz_bound_pixmap(pixmap)); + converted = fz_new_pixmap_with_bbox(ctx, model, fz_bound_pixmap(pixmap)); fz_convert_pixmap(ctx, converted, pixmap); pixmap = converted; } @@ -956,7 +956,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, fz_matrix ctm, float alpha) } else { - converted = fz_new_pixmap_with_rect(ctx, model, fz_bound_pixmap(pixmap)); + converted = fz_new_pixmap_with_bbox(ctx, model, fz_bound_pixmap(pixmap)); fz_convert_pixmap(ctx, converted, pixmap); pixmap = converted; } @@ -1099,14 +1099,14 @@ fz_draw_clip_image_mask(fz_device *devp, fz_image *image, fz_rect *rect, fz_matr fz_try(ctx) { - mask = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + mask = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, mask); - dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(dev->ctx, dest); if (state->shape) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } @@ -1211,12 +1211,12 @@ fz_draw_begin_mask(fz_device *devp, fz_rect rect, int luminosity, fz_colorspace bbox = fz_round_rect(rect); bbox = fz_intersect_bbox(bbox, state->scissor); - dest = fz_new_pixmap_with_rect(dev->ctx, fz_device_gray, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, fz_device_gray, bbox); if (state->shape) { /* FIXME: If we ever want to support AIS true, then we * probably want to create a shape pixmap here, using: - * shape = fz_new_pixmap_with_rect(NULL, bbox); + * shape = fz_new_pixmap_with_bbox(NULL, bbox); * then, in the end_mask code, we create the mask from this * rather than dest. */ @@ -1285,7 +1285,7 @@ fz_draw_end_mask(fz_device *devp) /* create new dest scratch buffer */ bbox = fz_bound_pixmap(temp); - dest = fz_new_pixmap_with_rect(dev->ctx, state->dest->colorspace, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, state->dest->colorspace, bbox); fz_clear_pixmap(dev->ctx, dest); /* push soft mask as clip mask */ @@ -1296,7 +1296,7 @@ fz_draw_end_mask(fz_device *devp) * clip mask when we pop. So create a new shape now. */ if (state[0].shape) { - state[1].shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + state[1].shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, state[1].shape); } state[1].scissor = bbox; @@ -1318,7 +1318,7 @@ fz_draw_begin_group(fz_device *devp, fz_rect rect, int isolated, int knockout, i state = push_stack(dev); bbox = fz_round_rect(rect); bbox = fz_intersect_bbox(bbox, state->scissor); - dest = fz_new_pixmap_with_rect(ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(ctx, model, bbox); #ifndef ATTEMPT_KNOCKOUT_AND_ISOLATED knockout = 0; @@ -1344,7 +1344,7 @@ fz_draw_begin_group(fz_device *devp, fz_rect rect, int isolated, int knockout, i { fz_try(ctx) { - shape = fz_new_pixmap_with_rect(ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(ctx, NULL, bbox); fz_clear_pixmap(dev->ctx, shape); } fz_catch(ctx) @@ -1451,7 +1451,7 @@ fz_draw_begin_tile(fz_device *devp, fz_rect area, fz_rect view, float xstep, flo * assert(bbox.x0 > state->dest->x || bbox.x1 < state->dest->x + state->dest->w || * bbox.y0 > state->dest->y || bbox.y1 < state->dest->y + state->dest->h); */ - dest = fz_new_pixmap_with_rect(dev->ctx, model, bbox); + dest = fz_new_pixmap_with_bbox(dev->ctx, model, bbox); fz_clear_pixmap(ctx, dest); shape = state[0].shape; if (shape) @@ -1459,7 +1459,7 @@ fz_draw_begin_tile(fz_device *devp, fz_rect area, fz_rect view, float xstep, flo fz_var(shape); fz_try(ctx) { - shape = fz_new_pixmap_with_rect(dev->ctx, NULL, bbox); + shape = fz_new_pixmap_with_bbox(dev->ctx, NULL, bbox); fz_clear_pixmap(ctx, shape); } fz_catch(ctx) diff --git a/draw/draw_edge.c b/draw/draw_edge.c index ad7a413c..12ba72fc 100644 --- a/draw/draw_edge.c +++ b/draw/draw_edge.c @@ -20,7 +20,7 @@ struct fz_aa_context_s int hscale; int vscale; int scale; - int level; + int bits; }; void fz_new_aa_context(fz_context *ctx) @@ -30,12 +30,12 @@ void fz_new_aa_context(fz_context *ctx) ctx->aa->hscale = 17; ctx->aa->vscale = 15; ctx->aa->scale = 256; - ctx->aa->level = 8; + ctx->aa->bits = 8; #define fz_aa_hscale ((ctxaa)->hscale) #define fz_aa_vscale ((ctxaa)->vscale) #define fz_aa_scale ((ctxaa)->scale) -#define fz_aa_level ((ctxaa)->level) +#define fz_aa_bits ((ctxaa)->bits) #define AA_SCALE(x) ((x * fz_aa_scale) >> 8) #endif @@ -61,40 +61,40 @@ void fz_free_aa_context(fz_context *ctx) #define AA_SCALE(x) (x) #define fz_aa_hscale 17 #define fz_aa_vscale 15 -#define fz_aa_level 8 +#define fz_aa_bits 8 #elif AA_BITS > 4 #define AA_SCALE(x) ((x * 255) >> 6) #define fz_aa_hscale 8 #define fz_aa_vscale 8 -#define fz_aa_level 6 +#define fz_aa_bits 6 #elif AA_BITS > 2 #define AA_SCALE(x) (x * 17) #define fz_aa_hscale 5 #define fz_aa_vscale 3 -#define fz_aa_level 4 +#define fz_aa_bits 4 #elif AA_BITS > 0 #define AA_SCALE(x) ((x * 255) >> 2) #define fz_aa_hscale 2 #define fz_aa_vscale 2 -#define fz_aa_level 2 +#define fz_aa_bits 2 #else #define AA_SCALE(x) (x * 255) #define fz_aa_hscale 1 #define fz_aa_vscale 1 -#define fz_aa_level 0 +#define fz_aa_bits 0 #endif #endif int -fz_get_aa_level(fz_context *ctx) +fz_aa_level(fz_context *ctx) { fz_aa_context *ctxaa = ctx->aa; - return fz_aa_level; + return fz_aa_bits; } void @@ -102,37 +102,37 @@ fz_set_aa_level(fz_context *ctx, int level) { fz_aa_context *ctxaa = ctx->aa; #ifdef AA_BITS - fz_warn(ctx, "anti-aliasing was compiled with a fixed precision of %d bits", fz_aa_level); + fz_warn(ctx, "anti-aliasing was compiled with a fixed precision of %d bits", fz_aa_bits); #else if (level > 6) { fz_aa_hscale = 17; fz_aa_vscale = 15; - fz_aa_level = 8; + fz_aa_bits = 8; } else if (level > 4) { fz_aa_hscale = 8; fz_aa_vscale = 8; - fz_aa_level = 6; + fz_aa_bits = 6; } else if (level > 2) { fz_aa_hscale = 5; fz_aa_vscale = 3; - fz_aa_level = 4; + fz_aa_bits = 4; } else if (level > 0) { fz_aa_hscale = 2; fz_aa_vscale = 2; - fz_aa_level = 2; + fz_aa_bits = 2; } else { fz_aa_hscale = 1; fz_aa_vscale = 1; - fz_aa_level = 0; + fz_aa_bits = 0; } fz_aa_scale = 0xFF00 / (fz_aa_hscale * fz_aa_vscale); #endif @@ -798,7 +798,7 @@ fz_scan_convert(fz_gel *gel, int eofill, fz_bbox clip, { fz_aa_context *ctxaa = gel->ctx->aa; - if (fz_aa_level > 0) + if (fz_aa_bits > 0) fz_scan_convert_aa(gel, eofill, clip, dst, color); else fz_scan_convert_sharp(gel, eofill, clip, dst, color); diff --git a/draw/draw_glyph.c b/draw/draw_glyph.c index 0761b8a9..cef9d7fa 100644 --- a/draw/draw_glyph.c +++ b/draw/draw_glyph.c @@ -129,7 +129,7 @@ fz_render_glyph(fz_context *ctx, fz_font *font, int gid, fz_matrix ctm, fz_color key.d = ctm.d * 65536; key.e = (ctm.e - floorf(ctm.e)) * 256; key.f = (ctm.f - floorf(ctm.f)) * 256; - key.aa = fz_get_aa_level(ctx); + key.aa = fz_aa_level(ctx); fz_lock(ctx, FZ_LOCK_GLYPHCACHE); val = fz_hash_find(ctx, cache->hash, &key); diff --git a/draw/draw_mesh.c b/draw/draw_mesh.c index 1d6f1759..7579ad60 100644 --- a/draw/draw_mesh.c +++ b/draw/draw_mesh.c @@ -544,8 +544,8 @@ fz_paint_shade(fz_context *ctx, fz_shade *shade, fz_matrix ctm, fz_pixmap *dest, clut[i][k] = color[k] * 255; clut[i][k] = shade->function[i][shade->colorspace->n] * 255; } - conv = fz_new_pixmap_with_rect(ctx, dest->colorspace, bbox); - temp = fz_new_pixmap_with_rect(ctx, fz_device_gray, bbox); + conv = fz_new_pixmap_with_bbox(ctx, dest->colorspace, bbox); + temp = fz_new_pixmap_with_bbox(ctx, fz_device_gray, bbox); fz_clear_pixmap(ctx, temp); } else -- cgit v1.2.3