[Poppler-bugs] [Bug 71727] glib-demo: Add color selection for new annotations

bugzilla-daemon at freedesktop.org bugzilla-daemon at freedesktop.org
Tue Nov 19 09:08:29 PST 2013


https://bugs.freedesktop.org/show_bug.cgi?id=71727

--- Comment #2 from Carlos Garcia Campos <carlosgc at gnome.org> ---
Comment on attachment 89390
  --> https://bugs.freedesktop.org/attachment.cgi?id=89390
glib-demo: add color selection for new annotations

Review of attachment 89390:
-----------------------------------------------------------------

Pushed to git master with the modifications I suggest below. Thanks!

::: glib/demo/annots.c
@@ +67,4 @@
>      ModeType         mode;
>  
>      cairo_surface_t *surface;
> +    PopplerColor    *annot_color;

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 @@
> +    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);

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 @@
>  
>      pgd_annots_finish_add_annot (demo);
>  
> +    demo->start.x = -1;

This is unrelated to this patch.

-- 
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/20131119/b244aa27/attachment.html>


More information about the Poppler-bugs mailing list