mirror of
https://gitlab.gnome.org/GNOME/evince
synced 2024-07-07 19:39:49 +00:00
backends: Use GdkRGBA instead of GdkColor in pdf
Update on internal functions that do not break the API. Signed-off-by: Qiu Wenbo <qiuwenbo@kylinos.com.cn>
This commit is contained in:
parent
a782b05b65
commit
5df2cafe10
|
@ -3074,16 +3074,17 @@ pdf_document_document_forms_iface_init (EvDocumentFormsInterface *iface)
|
|||
|
||||
/* Annotations */
|
||||
static void
|
||||
poppler_annot_color_to_gdk_color (PopplerAnnot *poppler_annot,
|
||||
GdkColor *color)
|
||||
poppler_annot_color_to_gdk_rgba (PopplerAnnot *poppler_annot,
|
||||
GdkRGBA *color)
|
||||
{
|
||||
PopplerColor *poppler_color;
|
||||
|
||||
poppler_color = poppler_annot_get_color (poppler_annot);
|
||||
if (poppler_color) {
|
||||
color->red = poppler_color->red;
|
||||
color->green = poppler_color->green;
|
||||
color->blue = poppler_color->blue;
|
||||
color->red = CLAMP ((double) poppler_color->red / 65535.0, 0.0, 1.0);
|
||||
color->green = CLAMP ((double) poppler_color->green / 65535.0, 0.0, 1.0),
|
||||
color->blue = CLAMP ((double) poppler_color->blue / 65535.0, 0.0, 1.0),
|
||||
color->alpha = 1.0;
|
||||
|
||||
g_free (poppler_color);
|
||||
} /* TODO: else use a default color */
|
||||
|
@ -3303,7 +3304,7 @@ ev_annot_from_poppler_annot (PopplerAnnot *poppler_annot,
|
|||
gchar *modified;
|
||||
gchar *contents;
|
||||
gchar *name;
|
||||
GdkColor color;
|
||||
GdkRGBA color;
|
||||
|
||||
contents = poppler_annot_get_contents (poppler_annot);
|
||||
if (contents) {
|
||||
|
@ -3325,8 +3326,8 @@ ev_annot_from_poppler_annot (PopplerAnnot *poppler_annot,
|
|||
}
|
||||
g_free (modified);
|
||||
|
||||
poppler_annot_color_to_gdk_color (poppler_annot, &color);
|
||||
ev_annotation_set_color (ev_annot, &color);
|
||||
poppler_annot_color_to_gdk_rgba (poppler_annot, &color);
|
||||
ev_annotation_set_rgba (ev_annot, &color);
|
||||
|
||||
if (poppler_annot_can_have_popup_window (poppler_annot)) {
|
||||
PopplerAnnotMarkup *markup;
|
||||
|
@ -3612,7 +3613,7 @@ pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotat
|
|||
PopplerRectangle poppler_rect;
|
||||
gdouble height;
|
||||
PopplerColor poppler_color;
|
||||
GdkColor color;
|
||||
GdkRGBA color;
|
||||
EvRectangle rect;
|
||||
|
||||
pdf_document = PDF_DOCUMENT (document_annotations);
|
||||
|
@ -3670,10 +3671,10 @@ pdf_document_annotations_add_annotation (EvDocumentAnnotations *document_annotat
|
|||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
ev_annotation_get_color (annot, &color);
|
||||
poppler_color.red = color.red;
|
||||
poppler_color.green = color.green;
|
||||
poppler_color.blue = color.blue;
|
||||
ev_annotation_get_rgba (annot, &color);
|
||||
poppler_color.red = CLAMP ((guint) (color.red * 65535), 0, 65535);
|
||||
poppler_color.green = CLAMP ((guint) (color.green * 65535), 0, 65535);
|
||||
poppler_color.blue = CLAMP ((guint) (color.blue * 65535), 0, 65535);
|
||||
poppler_annot_set_color (poppler_annot, &poppler_color);
|
||||
|
||||
if (EV_IS_ANNOTATION_MARKUP (annot)) {
|
||||
|
@ -3797,12 +3798,12 @@ pdf_document_annotations_save_annotation (EvDocumentAnnotations *document_annota
|
|||
|
||||
if (mask & EV_ANNOTATIONS_SAVE_COLOR) {
|
||||
PopplerColor color;
|
||||
GdkColor ev_color;
|
||||
GdkRGBA ev_color;
|
||||
|
||||
ev_annotation_get_color (annot, &ev_color);
|
||||
color.red = ev_color.red;
|
||||
color.green = ev_color.green;
|
||||
color.blue = ev_color.blue;
|
||||
ev_annotation_get_rgba (annot, &ev_color);
|
||||
color.red = CLAMP ((guint) (ev_color.red * 65535), 0, 65535);
|
||||
color.green = CLAMP ((guint) (ev_color.green * 65535), 0, 65535);
|
||||
color.blue = CLAMP ((guint) (ev_color.blue * 65535), 0, 65535);
|
||||
poppler_annot_set_color (poppler_annot, &color);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user