diff options
author | Owen Taylor <otaylor@redhat.com> | 2002-01-29 22:46:21 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2002-01-29 22:46:21 +0000 |
commit | ccb90778612b30b145ca635b91f85e17fd60f3fc (patch) | |
tree | f387c4876a9909b43303da5ced3110a32c6433a4 /gdk | |
parent | d3b83098ad34e80dbde2851e23a972903eb18227 (diff) | |
download | gdk-pixbuf-ccb90778612b30b145ca635b91f85e17fd60f3fc.tar.gz |
Call _gdk_draw_pixbuf(), thus enabling using this function for pixbufs
Tue Jan 29 17:40:02 2002 Owen Taylor <otaylor@redhat.com>
* gdk/gdkpixbuf-render.c (gdk_pixbuf_render_to_drawable):
Call _gdk_draw_pixbuf(), thus enabling using this function
for pixbufs with alpha. (#68801)
* gdk/gdkdraw.c (gdk_drawable_real_draw_pixbuf): Move
implementation of gdk_pixbuf_render_to_drawable()
to here.
Diffstat (limited to 'gdk')
-rw-r--r-- | gdk/gdkdraw.c | 39 | ||||
-rw-r--r-- | gdk/gdkpixbuf-render.c | 34 |
2 files changed, 27 insertions, 46 deletions
diff --git a/gdk/gdkdraw.c b/gdk/gdkdraw.c index cc1299e37..9778c879d 100644 --- a/gdk/gdkdraw.c +++ b/gdk/gdkdraw.c @@ -1289,23 +1289,32 @@ gdk_drawable_real_draw_pixbuf (GdkDrawable *drawable, if (composited) { - gdk_pixbuf_render_to_drawable (composited, - drawable, gc, - 0, 0, - dest_x, dest_y, - width, height, - dither, - x_dither, y_dither); + src_x = 0; + src_y = 0; + pixbuf = composited; } - else + + if (pixbuf->n_channels == 4) + { + guchar *buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 4; + + gdk_draw_rgb_32_image_dithalign (drawable, gc, + dest_x, dest_y, + width, height, + dither, + buf, pixbuf->rowstride, + x_dither, y_dither); + } + else /* n_channels == 3 */ { - gdk_pixbuf_render_to_drawable (pixbuf, - drawable, gc, - src_x, src_y, - dest_x, dest_y, - width, height, - dither, - x_dither, y_dither); + guchar *buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 3; + + gdk_draw_rgb_image_dithalign (drawable, gc, + dest_x, dest_y, + width, height, + dither, + buf, pixbuf->rowstride, + x_dither, y_dither); } out: diff --git a/gdk/gdkpixbuf-render.c b/gdk/gdkpixbuf-render.c index fdbbbb76e..4361c75be 100644 --- a/gdk/gdkpixbuf-render.c +++ b/gdk/gdkpixbuf-render.c @@ -174,16 +174,12 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf, GdkRgbDither dither, int x_dither, int y_dither) { - int rowstride; - guchar *buf; - g_return_if_fail (GDK_IS_PIXBUF (pixbuf)); g_return_if_fail (pixbuf->colorspace == GDK_COLORSPACE_RGB); g_return_if_fail (pixbuf->n_channels == 3 || pixbuf->n_channels == 4); g_return_if_fail (pixbuf->bits_per_sample == 8); g_return_if_fail (drawable != NULL); - g_return_if_fail (gc != NULL); if (width == -1) width = pixbuf->width; @@ -197,33 +193,9 @@ gdk_pixbuf_render_to_drawable (GdkPixbuf *pixbuf, if (width == 0 || height == 0) return; - /* This will have to be modified once we support other image types. - */ - - if (pixbuf->n_channels == 4) - { - buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 4; - rowstride = pixbuf->rowstride; - - gdk_draw_rgb_32_image_dithalign (drawable, gc, - dest_x, dest_y, - width, height, - dither, - buf, rowstride, - x_dither, y_dither); - } - else /* n_channels == 3 */ - { - buf = pixbuf->pixels + src_y * pixbuf->rowstride + src_x * 3; - rowstride = pixbuf->rowstride; - - gdk_draw_rgb_image_dithalign (drawable, gc, - dest_x, dest_y, - width, height, - dither, - buf, rowstride, - x_dither, y_dither); - } + _gdk_draw_pixbuf (drawable, gc, pixbuf, + src_x, src_y, dest_x, dest_y, width, height, + dither, x_dither, y_dither); } |