summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2016-10-07 16:48:56 +0100
committerRobin Watts <robin.watts@artifex.com>2016-10-10 15:57:46 +0100
commit8b541992e2722ceeac33e9f122e8326c79454158 (patch)
tree4a7cc38fcc09e2b545dab9e7fced31b19f139a0b
parentfa93162983d3dc72800aee3d9f195adef6148d12 (diff)
downloadmupdf-8b541992e2722ceeac33e9f122e8326c79454158.tar.xz
Use more bitfields in HTML.
Saves 12 bytes per fz_html, and we have a lot.
-rw-r--r--include/mupdf/html.h8
-rw-r--r--source/html/html-layout.c9
2 files changed, 9 insertions, 8 deletions
diff --git a/include/mupdf/html.h b/include/mupdf/html.h
index c3dd7977..a400993f 100644
--- a/include/mupdf/html.h
+++ b/include/mupdf/html.h
@@ -183,7 +183,10 @@ enum
struct fz_html_s
{
- int type;
+ unsigned int type : 2;
+ unsigned int is_first_flow : 1; /* for text-indent */
+ unsigned int markup_dir : 2;
+ unsigned int list_item : 27;
float x, y, w, h; /* content */
float padding[4];
float margin[4];
@@ -191,10 +194,7 @@ struct fz_html_s
float em;
fz_html *up, *down, *last, *next;
fz_html_flow *flow_head, **flow_tail;
- fz_bidi_direction markup_dir;
fz_css_style style;
- int list_item;
- int is_first_flow; /* for text-indent */
fz_pool *pool; /* pool allocator for this html tree (only set for root block) */
};
diff --git a/source/html/html-layout.c b/source/html/html-layout.c
index a7642981..8f257048 100644
--- a/source/html/html-layout.c
+++ b/source/html/html-layout.c
@@ -2182,8 +2182,8 @@ static void fragment_cb(const uint32_t *fragment,
}
}
-static void
-detect_flow_directionality(fz_context *ctx, fz_pool *pool, uni_buf *buffer, fz_bidi_direction *bidi_dir, fz_html_flow *flow)
+static fz_bidi_direction
+detect_flow_directionality(fz_context *ctx, fz_pool *pool, uni_buf *buffer, fz_bidi_direction bidi_dir, fz_html_flow *flow)
{
fz_html_flow *end = flow;
bidi_data data;
@@ -2249,8 +2249,9 @@ detect_flow_directionality(fz_context *ctx, fz_pool *pool, uni_buf *buffer, fz_b
data.pool = pool;
data.flow = flow;
data.buffer = buffer;
- fz_bidi_fragment_text(ctx, buffer->data, buffer->len, bidi_dir, &fragment_cb, &data, 0 /* Flags */);
+ fz_bidi_fragment_text(ctx, buffer->data, buffer->len, &bidi_dir, &fragment_cb, &data, 0 /* Flags */);
}
+ return bidi_dir;
}
static void
@@ -2259,7 +2260,7 @@ detect_box_directionality(fz_context *ctx, fz_pool *pool, uni_buf *buffer, fz_ht
while (box)
{
if (box->flow_head)
- detect_flow_directionality(ctx, pool, buffer, &box->markup_dir, box->flow_head);
+ box->markup_dir = detect_flow_directionality(ctx, pool, buffer, box->markup_dir, box->flow_head);
detect_box_directionality(ctx, pool, buffer, box->down);
box = box->next;
}