<html>
<head>
<base href="https://bugs.freedesktop.org/" />
</head>
<body>
<p>
<div>
<b><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - glib-demo: Add color selection for new annotations"
href="https://bugs.freedesktop.org/show_bug.cgi?id=71727#c2">Comment # 2</a>
on <a class="bz_bug_link
bz_status_NEW "
title="NEW --- - glib-demo: Add color selection for new annotations"
href="https://bugs.freedesktop.org/show_bug.cgi?id=71727">bug 71727</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=89390" name="attach_89390" title="glib-demo: add color selection for new annotations">attachment 89390</a> <a href="attachment.cgi?id=89390&action=edit" title="glib-demo: add color selection for new annotations">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=71727&attachment=89390'>[review]</a>
glib-demo: add color selection for new annotations
Review of <span class=""><a href="attachment.cgi?id=89390" name="attach_89390" title="glib-demo: add color selection for new annotations">attachment 89390</a> <a href="attachment.cgi?id=89390&action=edit" title="glib-demo: add color selection for new annotations">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=71727&attachment=89390'>[review]</a>:
-----------------------------------------------------------------
Pushed to git master with the modifications I suggest below. Thanks!
::: glib/demo/annots.c
@@ +67,4 @@
<span class="quote">> ModeType mode;
>
> cairo_surface_t *surface;
> + PopplerColor *annot_color;</span >
This is allocated when the widget is created and deallocated when it's
destroyed, so I think it could be stack allocated instead.
@@ +451,5 @@
<span class="quote">> + gtk_color_button_get_rgba (GTK_COLOR_BUTTON (button), &color);
> +#endif
> + demo->annot_color->red = CLAMP ((guint) (color.red * 65535), 0, 65535);
> + demo->annot_color->green = CLAMP ((guint) (color.green * 65535), 0, 65535);
> + demo->annot_color->blue = CLAMP ((guint) (color.blue * 65535), 0, 65535);</span >
Instead of doing this conversion every time the color changes in the selector,
we could keep a GdkRGBA in the demo struct and convert it to a PopplerColor
right before calling poppler_annot_set_color. I think it will simplify the code
in general.
@@ +981,4 @@
<span class="quote">>
> pgd_annots_finish_add_annot (demo);
>
> + demo->start.x = -1;</span >
This is unrelated to this patch.</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>