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>2005-01-03 22:53:04 +0300
committerKent Mein <mein@cs.umn.edu>2005-01-03 22:53:04 +0300
commit3bbc65a5f418e7b9658ef791518e5b9872745d29 (patch)
tree262b35502d49731ce9f1021583a49cf9a297bd46 /source/blender/imbuf/intern/bmp.c
parent40813b301aff7c1cb1c574f0f6570e05a5ca5eed (diff)
This is a pretty lame commit but here it is:
I just fixed indentation (replaced spaces with tabs where needed) and removed #include config.h stuff from the above files. Kent
Diffstat (limited to 'source/blender/imbuf/intern/bmp.c')
-rw-r--r--source/blender/imbuf/intern/bmp.c104
1 files changed, 51 insertions, 53 deletions
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c
index 9ef70a824ef..004a01d0ded 100644
--- a/source/blender/imbuf/intern/bmp.c
+++ b/source/blender/imbuf/intern/bmp.c
@@ -183,65 +183,63 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, int size, int flags)
/* Couple of helper functions for writing our data */
int putIntLSB(unsigned int ui,FILE *ofile) {
- putc((ui>>0)&0xFF,ofile);
- putc((ui>>8)&0xFF,ofile);
- putc((ui>>16)&0xFF,ofile);
- return putc((ui>>24)&0xFF,ofile);
+ putc((ui>>0)&0xFF,ofile);
+ putc((ui>>8)&0xFF,ofile);
+ putc((ui>>16)&0xFF,ofile);
+ return putc((ui>>24)&0xFF,ofile);
}
int putShortLSB(unsigned short us,FILE *ofile) {
- putc((us>>0)&0xFF,ofile);
- return putc((us>>8)&0xFF,ofile);
+ putc((us>>0)&0xFF,ofile);
+ return putc((us>>8)&0xFF,ofile);
}
/* Found write info at http://users.ece.gatech.edu/~slabaugh/personal/c/bitmapUnix.c */
short imb_savebmp(struct ImBuf *ibuf, char *name, int flags) {
- BMPINFOHEADER infoheader;
- int bytesize, extrabytes, x, y, t, ptr;
- uchar *data;
- FILE *ofile;
-
- extrabytes = (4 - ibuf->x*3 % 4) % 4;
- bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y;
-
- data = (uchar *) ibuf->rect;
- ofile = fopen(name,"wb");
-
- putShortLSB(19778,ofile); /* "BM" */
- putIntLSB(0,ofile); /* This can be 0 for BI_RGB bitmaps */
- putShortLSB(0,ofile); /* Res1 */
- putShortLSB(0,ofile); /* Res2 */
- putIntLSB(BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile);
-
- putIntLSB(sizeof(infoheader),ofile);
- putIntLSB(ibuf->x,ofile);
- putIntLSB(ibuf->y,ofile);
- putShortLSB(1,ofile);
- putShortLSB(24,ofile);
- putIntLSB(0,ofile);
- putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile);
- putIntLSB(0,ofile);
- putIntLSB(0,ofile);
- putIntLSB(0,ofile);
- putIntLSB(0,ofile);
-
- /* Need to write out padded image data in bgr format */
- for (y=0;y<ibuf->y;y++) {
- for (x=0;x<ibuf->x;x++) {
-
- ptr=(x + y * ibuf->x) * 4;
- if (putc(data[ptr+2],ofile) == EOF) return 0;
- if (putc(data[ptr+1],ofile) == EOF) return 0;
- if (putc(data[ptr],ofile) == EOF) return 0;
-
- }
- /* add padding here */
- for (t=0;t<extrabytes;t++) if (putc(0,ofile) == EOF) return 0;
- }
- if (ofile) {
- fflush(ofile);
- fclose(ofile);
- }
- return 1;
+ BMPINFOHEADER infoheader;
+ int bytesize, extrabytes, x, y, t, ptr;
+ uchar *data;
+ FILE *ofile;
+
+ extrabytes = (4 - ibuf->x*3 % 4) % 4;
+ bytesize = (ibuf->x * 3 + extrabytes) * ibuf->y;
+
+ data = (uchar *) ibuf->rect;
+ ofile = fopen(name,"wb");
+
+ putShortLSB(19778,ofile); /* "BM" */
+ putIntLSB(0,ofile); /* This can be 0 for BI_RGB bitmaps */
+ putShortLSB(0,ofile); /* Res1 */
+ putShortLSB(0,ofile); /* Res2 */
+ putIntLSB(BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile);
+
+ putIntLSB(sizeof(infoheader),ofile);
+ putIntLSB(ibuf->x,ofile);
+ putIntLSB(ibuf->y,ofile);
+ putShortLSB(1,ofile);
+ putShortLSB(24,ofile);
+ putIntLSB(0,ofile);
+ putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader),ofile);
+ putIntLSB(0,ofile);
+ putIntLSB(0,ofile);
+ putIntLSB(0,ofile);
+ putIntLSB(0,ofile);
+
+ /* Need to write out padded image data in bgr format */
+ for (y=0;y<ibuf->y;y++) {
+ for (x=0;x<ibuf->x;x++) {
+ ptr=(x + y * ibuf->x) * 4;
+ if (putc(data[ptr+2],ofile) == EOF) return 0;
+ if (putc(data[ptr+1],ofile) == EOF) return 0;
+ if (putc(data[ptr],ofile) == EOF) return 0;
+ }
+ /* add padding here */
+ for (t=0;t<extrabytes;t++) if (putc(0,ofile) == EOF) return 0;
+ }
+ if (ofile) {
+ fflush(ofile);
+ fclose(ofile);
+ }
+ return 1;
}