projects
/
dana
/
openbox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
0e92465
)
When icons had a very small aspect ratio, we crashed, don't.
author
Mikael Magnusson
<mikachu@comhem.se>
Fri, 28 Mar 2008 20:01:46 +0000
(21:01 +0100)
committer
Mikael Magnusson
<mikachu@comhem.se>
Tue, 15 Apr 2008 15:59:22 +0000
(17:59 +0200)
render/image.c
patch
|
blob
|
history
diff --git
a/render/image.c
b/render/image.c
index
be3e46b
..
9648643
100644
(file)
--- a/
render/image.c
+++ b/
render/image.c
@@
-124,6
+124,12
@@
static RrImagePic* ResizeImage(RrPixel32 *src,
gulong ratioX, ratioY;
gulong aspectW, aspectH;
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));
/* 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));
}
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)
if (srcW == dstW && srcH == dstH)
- return NULL; /* no scaling needed
! */
+ return NULL; /* no scaling needed! */
dststart = dst = g_new(RrPixel32, dstW * dstH);
dststart = dst = g_new(RrPixel32, dstW * dstH);