miniexp_t end)
{
if (page->bounding_box || p == start) {
- EvRectangle *new_rectangle = g_new (EvRectangle, 1);
+ EvRectangle *new_rectangle = ev_rectangle_new ();
new_rectangle->x1 = miniexp_to_int (miniexp_nth (1, p));
new_rectangle->y1 = miniexp_to_int (miniexp_nth (2, p));
new_rectangle->x2 = miniexp_to_int (miniexp_nth (3, p));
GList *matches, *l;
PopplerPage *poppler_page;
gdouble height;
-
+ GList *retval = NULL;
+
g_return_val_if_fail (POPPLER_IS_PAGE (page->backend_page), NULL);
g_return_val_if_fail (text != NULL, NULL);
poppler_page_get_size (poppler_page, NULL, &height);
for (l = matches; l && l->data; l = g_list_next (l)) {
PopplerRectangle *rect = (PopplerRectangle *)l->data;
- gdouble tmp;
+ EvRectangle *ev_rect;
+
+ ev_rect = ev_rectangle_new ();
+ ev_rect->x1 = rect->x1;
+ ev_rect->x2 = rect->x2;
+ /* Invert this for X-style coordinates */
+ ev_rect->y1 = height - rect->y2;
+ ev_rect->y2 = height - rect->y1;
- tmp = rect->y1;
- rect->y1 = height - rect->y2;
- rect->y2 = height - tmp;
+ retval = g_list_prepend (retval, ev_rect);
}
-
- return matches;
+
+ g_list_foreach (matches, (GFunc)poppler_rectangle_free, NULL);
+ g_list_free (matches);
+
+ return g_list_reverse (retval);
}
static void
gint i;
for (i = 0; i < job->n_pages; i++) {
- g_list_foreach (job->pages[i], (GFunc)g_free, NULL);
+ g_list_foreach (job->pages[i], (GFunc)ev_rectangle_free, NULL);
g_list_free (job->pages[i]);
}