Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Mein <mein@cs.umn.edu>2004-06-09 23:27:48 +0400
committerKent Mein <mein@cs.umn.edu>2004-06-09 23:27:48 +0400
commit57fc443fe4193563f96b244dbfdf8a2222c8ebfc (patch)
tree032ec0cdb64f6110e736087bd5df60f6f9c03950 /source/blender/imbuf
parent53e1b83f1eab487b9af88e41f4fc8cab20f87120 (diff)
Fixed part of write a bmp file, its still truncating the image slightly
however this fixes another problem. (Basically the offset wasn't being computed correctly. This is for bug: 1080 Kent
Diffstat (limited to 'source/blender/imbuf')
-rw-r--r--source/blender/imbuf/intern/bmp.c8
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;
}