From 26ce9ee5d7f2c90014a7576aeb6fdda83d5429b9 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Thu, 27 Dec 2007 10:33:20 +0100 Subject: [PATCH] it's not width but height which defines ratio --- draw.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/draw.c b/draw.c index ea15ea87..cfb6e496 100644 --- a/draw.c +++ b/draw.c @@ -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); }