[sapwood] restrict the scope of mask_cr
- From: Sven Herzberg <herzi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sapwood] restrict the scope of mask_cr
- Date: Fri, 13 Aug 2010 11:41:06 +0000 (UTC)
commit 1bef2578f6c8f733df6ffc5a4f18efe8c59bbde2
Author: Sven Herzberg <herzi gnome-de org>
Date: Fri Aug 13 12:09:18 2010 +0200
restrict the scope of mask_cr
* engine/sapwood-pixmap.c: only use mask_cr in the code block of the
mask creation
engine/sapwood-pixmap.c | 12 +++++-------
1 files changed, 5 insertions(+), 7 deletions(-)
---
diff --git a/engine/sapwood-pixmap.c b/engine/sapwood-pixmap.c
index 10c741b..c616727 100644
--- a/engine/sapwood-pixmap.c
+++ b/engine/sapwood-pixmap.c
@@ -475,7 +475,6 @@ sapwood_pixmap_render_rects (SapwoodPixmap* self,
cairo_surface_t* tmp;
gboolean need_tmp_mask = FALSE;
GdkPixmap * tmp_mask = NULL;
- cairo_t * mask_cr = NULL;
cairo_t * tmp_cr;
cairo_t * cr;
gint n;
@@ -517,15 +516,16 @@ sapwood_pixmap_render_rects (SapwoodPixmap* self,
{
tmp_mask = gdk_pixmap_new (draw, tmp_width, tmp_height, 1);
- mask_cr = gdk_cairo_create (tmp_mask);
+ cairo_t* mask_cr = gdk_cairo_create (tmp_mask);
cairo_set_operator (mask_cr, CAIRO_OPERATOR_CLEAR);
cairo_paint (mask_cr);
mask_surface = cairo_surface_reference (cairo_get_target (mask_cr));
+ cairo_destroy (mask_cr);
}
tmp_cr = cairo_create (tmp);
- sapwood_pixmap_render_rects_internal (self, tmp_cr, 0, 0, mask_cr ? cairo_get_target (mask_cr) : NULL, 0, 0, mask_required, NULL, n_rect, rect);
+ sapwood_pixmap_render_rects_internal (self, tmp_cr, 0, 0, mask_surface, 0, 0, mask_required, NULL, n_rect, rect);
/* finally, render downscaled at draw_x,draw_y */
if (clip_rect)
@@ -567,8 +567,8 @@ sapwood_pixmap_render_rects (SapwoodPixmap* self,
}
cairo_set_source_surface (cr, cairo_get_target (tmp_cr), 0, 0);
- if (mask_cr)
- cairo_mask_surface (cr, cairo_get_target (mask_cr), 0, 0);
+ if (mask_surface)
+ cairo_mask_surface (cr, mask_surface, 0, 0);
else
cairo_paint (cr);
@@ -578,8 +578,6 @@ sapwood_pixmap_render_rects (SapwoodPixmap* self,
{
cairo_surface_destroy (mask_surface);
}
- if (mask_cr)
- cairo_destroy (mask_cr);
if (tmp_mask)
g_object_unref (tmp_mask);
cairo_destroy (tmp_cr);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]