[Poppler-bugs] [Bug 51487] [PATCH] Add support for TextMarkup Annotations in glib frontend
bugzilla-daemon at freedesktop.org
bugzilla-daemon at freedesktop.org
Sun Jan 19 07:28:01 PST 2014
https://bugs.freedesktop.org/show_bug.cgi?id=51487
--- Comment #44 from Carlos Garcia Campos <carlosgc at gnome.org> ---
Comment on attachment 91431
--> https://bugs.freedesktop.org/attachment.cgi?id=91431
glib-demo using poppler_page_get_text_layout_for_area()
Review of attachment 91431:
-----------------------------------------------------------------
I've pushed this one as well, adapted to the API changes introduced in previous
commit and with some other minor modifications, see below.
::: glib/demo/annots.c
@@ +890,4 @@
> rect.x2 = demo->stop.x;
> rect.y2 = height - demo->stop.y;
>
> + quads_array = g_array_sized_new (FALSE, FALSE,
We should create this only when creating text markup annots.
@@ +900,5 @@
> + quad.p2.y = rect.y1;
> + quad.p3.x = rect.x1;
> + quad.p3.y = rect.y2;
> + quad.p4.x = rect.x2;
> + quad.p4.y = rect.y2;
This could be moved to a helper function, since it's also used when updating
the quads.
@@ +902,5 @@
> + quad.p3.y = rect.y2;
> + quad.p4.x = rect.x2;
> + quad.p4.y = rect.y2;
> +
> + g_array_append_val (quads_array, quad);
We can avoid the memory moves in this case too.
@@ +992,5 @@
> + if (! poppler_page_get_text_layout_for_area (demo->page, &doc_area,
> + &rects, &n_rects))
> + return;
> +
> + r = g_new0 (PopplerRectangle, 1);
We can use g_slice here.
@@ +1004,5 @@
> + the same line */
> + if (ABS(r->y2 - rects[i].y2) > 0.0001) {
> + if (i > 0)
> + l_rects = g_list_append (l_rects, r);
> + r = g_new0 (PopplerRectangle, 1);
Ditto.
@@ +1037,5 @@
> + quadrilateral.p3.y = height - r->y2;
> + quadrilateral.p4.x = r->x2;
> + quadrilateral.p4.y = height - r->y2;
> +
> + g_array_append_val (quads_array, quadrilateral);
We can also avoid the memory copies here.
@@ +1038,5 @@
> + quadrilateral.p4.x = r->x2;
> + quadrilateral.p4.y = height - r->y2;
> +
> + g_array_append_val (quads_array, quadrilateral);
> + }
Since we are iterating the list, we can free the rectangles, so that we don't
need to iterate it again to free the contents in g_list_free_full
--
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/poppler-bugs/attachments/20140119/d7b3709e/attachment.html>
More information about the Poppler-bugs
mailing list