From fa93162983d3dc72800aee3d9f195adef6148d12 Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Fri, 7 Oct 2016 16:37:16 +0100 Subject: Change HTML agent to use bitfields rather than chars. Saves 8 bytes on every css_style (and we have a lot of those). --- source/html/css-apply.c | 8 ++++---- source/html/html-layout.c | 12 ++++++------ 2 files changed, 10 insertions(+), 10 deletions(-) (limited to 'source') diff --git a/source/html/css-apply.c b/source/html/css-apply.c index 62b06288..af2a3a45 100644 --- a/source/html/css-apply.c +++ b/source/html/css-apply.c @@ -1269,10 +1269,10 @@ fz_apply_css_style(fz_context *ctx, fz_html_font_set *set, fz_css_style *style, style->color = color_from_property(match, "color", black); style->background_color = color_from_property(match, "background-color", transparent); - style->border_style[0] = border_style_from_property(match, "border-top-style"); - style->border_style[1] = border_style_from_property(match, "border-right-style"); - style->border_style[2] = border_style_from_property(match, "border-bottom-style"); - style->border_style[3] = border_style_from_property(match, "border-left-style"); + style->border_style_0 = border_style_from_property(match, "border-top-style"); + style->border_style_1 = border_style_from_property(match, "border-right-style"); + style->border_style_2 = border_style_from_property(match, "border-bottom-style"); + style->border_style_3 = border_style_from_property(match, "border-left-style"); style->border_color[0] = color_from_property(match, "border-top-color", style->color); style->border_color[1] = color_from_property(match, "border-right-color", style->color); diff --git a/source/html/html-layout.c b/source/html/html-layout.c index df119b1a..a7642981 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -1338,10 +1338,10 @@ static float layout_block(fz_context *ctx, fz_html *box, fz_html *top, float pag padding[2] = fz_from_css_number(style->padding[2], em, top->w); padding[3] = fz_from_css_number(style->padding[3], em, top->w); - border[0] = style->border_style[0] ? fz_from_css_number(style->border_width[0], em, top->w) : 0; - border[1] = style->border_style[1] ? fz_from_css_number(style->border_width[1], em, top->w) : 0; - border[2] = style->border_style[2] ? fz_from_css_number(style->border_width[2], em, top->w) : 0; - border[3] = style->border_style[3] ? fz_from_css_number(style->border_width[3], em, top->w) : 0; + border[0] = style->border_style_0 ? fz_from_css_number(style->border_width[0], em, top->w) : 0; + border[1] = style->border_style_1 ? fz_from_css_number(style->border_width[1], em, top->w) : 0; + border[2] = style->border_style_2 ? fz_from_css_number(style->border_width[2], em, top->w) : 0; + border[3] = style->border_style_3 ? fz_from_css_number(style->border_width[3], em, top->w) : 0; /* TODO: remove 'vertical' margin adjustments across automatic page breaks */ @@ -2008,8 +2008,8 @@ fz_print_css_style(fz_context *ctx, fz_css_style *style, int boxtype, int n) printf("%g%c ", style->border_width[2].value, style->border_width[2].unit); printf("%g%c\n", style->border_width[3].value, style->border_width[3].unit); indent(n); printf("border_style %d %d %d %d\n", - style->border_style[0], style->border_style[1], - style->border_style[2], style->border_style[3]); + style->border_style_0, style->border_style_1, + style->border_style_2, style->border_style_3); indent(n); printf("text_indent %g%c\n", style->text_indent.value, style->text_indent.unit); indent(n); printf("white_space %d\n", style->white_space); indent(n); printf("text_align %d\n", style->text_align); -- cgit v1.2.3