<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [PATCH] Add support for TextMarkup Annotations in glib frontend"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=51487#c44">Comment # 44</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - [PATCH] Add support for TextMarkup Annotations in glib frontend"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=51487">bug 51487</a>
              from <span class="vcard"><a class="email" href="mailto:carlosgc@gnome.org" title="Carlos Garcia Campos <carlosgc@gnome.org>"> <span class="fn">Carlos Garcia Campos</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=91431" name="attach_91431" title="glib-demo using poppler_page_get_text_layout_for_area()">attachment 91431</a> <a href="attachment.cgi?id=91431&action=edit" title="glib-demo using poppler_page_get_text_layout_for_area()">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=51487&attachment=91431'>[review]</a>
glib-demo using poppler_page_get_text_layout_for_area()

Review of <span class=""><a href="attachment.cgi?id=91431" name="attach_91431" title="glib-demo using poppler_page_get_text_layout_for_area()">attachment 91431</a> <a href="attachment.cgi?id=91431&action=edit" title="glib-demo using poppler_page_get_text_layout_for_area()">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=51487&attachment=91431'>[review]</a>:
-----------------------------------------------------------------

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 @@
<span class="quote">>      rect.x2 = demo->stop.x;
>      rect.y2 = height - demo->stop.y;
>  
> +    quads_array = g_array_sized_new (FALSE, FALSE,</span >

We should create this only when creating text markup annots.

@@ +900,5 @@
<span class="quote">> +    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;</span >

This could be moved to a helper function, since it's also used when updating
the quads.

@@ +902,5 @@
<span class="quote">> +    quad.p3.y = rect.y2;
> +    quad.p4.x = rect.x2;
> +    quad.p4.y = rect.y2;
> +
> +    g_array_append_val (quads_array, quad);</span >

We can avoid the memory moves in this case too.

@@ +992,5 @@
<span class="quote">> +    if (! poppler_page_get_text_layout_for_area (demo->page, &doc_area,
> +                                                 &rects, &n_rects))
> +        return;
> +
> +    r = g_new0 (PopplerRectangle, 1);</span >

We can use g_slice here.

@@ +1004,5 @@
<span class="quote">> +           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);</span >

Ditto.

@@ +1037,5 @@
<span class="quote">> +        quadrilateral.p3.y = height - r->y2;
> +        quadrilateral.p4.x = r->x2;
> +        quadrilateral.p4.y = height - r->y2;
> +
> +        g_array_append_val (quads_array, quadrilateral);</span >

We can also avoid the memory copies here.

@@ +1038,5 @@
<span class="quote">> +        quadrilateral.p4.x = r->x2;
> +        quadrilateral.p4.y = height - r->y2;
> +
> +        g_array_append_val (quads_array, quadrilateral);
> +    }</span >

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</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>