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:
authorTon Roosendaal <ton@blender.org>2006-01-09 22:17:37 +0300
committerTon Roosendaal <ton@blender.org>2006-01-09 22:17:37 +0300
commite62fed936e171b5d5ee71ed7caa23ea730d006ee (patch)
tree2515251448c1b5333496a3139aaac3ad5920d33b /source/blender/imbuf/intern/divers.c
parentbdef14bf81ef896ea0774df752fd606d763632b3 (diff)
Orange: more exr & imbuf cleanup
- Reading exr images now goes OK. I've unified the code for reading 'half' and 'float' (was nicely possible!). And removed useless copying of data around. - Fixed bug in allocating new rects, like for making mipmaps. flag issues. - filter code accidentally incremented wrong pointer (crash on mipmap too)
Diffstat (limited to 'source/blender/imbuf/intern/divers.c')
-rw-r--r--source/blender/imbuf/intern/divers.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/source/blender/imbuf/intern/divers.c b/source/blender/imbuf/intern/divers.c
index a56f16f71db..07ba4ee5f73 100644
--- a/source/blender/imbuf/intern/divers.c
+++ b/source/blender/imbuf/intern/divers.c
@@ -38,6 +38,7 @@
#include "imbuf_patch.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
+#include "IMB_allocimbuf.h"
#include "IMB_divers.h"
void imb_checkncols(struct ImBuf *ibuf)
@@ -164,3 +165,28 @@ void IMB_gamwarp(struct ImBuf *ibuf, double gamma)
}
}
}
+
+void IMB_rect_from_float(struct ImBuf *ibuf)
+{
+ /* quick method to convert floatbuf to byte */
+ float *tof = ibuf->rect_float;
+ int i;
+ unsigned char *to = (unsigned char *) ibuf->rect;
+
+ if(tof==NULL) return;
+ if(to==NULL) {
+ imb_addrectImBuf(ibuf);
+ to = (unsigned char *) ibuf->rect;
+ }
+
+ for (i = ibuf->x * ibuf->y; i > 0; i--)
+ {
+ to[0] = tof[0] > 1.0 ? 255 : (unsigned char)(tof[0] * 255.0f);
+ to[1] = tof[1] > 1.0 ? 255 : (unsigned char)(tof[1] * 255.0f);
+ to[2] = tof[2] > 1.0 ? 255 : (unsigned char)(tof[2] * 255.0f);
+ to[3] = tof[3] > 1.0 ? 255 : (unsigned char)(tof[3] * 255.0f);
+ to += 4;
+ tof += 4;
+ }
+
+}