/* keep the ratio */
dw = area->width;
- dh = (int)(dw * ((double)sh / sw));
+ dh = (gint)(dw * ((gdouble)sh / sw));
if (dh > area->height) {
dh = area->height;
- dw = (int)(dh * ((double)sw / sh));
+ dw = (gint)(dh * ((gdouble)sw / sh));
}
+ if (!(dw && dh))
+ return; /* XXX sanity check */
+
if (sw != dw || sh != dh) {
/*if (!(rgba->cache && dw == rgba->cwidth && dh == rgba->cheight))*/ {
g_free(rgba->cache);
dest++;
source++;
- if (col++ >= dw) {
+ if (++col >= dw) {
col = 0;
dest += target_w - dw;
}