X-Git-Url: http://git.openbox.org/?p=mikachu%2Fopenbox.git;a=blobdiff_plain;f=render%2Fimage.c;h=0ab213747acd4a6c105e90ce9635732b8ca96e26;hp=6b79c4547af885f8f272b4924314074d23ea9231;hb=6799c67c07e99c440f549802f60d9f16995ab711;hpb=661a53cb6843d02f3373feab91052c47397bb6ed diff --git a/render/image.c b/render/image.c index 6b79c45..0ab2137 100644 --- a/render/image.c +++ b/render/image.c @@ -124,6 +124,12 @@ static RrImagePic* ResizeImage(RrPixel32 *src, gulong ratioX, ratioY; gulong aspectW, aspectH; + /* XXX should these variables be ensured to not be zero in the callers? */ + srcW = srcW ? srcW : 1; + srcH = srcH ? srcH : 1; + dstW = dstW ? dstW : 1; + dstH = dstH ? dstH : 1; + /* keep the aspect ratio */ aspectW = dstW; aspectH = (gint)(dstW * ((gdouble)srcH / srcW)); @@ -131,11 +137,11 @@ static RrImagePic* ResizeImage(RrPixel32 *src, aspectH = dstH; aspectW = (gint)(dstH * ((gdouble)srcW / srcH)); } - dstW = aspectW; - dstH = aspectH; + dstW = aspectW ? aspectW : 1; + dstH = aspectH ? aspectH : 1; if (srcW == dstW && srcH == dstH) - return NULL; /* no scaling needed ! */ + return NULL; /* no scaling needed! */ dststart = dst = g_new(RrPixel32, dstW * dstH);