summaryrefslogtreecommitdiff
path: root/render
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@comhem.se>2008-04-23 16:41:35 +0200
committerMikael Magnusson <mikachu@comhem.se>2008-04-23 17:07:10 +0200
commit6799c67c07e99c440f549802f60d9f16995ab711 (patch)
tree096d1066947d6e8bc1278166b94b2de8b6cd684f /render
parent661a53cb6843d02f3373feab91052c47397bb6ed (diff)
parenta7bbdf7d6199d1289f5ecc1b4e25632d88d75387 (diff)
Merge branch 'backport' into work
Conflicts: openbox/config.c openbox/keyboard.c openbox/moveresize.c
Diffstat (limited to 'render')
-rw-r--r--render/image.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/render/image.c b/render/image.c
index 6b79c454..0ab21374 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);