summaryrefslogtreecommitdiff
path: root/ext/gd/libgd/gd_gd2.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/gd/libgd/gd_gd2.c')
-rw-r--r--ext/gd/libgd/gd_gd2.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/ext/gd/libgd/gd_gd2.c b/ext/gd/libgd/gd_gd2.c
index e954aafa68..3b4dfbe098 100644
--- a/ext/gd/libgd/gd_gd2.c
+++ b/ext/gd/libgd/gd_gd2.c
@@ -689,8 +689,8 @@ static void _gdImageGd2 (gdImagePtr im, gdIOCtx * out, int cs, int fmt)
}
/* Work out number of chunks. */
- ncx = im->sx / cs + 1;
- ncy = im->sy / cs + 1;
+ ncx = (im->sx + cs - 1) / cs;
+ ncy = (im->sy + cs - 1) / cs;
/* Write the standard header. */
_gd2PutHeader (im, out, cs, fmt, ncx, ncy);