it's not width but height which defines ratio

This commit is contained in:
Julien Danjou 2007-12-27 10:33:20 +01:00
parent 7be6a97972
commit 26ce9ee5d7
1 changed files with 3 additions and 3 deletions

6
draw.c
View File

@ -150,7 +150,7 @@ draw_circle(DrawCtx *ctx, int x, int y, int r, Bool filled, XColor color)
}
void draw_image_from_argb_data(DrawCtx *ctx, int x, int y, int w, int h,
int wanted_w, unsigned char *data)
int wanted_h, unsigned char *data)
{
double ratio;
cairo_surface_t *surface, *source;
@ -159,9 +159,9 @@ void draw_image_from_argb_data(DrawCtx *ctx, int x, int y, int w, int h,
surface = cairo_xlib_surface_create(ctx->display, ctx->drawable, ctx->visual, ctx->width, ctx->height);
source = cairo_image_surface_create_for_data(data, CAIRO_FORMAT_ARGB32, w, h, 0);
cr = cairo_create (surface);
if(wanted_w > 0 && w > 0)
if(wanted_h > 0 && h > 0)
{
ratio = (double) wanted_w / (double) w;
ratio = (double) wanted_h / (double) h;
cairo_scale(cr, ratio, ratio);
cairo_set_source_surface(cr, source, x / ratio, y / ratio);
}