summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2017-08-21 16:10:41 +0200
committerTor Andersson <tor.andersson@artifex.com>2017-08-21 17:20:10 +0200
commit5947bedcbf684907b003b7088a59f091ca04326a (patch)
tree19621595dcf5539a414f8a31b7842a6924608c94
parente552f404a7c521bbfe32fb1be1d44ad0ba92c014 (diff)
downloadmupdf-5947bedcbf684907b003b7088a59f091ca04326a.tar.xz
Remove redundant fz_stext_char_bbox function.
-rw-r--r--platform/x11/pdfapp.c4
-rw-r--r--source/fitz/stext-device.c7
-rw-r--r--source/fitz/stext-output.c4
-rw-r--r--source/fitz/stext-search.c17
-rw-r--r--source/fitz/util.c4
5 files changed, 10 insertions, 26 deletions
diff --git a/platform/x11/pdfapp.c b/platform/x11/pdfapp.c
index 6b08c4aa..4dc5652c 100644
--- a/platform/x11/pdfapp.c
+++ b/platform/x11/pdfapp.c
@@ -1896,7 +1896,6 @@ void pdfapp_onmouse(pdfapp_t *app, int x, int y, int btn, int modifiers, int sta
void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
{
- fz_rect hitbox;
fz_matrix ctm;
fz_stext_page *page = app->page_text;
int p, need_newline;
@@ -1925,10 +1924,9 @@ void pdfapp_oncopy(pdfapp_t *app, unsigned short *ucsbuf, int ucslen)
for (ch = line->first_char; ch; ch = ch->next)
{
int c = ch->c;
- fz_stext_char_bbox(app->ctx, &hitbox, line, ch);
if (c < 32)
c = 0xFFFD;
- if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1)
+ if (ch->bbox.x1 >= x0 && ch->bbox.x0 <= x1 && ch->bbox.y1 >= y0 && ch->bbox.y0 <= y1)
{
saw_text = 1;
if (need_newline)
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c
index d4d502b1..2d8a0b29 100644
--- a/source/fitz/stext-device.c
+++ b/source/fitz/stext-device.c
@@ -34,13 +34,6 @@ const char *fz_stext_options_usage =
"\tpreserve-images: keep images in output\n"
"\n";
-fz_rect *
-fz_stext_char_bbox(fz_context *ctx, fz_rect *bbox, fz_stext_line *line, fz_stext_char *ch)
-{
- *bbox = ch->bbox;
- return bbox;
-}
-
fz_stext_page *
fz_new_stext_page(fz_context *ctx, const fz_rect *mediabox)
{
diff --git a/source/fitz/stext-output.c b/source/fitz/stext-output.c
index 0fe6be4f..63cd3c17 100644
--- a/source/fitz/stext-output.c
+++ b/source/fitz/stext-output.c
@@ -349,7 +349,6 @@ fz_print_stext_page_as_xml(fz_context *ctx, fz_output *out, fz_stext_page *page)
fz_font *font = NULL;
float size = 0;
const char *name = NULL;
- fz_rect rect;
fz_write_printf(ctx, out, "<line bbox=\"%g %g %g %g\" wmode=\"%d\" dir=\"%g %g\">\n",
line->bbox.x0, line->bbox.y0, line->bbox.x1, line->bbox.y1,
@@ -367,9 +366,8 @@ fz_print_stext_page_as_xml(fz_context *ctx, fz_output *out, fz_stext_page *page)
name = font_full_name(ctx, font);
fz_write_printf(ctx, out, "<font name=\"%s\" size=\"%g\">\n", name, size);
}
- fz_stext_char_bbox(ctx, &rect, line, ch);
fz_write_printf(ctx, out, "<char bbox=\"%g %g %g %g\" x=\"%g\" y=\"%g\" c=\"",
- rect.x0, rect.y0, rect.x1, rect.y1, ch->origin.x, ch->origin.y);
+ ch->bbox.x0, ch->bbox.y0, ch->bbox.x1, ch->bbox.y1, ch->origin.x, ch->origin.y);
switch (ch->c)
{
case '<': fz_write_string(ctx, out, "&lt;"); break;
diff --git a/source/fitz/stext-search.c b/source/fitz/stext-search.c
index 79071684..4bf2882a 100644
--- a/source/fitz/stext-search.c
+++ b/source/fitz/stext-search.c
@@ -34,7 +34,7 @@ fz_char_and_box *fz_stext_char_at(fz_context *ctx, fz_char_and_box *cab, fz_stex
if (ofs == idx)
{
cab->c = ch->c;
- fz_stext_char_bbox(ctx, &cab->bbox, line, ch);
+ cab->bbox = ch->bbox;
return cab;
}
++ofs;
@@ -172,7 +172,7 @@ fz_search_stext_page(fz_context *ctx, fz_stext_page *text, const char *needle, f
int
fz_highlight_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect, fz_rect *hit_bbox, int hit_max)
{
- fz_rect linebox, charbox;
+ fz_rect linebox;
fz_stext_block *block;
fz_stext_line *line;
fz_stext_char *ch;
@@ -194,18 +194,17 @@ fz_highlight_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect, fz_re
linebox = fz_empty_rect;
for (ch = line->first_char; ch; ch = ch->next)
{
- fz_stext_char_bbox(ctx, &charbox, line, ch);
- if (charbox.x1 >= x0 && charbox.x0 <= x1 && charbox.y1 >= y0 && charbox.y0 <= y1)
+ if (ch->bbox.x1 >= x0 && ch->bbox.x0 <= x1 && ch->bbox.y1 >= y0 && ch->bbox.y0 <= y1)
{
- if (charbox.y0 != linebox.y0 || fz_abs(charbox.x0 - linebox.x1) > 5)
+ if (ch->bbox.y0 != linebox.y0 || fz_abs(ch->bbox.x0 - linebox.x1) > 5)
{
if (!fz_is_empty_rect(&linebox) && hit_count < hit_max)
hit_bbox[hit_count++] = linebox;
- linebox = charbox;
+ linebox = ch->bbox;
}
else
{
- fz_union_rect(&linebox, &charbox);
+ fz_union_rect(&linebox, &ch->bbox);
}
}
}
@@ -221,7 +220,6 @@ char *
fz_copy_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect)
{
fz_buffer *buffer;
- fz_rect hitbox;
int c, seen = 0;
unsigned char *s;
fz_stext_block *block;
@@ -250,11 +248,10 @@ fz_copy_selection(fz_context *ctx, fz_stext_page *page, fz_rect rect)
for (ch = line->first_char; ch; ch = ch->next)
{
- fz_stext_char_bbox(ctx, &hitbox, line, ch);
c = ch->c;
if (c < 32)
c = FZ_REPLACEMENT_CHARACTER;
- if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1)
+ if (ch->bbox.x1 >= x0 && ch->bbox.x0 <= x1 && ch->bbox.y1 >= y0 && ch->bbox.y0 <= y1)
{
fz_append_rune(ctx, buffer, c);
seen = 1;
diff --git a/source/fitz/util.c b/source/fitz/util.c
index d22c6a7b..5d75aaad 100644
--- a/source/fitz/util.c
+++ b/source/fitz/util.c
@@ -394,7 +394,6 @@ fz_buffer *
fz_new_buffer_from_stext_page(fz_context *ctx, fz_stext_page *page, const fz_rect *sel, int crlf)
{
fz_buffer *buf;
- fz_rect hitbox;
float x0, y0, x1, y1;
fz_stext_block *block;
fz_stext_line *line;
@@ -430,10 +429,9 @@ fz_new_buffer_from_stext_page(fz_context *ctx, fz_stext_page *page, const fz_rec
for (ch = line->first_char; ch; ch = ch->next)
{
int c = ch->c;
- fz_stext_char_bbox(ctx, &hitbox, line, ch);
if (c < 32)
c = FZ_REPLACEMENT_CHARACTER;
- if (hitbox.x1 >= x0 && hitbox.x0 <= x1 && hitbox.y1 >= y0 && hitbox.y0 <= y1)
+ if (ch->bbox.x1 >= x0 && ch->bbox.x0 <= x1 && ch->bbox.y1 >= y0 && ch->bbox.y0 <= y1)
{
saw_text = 1;
if (need_newline)