diff options
Diffstat (limited to 'source/blender/imbuf/intern/bmp.c')
-rw-r--r-- | source/blender/imbuf/intern/bmp.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/source/blender/imbuf/intern/bmp.c b/source/blender/imbuf/intern/bmp.c index 32733668052..856124ab5cb 100644 --- a/source/blender/imbuf/intern/bmp.c +++ b/source/blender/imbuf/intern/bmp.c @@ -29,6 +29,7 @@ * \ingroup imbuf */ +#include "BLI_utildefines.h" #include "BLI_fileops.h" #include "imbuf.h" @@ -60,6 +61,7 @@ typedef struct BMPINFOHEADER { unsigned int biClrImportant; } BMPINFOHEADER; +#if 0 typedef struct BMPHEADER { unsigned short biType; unsigned int biSize; @@ -67,6 +69,7 @@ typedef struct BMPHEADER { unsigned short biRes2; unsigned int biOffBits; } BMPHEADER; +#endif #define BMP_FILEHEADER_SIZE 14 @@ -125,6 +128,7 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co int x, y, depth, skip, i; unsigned char *bmp, *rect; unsigned short col; + double xppm, yppm; (void)size; /* unused */ @@ -144,6 +148,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co x = LITTLE_LONG(bmi.biWidth); y = LITTLE_LONG(bmi.biHeight); depth = LITTLE_SHORT(bmi.biBitCount); + xppm = LITTLE_LONG(bmi.biXPelsPerMeter); + yppm = LITTLE_LONG(bmi.biYPelsPerMeter); #if 0 printf("skip: %d, x: %d y: %d, depth: %d (%x)\n", skip, x, y, @@ -199,6 +205,8 @@ struct ImBuf *imb_bmp_decode(unsigned char *mem, size_t size, int flags, char co } if (ibuf) { + ibuf->ppm[0] = xppm; + ibuf->ppm[1] = yppm; ibuf->ftype = BMP; } @@ -250,8 +258,8 @@ int imb_savebmp(struct ImBuf *ibuf, const char *name, int flags) putShortLSB(24, ofile); putIntLSB(0, ofile); putIntLSB(bytesize + BMP_FILEHEADER_SIZE + sizeof(infoheader), ofile); - putIntLSB(0, ofile); - putIntLSB(0, ofile); + putIntLSB((int)(ibuf->ppm[0] + 0.5), ofile); + putIntLSB((int)(ibuf->ppm[1] + 0.5), ofile); putIntLSB(0, ofile); putIntLSB(0, ofile); |