diff options
Diffstat (limited to 'source/pdf')
-rw-r--r-- | source/pdf/pdf-annot-edit.c | 4 | ||||
-rw-r--r-- | source/pdf/pdf-appearance.c | 138 | ||||
-rw-r--r-- | source/pdf/pdf-device.c | 4 | ||||
-rw-r--r-- | source/pdf/pdf-font.c | 4 | ||||
-rw-r--r-- | source/pdf/pdf-function.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-interpret.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-op-run.c | 8 | ||||
-rw-r--r-- | source/pdf/pdf-write.c | 2 | ||||
-rw-r--r-- | source/pdf/pdf-xref.c | 4 |
9 files changed, 84 insertions, 84 deletions
diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c index 0dada7f2..e557edd4 100644 --- a/source/pdf/pdf-annot-edit.c +++ b/source/pdf/pdf-annot-edit.c @@ -3,7 +3,7 @@ #include <string.h> -#define TEXT_ANNOT_SIZE (25.0) +#define TEXT_ANNOT_SIZE (25.0f) const char * pdf_string_from_annot_type(fz_context *ctx, fz_annot_type type) @@ -95,7 +95,7 @@ pdf_create_annot(fz_context *ctx, pdf_page *page, fz_annot_type type) fz_try(ctx) { int ind_obj_num; - fz_rect rect = {0.0, 0.0, 0.0, 0.0}; + fz_rect rect = {0.0f, 0.0f, 0.0f, 0.0f}; const char *type_str; pdf_obj *annot_arr; diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index a6445d0d..fbd50434 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -12,10 +12,10 @@ #define STRIKE_HEIGHT (0.375f) #define UNDERLINE_HEIGHT (0.075f) #define LINE_THICKNESS (0.07f) -#define SMALL_FLOAT (0.00001) -#define LIST_SEL_COLOR_R (0.6) -#define LIST_SEL_COLOR_G (0.75) -#define LIST_SEL_COLOR_B (0.85) +#define SMALL_FLOAT (0.00001f) +#define LIST_SEL_COLOR_R (0.6f) +#define LIST_SEL_COLOR_G (0.75f) +#define LIST_SEL_COLOR_B (0.85f) enum { @@ -172,9 +172,9 @@ static void get_font_info(fz_context *ctx, pdf_document *doc, pdf_obj *dr, char fz_throw(ctx, FZ_ERROR_GENERIC, "No font name in default appearance"); font_rec->font = font = pdf_load_font(ctx, doc, dr, pdf_dict_gets(ctx, pdf_dict_get(ctx, dr, PDF_NAME_Font), font_rec->da_rec.font_name), 0); - font_rec->lineheight = 1.0; + font_rec->lineheight = 1.0f; if (font && font->ascent != 0.0f && font->descent != 0.0f) - font_rec->lineheight = (font->ascent - font->descent) / 1000.0; + font_rec->lineheight = (font->ascent - font->descent) / 1000.0f; } static void font_info_fin(fz_context *ctx, font_info *font_rec) @@ -306,7 +306,7 @@ static void fzbuf_print_text(fz_context *ctx, fz_buffer *fzbuf, const fz_rect *c fz_append_printf(ctx, fzbuf, fmt_W); if (col) { - fzbuf_print_color(ctx, fzbuf, col, 0, 0.0); + fzbuf_print_color(ctx, fzbuf, col, 0, 0.0f); fz_append_printf(ctx, fzbuf, fmt_f); } else @@ -424,7 +424,7 @@ static void text_splitter_init(text_splitter *splitter, font_info *info, const c splitter->unscaled_width = width; splitter->height = height; splitter->fontsize = fontsize; - splitter->scale = 1.0; + splitter->scale = 1.0f; splitter->lineheight = fontsize * info->lineheight ; /* RJW: The cast in the following line is important, as otherwise * under MSVC in the variable = 0 case, splitter->max_lines becomes @@ -482,7 +482,7 @@ static int text_splitter_layout(fz_context *ctx, text_splitter *splitter) stride = pdf_text_stride(ctx, splitter->info->font, fontsize, (unsigned char *)text, len, room, &count); /* If not a single char fits although the line is empty, then force one char */ - if (count == 0 && splitter->x == 0.0) + if (count == 0 && splitter->x == 0.0f) stride = pdf_text_stride(ctx, splitter->info->font, fontsize, (unsigned char *)text, 1, FLT_MAX, &count); if (count < len && splitter->retry) @@ -500,8 +500,8 @@ static int text_splitter_layout(fz_context *ctx, text_splitter *splitter) fitwidth *= 1.001f; /* Stretching by 10% is worth trying only if processing the first word on the line */ - hstretchwidth = splitter->x == 0.0 - ? splitter->width * 1.1 / splitter->scale + hstretchwidth = splitter->x == 0.0f + ? splitter->width * 1.1f / splitter->scale : FLT_MAX; vstretchwidth = splitter->width * (splitter->max_lines + 1) * splitter->lineheight @@ -524,7 +524,7 @@ static int text_splitter_layout(fz_context *ctx, text_splitter *splitter) /* This is not the first word on the line. Best to give up on this line and push * the word onto the next */ - if (count < len && splitter->x > 0.0) + if (count < len && splitter->x > 0.0f) return 0; splitter->text_end = splitter->text_start + count; @@ -571,7 +571,7 @@ static void fzbuf_print_text_start1(fz_context *ctx, fz_buffer *fzbuf, const fz_ fz_append_printf(ctx, fzbuf, fmt_W); if (col) { - fzbuf_print_color(ctx, fzbuf, col, 0, 0.0); + fzbuf_print_color(ctx, fzbuf, col, 0, 0.0f); fz_append_printf(ctx, fzbuf, fmt_f); } else @@ -622,12 +622,12 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con fz_rect tbox; rect = *bbox; - if (rect.x1 - rect.x0 > 3.0 && rect.y1 - rect.y0 > 3.0) + if (rect.x1 - rect.x0 > 3.0f && rect.y1 - rect.y0 > 3.0f) { - rect.x0 += 1.0; - rect.x1 -= 1.0; - rect.y0 += 1.0; - rect.y1 -= 1.0; + rect.x0 += 1.0f; + rect.x1 -= 1.0f; + rect.y0 += 1.0f; + rect.y1 -= 1.0f; } height = rect.y1 - rect.y0; @@ -643,7 +643,7 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con variable = (info->font_rec.da_rec.font_size == 0); fontsize = variable - ? (info->multiline ? 14.0 : height / info->font_rec.lineheight) + ? (info->multiline ? 14.0f : height / info->font_rec.lineheight) : info->font_rec.da_rec.font_size; info->font_rec.da_rec.font_size = fontsize; @@ -698,11 +698,11 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con fzbuf = fz_new_buffer(ctx, 0); tm.a = splitter.scale; - tm.b = 0.0; - tm.c = 0.0; + tm.b = 0.0f; + tm.c = 0.0f; tm.d = splitter.scale; tm.e = rect.x0; - tm.f = rect.y1 - (1.0+ascent-descent)*fontsize*splitter.scale/2.0; + tm.f = rect.y1 - (1.0f+ascent-descent)*fontsize*splitter.scale/2.0f; fzbuf_print_text_start1(ctx, fzbuf, &rect, info->col); fzbuf_print_text_start2(ctx, fzbuf, &info->font_rec, &tm); @@ -716,9 +716,9 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con int i, n = fz_mini((int)strlen(text), info->max_len); float comb_width = full_width/info->max_len; float char_width = pdf_text_stride(ctx, info->font_rec.font, fontsize, (unsigned char *)"M", 1, FLT_MAX, NULL); - float init_skip = (comb_width - char_width)/2.0; + float init_skip = (comb_width - char_width)/2.0f; - fz_translate(&tm, rect.x0, rect.y1 - (height+(ascent-descent)*fontsize)/2.0); + fz_translate(&tm, rect.x0, rect.y1 - (height+(ascent-descent)*fontsize)/2.0f); fzbuf = fz_new_buffer(ctx, 0); @@ -726,7 +726,7 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con fzbuf_print_text_start2(ctx, fzbuf, &info->font_rec, &tm); for (i = 0; i < n; i++) - fzbuf_print_text_word(ctx, fzbuf, i == 0 ? init_skip : comb_width, 0.0, text+i, 1); + fzbuf_print_text_word(ctx, fzbuf, i == 0 ? init_skip : comb_width, 0.0f, text+i, 1); fzbuf_print_text_end(ctx, fzbuf); } @@ -738,7 +738,7 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con } else { - fz_translate(&tm, rect.x0, rect.y1 - (height+(ascent-descent)*fontsize)/2.0); + fz_translate(&tm, rect.x0, rect.y1 - (height+(ascent-descent)*fontsize)/2.0f); switch (info->q) { @@ -1130,7 +1130,7 @@ static int get_border_style(fz_context *ctx, pdf_obj *obj) static float get_border_width(fz_context *ctx, pdf_obj *obj) { float w = pdf_to_real(ctx, pdf_dict_getl(ctx, obj, PDF_NAME_BS, PDF_NAME_W, NULL)); - return w == 0.0 ? 1.0 : w; + return w == 0.0f ? 1.0f : w; } void pdf_update_text_appearance(fz_context *ctx, pdf_document *doc, pdf_obj *obj, char *eventValue) @@ -1297,18 +1297,18 @@ void pdf_update_listbox_appearance(fz_context *ctx, pdf_document *doc, pdf_obj * } } - if (clip_rect.x1 - clip_rect.x0 > 3.0 && clip_rect.y1 - clip_rect.y0 > 3.0) + if (clip_rect.x1 - clip_rect.x0 > 3.0f && clip_rect.y1 - clip_rect.y0 > 3.0f) { - clip_rect.x0 += 1.0; - clip_rect.x1 -= 1.0; - clip_rect.y0 += 1.0; - clip_rect.y1 -= 1.0; + clip_rect.x0 += 1.0f; + clip_rect.x1 -= 1.0f; + clip_rect.y0 += 1.0f; + clip_rect.y1 -= 1.0f; } height = clip_rect.y1 - clip_rect.y0; width = clip_rect.x1 - clip_rect.x0; variable = (info.font_rec.da_rec.font_size == 0); fontsize = variable - ? (info.multiline ? 14.0 : height / info.font_rec.lineheight) + ? (info.multiline ? 14.0f : height / info.font_rec.lineheight) : info.font_rec.da_rec.font_size; /* Get the ascent, descent across the items list. */ @@ -1337,10 +1337,10 @@ void pdf_update_listbox_appearance(fz_context *ctx, pdf_document *doc, pdf_obj * /* Add the selection rects */ if (num_sel > 0) { - color[0] = (float)LIST_SEL_COLOR_R; - color[1] = (float)LIST_SEL_COLOR_G; - color[2] = (float)LIST_SEL_COLOR_B; - fill_rect.x0 = 0.0; + color[0] = LIST_SEL_COLOR_R; + color[1] = LIST_SEL_COLOR_G; + color[2] = LIST_SEL_COLOR_B; + fill_rect.x0 = 0.0f; fill_rect.x1 = width; for (i = 0; i < num_sel; i++) { @@ -1354,7 +1354,7 @@ void pdf_update_listbox_appearance(fz_context *ctx, pdf_document *doc, pdf_obj * /* And now finish with the text content */ for (i = 0; i < n; i++) { - fzbuf_print_text_word(ctx, fzbuf, 0.0, i == 0 ? 0 : -fontsize * + fzbuf_print_text_word(ctx, fzbuf, 0.0f, i == 0 ? 0 : -fontsize * lineheight, opts[i], (int)strlen(opts[i])); } fzbuf_print_text_end(ctx, fzbuf); @@ -1448,7 +1448,7 @@ void pdf_update_pushbutton_appearance(fz_context *ctx, pdf_document *doc, pdf_ob tobj = pdf_dict_getl(ctx, obj, PDF_NAME_MK, PDF_NAME_BG, NULL); if (pdf_is_array(ctx, tobj)) { - fzbuf_print_color(ctx, fzbuf, tobj, 0, 0.0); + fzbuf_print_color(ctx, fzbuf, tobj, 0, 0.0f); fz_append_printf(ctx, fzbuf, fmt_re, rect.x0, rect.y0, rect.x1, rect.y1); fz_append_printf(ctx, fzbuf, fmt_f); @@ -1461,9 +1461,9 @@ void pdf_update_pushbutton_appearance(fz_context *ctx, pdf_document *doc, pdf_ob btotal += bwidth; if (bstyle == BS_Beveled) - fz_append_printf(ctx, fzbuf, fmt_g, 1.0); + fz_append_printf(ctx, fzbuf, fmt_g, 1.0f); else - fz_append_printf(ctx, fzbuf, fmt_g, 0.33); + fz_append_printf(ctx, fzbuf, fmt_g, 0.33f); fz_append_printf(ctx, fzbuf, fmt_m, bwidth, bwidth); fz_append_printf(ctx, fzbuf, fmt_l, bwidth, rect.y1 - bwidth); fz_append_printf(ctx, fzbuf, fmt_l, rect.x1 - bwidth, rect.y1 - bwidth); @@ -1472,9 +1472,9 @@ void pdf_update_pushbutton_appearance(fz_context *ctx, pdf_document *doc, pdf_ob fz_append_printf(ctx, fzbuf, fmt_l, 2 * bwidth, 2 * bwidth); fz_append_printf(ctx, fzbuf, fmt_f); if (bstyle == BS_Beveled) - fzbuf_print_color(ctx, fzbuf, tobj, 0, -0.25); + fzbuf_print_color(ctx, fzbuf, tobj, 0, -0.25f); else - fz_append_printf(ctx, fzbuf, fmt_g, 0.66); + fz_append_printf(ctx, fzbuf, fmt_g, 0.66f); fz_append_printf(ctx, fzbuf, fmt_m, rect.x1 - bwidth, rect.y1 - bwidth); fz_append_printf(ctx, fzbuf, fmt_l, rect.x1 - bwidth, bwidth); fz_append_printf(ctx, fzbuf, fmt_l, bwidth, bwidth); @@ -1487,7 +1487,7 @@ void pdf_update_pushbutton_appearance(fz_context *ctx, pdf_document *doc, pdf_ob tobj = pdf_dict_getl(ctx, obj, PDF_NAME_MK, PDF_NAME_BC, NULL); if (tobj) { - fzbuf_print_color(ctx, fzbuf, tobj, 1, 0.0); + fzbuf_print_color(ctx, fzbuf, tobj, 1, 0.0f); fz_append_printf(ctx, fzbuf, fmt_w, bwidth); fz_append_printf(ctx, fzbuf, fmt_re, bwidth/2, bwidth/2, @@ -1539,26 +1539,26 @@ void pdf_update_text_markup_appearance(fz_context *ctx, pdf_document *doc, pdf_a switch (type) { case PDF_ANNOT_HIGHLIGHT: - color[0] = 1.0; - color[1] = 1.0; - color[2] = 0.0; - alpha = 0.5; - line_thickness = 1.0; - line_height = 0.5; + color[0] = 1.0f; + color[1] = 1.0f; + color[2] = 0.0f; + alpha = 0.5f; + line_thickness = 1.0f; + line_height = 0.5f; break; case PDF_ANNOT_UNDERLINE: - color[0] = 0.0; - color[1] = 0.0; - color[2] = 1.0; - alpha = 1.0; + color[0] = 0.0f; + color[1] = 0.0f; + color[2] = 1.0f; + alpha = 1.0f; line_thickness = LINE_THICKNESS; line_height = UNDERLINE_HEIGHT; break; case PDF_ANNOT_STRIKE_OUT: - color[0] = 1.0; - color[1] = 0.0; - color[2] = 0.0; - alpha = 1.0; + color[0] = 1.0f; + color[1] = 0.0f; + color[2] = 0.0f; + alpha = 1.0f; line_thickness = LINE_THICKNESS; line_height = STRIKE_HEIGHT; break; @@ -2054,14 +2054,14 @@ static const float outline_thickness = 15.0f; static void draw_rounded_rect(fz_context *ctx, fz_path *path) { - fz_moveto(ctx, path, 20.0, 60.0); - fz_curveto(ctx, path, 20.0, 30.0, 30.0, 20.0, 60.0, 20.0); - fz_lineto(ctx, path, 340.0, 20.0); - fz_curveto(ctx, path, 370.0, 20.0, 380.0, 30.0, 380.0, 60.0); - fz_lineto(ctx, path, 380.0, 340.0); - fz_curveto(ctx, path, 380.0, 370.0, 370.0, 380.0, 340.0, 380.0); - fz_lineto(ctx, path, 60.0, 380.0); - fz_curveto(ctx, path, 30.0, 380.0, 20.0, 370.0, 20.0, 340.0); + fz_moveto(ctx, path, 20.0f, 60.0f); + fz_curveto(ctx, path, 20.0f, 30.0f, 30.0f, 20.0f, 60.0f, 20.0f); + fz_lineto(ctx, path, 340.0f, 20.0f); + fz_curveto(ctx, path, 370.0f, 20.0f, 380.0f, 30.0f, 380.0f, 60.0f); + fz_lineto(ctx, path, 380.0f, 340.0f); + fz_curveto(ctx, path, 380.0f, 370.0f, 370.0f, 380.0f, 340.0f, 380.0f); + fz_lineto(ctx, path, 60.0f, 380.0f); + fz_curveto(ctx, path, 30.0f, 380.0f, 20.0f, 370.0f, 20.0f, 340.0f); fz_closepath(ctx, path); } @@ -2077,9 +2077,9 @@ static void draw_speech_bubble(fz_context *ctx, fz_path *path) void pdf_update_text_annot_appearance(fz_context *ctx, pdf_document *doc, pdf_annot *annot) { - static float white[3] = {1.0, 1.0, 1.0}; - static float yellow[3] = {1.0, 1.0, 0.0}; - static float black[3] = {0.0, 0.0, 0.0}; + static float white[3] = {1.0f, 1.0f, 1.0f}; + static float yellow[3] = {1.0f, 1.0f, 0.0f}; + static float black[3] = {0.0f, 0.0f, 0.0f}; fz_display_list *dlist = NULL; fz_device *dev = NULL; diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c index bbfe06d2..23fed0fd 100644 --- a/source/pdf/pdf-device.c +++ b/source/pdf/pdf-device.c @@ -1127,8 +1127,8 @@ fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, const fz_matri dev->gstates[0].colorspace[1] = fz_device_gray(ctx); dev->gstates[0].color[0][0] = 1; dev->gstates[0].color[1][0] = 1; - dev->gstates[0].alpha[0] = 1.0; - dev->gstates[0].alpha[1] = 1.0; + dev->gstates[0].alpha[0] = 1.0f; + dev->gstates[0].alpha[1] = 1.0f; dev->gstates[0].font = -1; dev->num_gstates = 1; dev->max_gstates = 1; diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c index 43390247..037372c1 100644 --- a/source/pdf/pdf-font.c +++ b/source/pdf/pdf-font.c @@ -1489,7 +1489,7 @@ float pdf_text_stride(fz_context *ctx, pdf_font_desc *fontdesc, float fontsize, { pdf_hmtx h; size_t i = 0; - float x = 0.0; + float x = 0.0f; while(i < len) { @@ -1497,7 +1497,7 @@ float pdf_text_stride(fz_context *ctx, pdf_font_desc *fontdesc, float fontsize, h = pdf_lookup_hmtx(ctx, fontdesc, buf[i]); - span = h.w * fontsize / 1000.0; + span = h.w * fontsize / 1000.0f; if (x + span > room) break; diff --git a/source/pdf/pdf-function.c b/source/pdf/pdf-function.c index 1e53291e..b0c4a6ed 100644 --- a/source/pdf/pdf-function.c +++ b/source/pdf/pdf-function.c @@ -231,7 +231,7 @@ ps_push_real(ps_stack *st, float n) { /* Push 1.0, as it's a small known value that won't * cause a divide by 0. Same reason as in fz_atof. */ - n = 1.0; + n = 1.0f; } st->stack[st->sp].u.f = fz_clamp(n, -FLT_MAX, FLT_MAX); st->sp++; diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c index ef06b312..577bd818 100644 --- a/source/pdf/pdf-interpret.c +++ b/source/pdf/pdf-interpret.c @@ -265,7 +265,7 @@ pdf_process_extgstate(fz_context *ctx, pdf_processor *proc, pdf_csi *csi, pdf_ob * a test for subtractive color spaces, but this will have * to do for now. */ if (colorspace == fz_device_cmyk(ctx)) - softmask_bc[3] = 1.0; + softmask_bc[3] = 1.0f; bc = pdf_dict_get(ctx, obj, PDF_NAME_BC); if (pdf_is_array(ctx, bc)) diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index 22721173..fddc9b91 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -462,10 +462,10 @@ pdf_show_pattern(fz_context *ctx, pdf_run_processor *pr, pdf_pattern *pat, pdf_g * this amount to be smaller than 1/256, we guarantee we won't * cause problems that will be visible even under our most * extreme antialiasing. */ - x0 = floorf(fx0 + 0.001); - y0 = floorf(fy0 + 0.001); - x1 = ceilf(fx1 - 0.001); - y1 = ceilf(fy1 - 0.001); + x0 = floorf(fx0 + 0.001f); + y0 = floorf(fy0 + 0.001f); + x1 = ceilf(fx1 - 0.001f); + y1 = ceilf(fy1 - 0.001f); /* The above adjustments cause problems for sufficiently * large values for xstep/ystep which may be used if the * pattern is expected to be rendered exactly once. */ diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c index 9a066430..1353f659 100644 --- a/source/pdf/pdf-write.c +++ b/source/pdf/pdf-write.c @@ -1158,7 +1158,7 @@ add_linearization_objs(fz_context *ctx, pdf_document *doc, pdf_write_state *opts opts->renumber_map[params_num] = params_num; opts->rev_renumber_map[params_num] = params_num; opts->gen_list[params_num] = 0; - pdf_dict_put_drop(ctx, params_obj, PDF_NAME_Linearized, pdf_new_real(ctx, doc, 1.0)); + pdf_dict_put_drop(ctx, params_obj, PDF_NAME_Linearized, pdf_new_real(ctx, doc, 1.0f)); opts->linear_l = pdf_new_int(ctx, doc, INT_MIN); pdf_dict_put(ctx, params_obj, PDF_NAME_L, opts->linear_l); opts->linear_h0 = pdf_new_int(ctx, doc, INT_MIN); diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index 2d046bbe..ba2689b9 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -594,7 +594,7 @@ pdf_load_version(fz_context *ctx, pdf_document *doc) if (memcmp(buf, "%PDF-", 5) != 0) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot recognize version marker"); - doc->version = 10 * (fz_atof(buf+5) + 0.05); + doc->version = 10 * (fz_atof(buf+5) + 0.05f); } static void @@ -1469,7 +1469,7 @@ pdf_init_document(fz_context *ctx, pdf_document *doc) version_str = pdf_to_name(ctx, obj); if (*version_str) { - int version = 10 * (fz_atof(version_str) + 0.05); + int version = 10 * (fz_atof(version_str) + 0.05f); if (version > doc->version) doc->version = version; } |