diff options
Diffstat (limited to 'source/blender/imbuf/intern/bmp.c')
-rw-r--r-- | source/blender/imbuf/intern/bmp.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index cb8a1e22711..7f7e30923b7 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -206,9 +206,8 @@ short imb_savebmp(struct ImBuf *ibuf, int outfile, int flags) { uchar *data; FILE *ofile; - extrabytes = (4 - ibuf->x % 4) % 4; -printf("extrabytes = %d\n",extrabytes); - bytesize = (ibuf->x + extrabytes) * ibuf->y; + extrabytes = (4 - ibuf->x*3 % 4) % 4; + bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y; data = (uchar *) ibuf->rect; ofile = fdopen(outfile,"ab"); @@ -225,7 +224,7 @@ printf("extrabytes = %d\n",extrabytes); putShortLSB(1,ofile); putShortLSB(24,ofile); putIntLSB(0,ofile); - putIntLSB(bytesize,ofile); + putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile); putIntLSB(0,ofile); putIntLSB(0,ofile); putIntLSB(0,ofile); @@ -244,6 +243,5 @@ printf("extrabytes = %d\n",extrabytes); /* add padding here */ for (t=0;t<extrabytes;t++) if (putc(0,ofile) == EOF) return 0; } -printf("x = %d y = %d\n",x,y); return 1; } |