aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2010-10-05 00:05:27 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-10-30 01:50:02 +0800
commit791b5f68a12ac0444080cf2ef2f335ce1dd73075 (patch)
tree64237622f423ae6576c3c686374b1695026380bc /widgets
parenta21ae31d94a2e7a90a884cdf6ec5b8d14fc89b35 (diff)
downloadgsoc2013-evolution-791b5f68a12ac0444080cf2ef2f335ce1dd73075.tar
gsoc2013-evolution-791b5f68a12ac0444080cf2ef2f335ce1dd73075.tar.gz
gsoc2013-evolution-791b5f68a12ac0444080cf2ef2f335ce1dd73075.tar.bz2
gsoc2013-evolution-791b5f68a12ac0444080cf2ef2f335ce1dd73075.tar.lz
gsoc2013-evolution-791b5f68a12ac0444080cf2ef2f335ce1dd73075.tar.xz
gsoc2013-evolution-791b5f68a12ac0444080cf2ef2f335ce1dd73075.tar.zst
gsoc2013-evolution-791b5f68a12ac0444080cf2ef2f335ce1dd73075.zip
e-map: Draw with cairo
Diffstat (limited to 'widgets')
-rw-r--r--widgets/misc/e-map.c49
1 files changed, 11 insertions, 38 deletions
diff --git a/widgets/misc/e-map.c b/widgets/misc/e-map.c
index 523dc0c970..83c7b953b3 100644
--- a/widgets/misc/e-map.c
+++ b/widgets/misc/e-map.c
@@ -359,7 +359,7 @@ e_map_expose (GtkWidget *widget, GdkEventExpose *event)
{
EMap *view;
EMapPrivate *priv;
- gint width, height;
+ cairo_t *cr;
if (!gtk_widget_is_drawable (widget))
return FALSE;
@@ -368,45 +368,18 @@ e_map_expose (GtkWidget *widget, GdkEventExpose *event)
priv = view->priv;
if (!priv->map_render_pixbuf) return FALSE;
- width = MIN (event->area.width, E_MAP_GET_WIDTH (view));
- height = MIN (event->area.height, E_MAP_GET_HEIGHT (view));
-
- /* This satisfies paranoia. To be removed */
-
- if (priv->xofs + width > gdk_pixbuf_get_width (priv->map_render_pixbuf))
- width = gdk_pixbuf_get_width (priv->map_render_pixbuf) - priv->xofs;
+ cr = gdk_cairo_create (event->window);
+ gdk_cairo_region (cr, event->region);
+ cairo_clip (cr);
- if (priv->yofs + height > gdk_pixbuf_get_height (priv->map_render_pixbuf))
- height = gdk_pixbuf_get_height (priv->map_render_pixbuf) - priv->yofs;
+ gdk_cairo_set_source_pixbuf (cr,
+ priv->map_render_pixbuf,
+ - priv->xofs,
+ - priv->yofs);
+ cairo_paint (cr);
+
+ cairo_destroy (cr);
- /* We rely on the fast case always being the case, since we load and
- * preprocess the source pixbuf ourselves */
-
- if (gdk_pixbuf_get_colorspace (priv->map_render_pixbuf) == GDK_COLORSPACE_RGB && !gdk_pixbuf_get_has_alpha (priv->map_render_pixbuf) &&
- gdk_pixbuf_get_bits_per_sample (priv->map_render_pixbuf) == 8)
- {
- GtkStyle *style;
- GdkWindow *window;
- guchar *pixels;
- gint rowstride;
-
- style = gtk_widget_get_style (GTK_WIDGET (view));
- window = gtk_widget_get_window (GTK_WIDGET (view));
-
- rowstride = gdk_pixbuf_get_rowstride (priv->map_render_pixbuf);
- pixels = gdk_pixbuf_get_pixels (priv->map_render_pixbuf) +
- (event->area.y + priv->yofs) * rowstride + 3 *
- (event->area.x + priv->xofs);
- gdk_draw_rgb_image_dithalign (
- window, style->black_gc, event->area.x, event->area.y,
- width, height, GDK_RGB_DITHER_NORMAL, pixels,
- rowstride, 0, 0);
- return FALSE;
- }
-
-#ifdef DEBUG
- g_print ("Doing hard redraw.\n");
-#endif
return FALSE;
}