diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/engines/pixbuf/pixbuf-draw.c | 16 | ||||
-rw-r--r-- | modules/engines/pixbuf/pixbuf-render.c | 54 | ||||
-rw-r--r-- | modules/engines/pixbuf/pixbuf.h | 10 |
3 files changed, 47 insertions, 33 deletions
diff --git a/modules/engines/pixbuf/pixbuf-draw.c b/modules/engines/pixbuf/pixbuf-draw.c index f80a4d757a..6c940ae409 100644 --- a/modules/engines/pixbuf/pixbuf-draw.c +++ b/modules/engines/pixbuf/pixbuf-draw.c @@ -130,7 +130,7 @@ draw_simple_image(GtkStyle *style, { if (image->background) { - theme_pixbuf_render (image->background, + theme_pixbuf_render_no_cairo (image->background, window, area, draw_center ? COMPONENT_ALL : COMPONENT_ALL | COMPONENT_CENTER, FALSE, @@ -138,7 +138,7 @@ draw_simple_image(GtkStyle *style, } if (image->overlay && draw_center) - theme_pixbuf_render (image->overlay, + theme_pixbuf_render_no_cairo (image->overlay, window, area, COMPONENT_ALL, TRUE, x, y, width, height); @@ -299,19 +299,19 @@ draw_gap_image(GtkStyle *style, } if (image->background) - theme_pixbuf_render (image->background, + theme_pixbuf_render_no_cairo (image->background, window, area, components, FALSE, x, y, width, height); if (image->gap_start) - theme_pixbuf_render (image->gap_start, + theme_pixbuf_render_no_cairo (image->gap_start, window, area, COMPONENT_ALL, FALSE, r1.x, r1.y, r1.width, r1.height); if (image->gap) - theme_pixbuf_render (image->gap, + theme_pixbuf_render_no_cairo (image->gap, window, area, COMPONENT_ALL, FALSE, r2.x, r2.y, r2.width, r2.height); if (image->gap_end) - theme_pixbuf_render (image->gap_end, + theme_pixbuf_render_no_cairo (image->gap_end, window, area, COMPONENT_ALL, FALSE, r3.x, r3.y, r3.width, r3.height); @@ -348,7 +348,7 @@ draw_hline (GtkStyle *style, if (image) { if (image->background) - theme_pixbuf_render (image->background, + theme_pixbuf_render_no_cairo (image->background, window, area, COMPONENT_ALL, FALSE, x1, y, (x2 - x1) + 1, 2); } @@ -384,7 +384,7 @@ draw_vline (GtkStyle *style, if (image) { if (image->background) - theme_pixbuf_render (image->background, + theme_pixbuf_render_no_cairo (image->background, window, area, COMPONENT_ALL, FALSE, x, y1, 2, (y2 - y1) + 1); } diff --git a/modules/engines/pixbuf/pixbuf-render.c b/modules/engines/pixbuf/pixbuf-render.c index ce25cfbb78..30e3fadad1 100644 --- a/modules/engines/pixbuf/pixbuf-render.c +++ b/modules/engines/pixbuf/pixbuf-render.c @@ -352,8 +352,7 @@ replicate_cols (GdkPixbuf *src, static void pixbuf_render (GdkPixbuf *src, guint hints, - GdkWindow *window, - GdkRectangle *clip_rect, + cairo_t *cr, gint src_x, gint src_y, gint src_width, @@ -381,12 +380,6 @@ pixbuf_render (GdkPixbuf *src, if (hints & THEME_MISSING) return; - if (clip_rect) - { - if (!gdk_rectangle_intersect (clip_rect, &rect, &rect)) - return; - } - if (dest_width == src_width && dest_height == src_height) { tmp_pixbuf = g_object_ref (src); @@ -471,9 +464,6 @@ pixbuf_render (GdkPixbuf *src, if (tmp_pixbuf) { - cairo_t *cr; - - cr = gdk_cairo_create (window); gdk_cairo_set_source_pixbuf (cr, tmp_pixbuf, -x_offset + rect.x, @@ -481,7 +471,6 @@ pixbuf_render (GdkPixbuf *src, gdk_cairo_rectangle (cr, &rect); cairo_fill (cr); - cairo_destroy (cr); g_object_unref (tmp_pixbuf); } } @@ -727,9 +716,33 @@ theme_pixbuf_get_pixbuf (ThemePixbuf *theme_pb) } void +theme_pixbuf_render_no_cairo (ThemePixbuf *theme_pb, + GdkWindow *window, + GdkRectangle *clip_rect, + guint component_mask, + gboolean center, + gint x, + gint y, + gint width, + gint height) +{ + cairo_t *cr; + + cr = gdk_cairo_create (window); + if (clip_rect) + { + gdk_cairo_rectangle (cr, clip_rect); + cairo_clip (cr); + } + + theme_pixbuf_render (theme_pb, cr, + component_mask, center, + x, y, width, height); +} + +void theme_pixbuf_render (ThemePixbuf *theme_pb, - GdkWindow *window, - GdkRectangle *clip_rect, + cairo_t *cr, guint component_mask, gboolean center, gint x, @@ -785,7 +798,7 @@ theme_pixbuf_render (ThemePixbuf *theme_pb, #define RENDER_COMPONENT(X1,X2,Y1,Y2) \ - pixbuf_render (pixbuf, theme_pb->hints[Y1][X1], window, clip_rect, \ + pixbuf_render (pixbuf, theme_pb->hints[Y1][X1], cr, \ src_x[X1], src_y[Y1], \ src_x[X2] - src_x[X1], src_y[Y2] - src_y[Y1], \ dest_x[X1], dest_y[Y1], \ @@ -825,7 +838,7 @@ theme_pixbuf_render (ThemePixbuf *theme_pb, x += (width - pixbuf_width) / 2; y += (height - pixbuf_height) / 2; - pixbuf_render (pixbuf, 0, window, clip_rect, + pixbuf_render (pixbuf, 0, cr, 0, 0, pixbuf_width, pixbuf_height, x, y, @@ -833,19 +846,12 @@ theme_pixbuf_render (ThemePixbuf *theme_pb, } else { - cairo_t *cr = gdk_cairo_create (window); - gdk_cairo_set_source_pixbuf (cr, pixbuf, 0, 0); cairo_pattern_set_extend (cairo_get_source (cr), CAIRO_EXTEND_REPEAT); - if (clip_rect) - gdk_cairo_rectangle (cr, clip_rect); - else - cairo_rectangle (cr, x, y, width, height); + cairo_rectangle (cr, x, y, width, height); cairo_fill (cr); - - cairo_destroy (cr); } } } diff --git a/modules/engines/pixbuf/pixbuf.h b/modules/engines/pixbuf/pixbuf.h index 2354d76cc3..9c9c38c5d4 100644 --- a/modules/engines/pixbuf/pixbuf.h +++ b/modules/engines/pixbuf/pixbuf.h @@ -200,7 +200,7 @@ G_GNUC_INTERNAL void theme_pixbuf_set_border (ThemePixbuf *theme_pb, gint bottom); G_GNUC_INTERNAL void theme_pixbuf_set_stretch (ThemePixbuf *theme_pb, gboolean stretch); -G_GNUC_INTERNAL void theme_pixbuf_render (ThemePixbuf *theme_pb, +G_GNUC_INTERNAL void theme_pixbuf_render_no_cairo (ThemePixbuf *theme_pb, GdkWindow *window, GdkRectangle *clip_rect, guint component_mask, @@ -209,6 +209,14 @@ G_GNUC_INTERNAL void theme_pixbuf_render (ThemePixbuf *theme_pb, gint dest_y, gint dest_width, gint dest_height); +G_GNUC_INTERNAL void theme_pixbuf_render (ThemePixbuf *theme_pb, + cairo_t *cr, + guint component_mask, + gboolean center, + gint dest_x, + gint dest_y, + gint dest_width, + gint dest_height); |