X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=libdocument%2Fev-document-misc.c;h=01676b5306c2faca791858266e9cc6e379c4bb6f;hb=9c92e571cc1a334816b2fef568c1bed1bdc0e080;hp=e710edb8644d4f63995756e774d5522d743415be;hpb=3d8180a605e8c98172e9e0e739e22b7f50ed7bad;p=evince.git diff --git a/libdocument/ev-document-misc.c b/libdocument/ev-document-misc.c index e710edb8..01676b53 100644 --- a/libdocument/ev-document-misc.c +++ b/libdocument/ev-document-misc.c @@ -140,10 +140,22 @@ ev_document_misc_paint_one_page (cairo_t *cr, gboolean highlight, gboolean inverted_colors) { - GtkStyle *style = gtk_widget_get_style (widget); - GtkStateType state = gtk_widget_get_state (widget); - - gdk_cairo_set_source_color (cr, highlight ? &style->text[state] : &style->dark[state]); + GtkStyleContext *context = gtk_widget_get_style_context (widget); + GtkStateFlags state = gtk_widget_get_state_flags (widget); + GdkRGBA fg, bg, shade_bg; + GtkSymbolicColor *c1, *c2; + + gtk_style_context_get_background_color (context, state, &bg); + gtk_style_context_get_color (context, state, &fg); + + // FIXME: should we cache the shade_bg? + c1 = gtk_symbolic_color_new_literal (&bg); + c2 = gtk_symbolic_color_new_shade (c1, 0.7); + gtk_symbolic_color_resolve (c2, NULL, &shade_bg); + gtk_symbolic_color_unref (c1); + gtk_symbolic_color_unref (c2); + + gdk_cairo_set_source_rgba (cr, highlight ? &fg : &shade_bg); gdk_cairo_rectangle (cr, area); cairo_fill (cr); @@ -158,7 +170,7 @@ ev_document_misc_paint_one_page (cairo_t *cr, area->height - (border->top + border->bottom)); cairo_fill (cr); - gdk_cairo_set_source_color (cr, &style->mid[state]); + gdk_cairo_set_source_rgba (cr, &bg); cairo_rectangle (cr, area->x, area->y + area->height - (border->bottom - border->top), @@ -180,6 +192,8 @@ ev_document_misc_surface_from_pixbuf (GdkPixbuf *pixbuf) cairo_surface_t *surface; cairo_t *cr; + g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), NULL); + surface = cairo_image_surface_create (gdk_pixbuf_get_has_alpha (pixbuf) ? CAIRO_FORMAT_ARGB32 : CAIRO_FORMAT_RGB24, gdk_pixbuf_get_width (pixbuf), @@ -195,6 +209,8 @@ ev_document_misc_surface_from_pixbuf (GdkPixbuf *pixbuf) GdkPixbuf * ev_document_misc_pixbuf_from_surface (cairo_surface_t *surface) { + g_return_val_if_fail (surface, NULL); + return gdk_pixbuf_get_from_surface (surface, 0, 0, cairo_image_surface_get_width (surface),