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 03:40:35 +0300
committerTon Roosendaal <ton@blender.org>2006-01-09 03:40:35 +0300
commit014aa7261e29810b35b3d65c759f9d255bf8a277 (patch)
tree360325f8db9431bdd187c0f0e7f7c40dcaa3a073 /source/blender/imbuf/intern/rectop.c
parent104ab9b103ab30ca87ccb9e739a58863fc29d3bf (diff)
Orange branch: OpenEXR finally in Blender!
Credits go to Gernot Ziegler, who originally coded EXR support, and to Austin Benesh for bringing it further. Kent Mein provided a lot of code for integrating float buffers in Blender imbuf and ImBuf API cleanup, and provided Make and Scons and static linking. At this moment; the EXR libraries are a *dependency*, so you cannot get the Orange branch compiled without having OpenEXR installed. Get the (precompiled or sources) stuff from www.openexr.com. Current default is that the headers and lib resides in /user/local/ Several changes/additions/fixes were added: - EXR code only supported 'half' format (16 bits per channel). I've added float writing, but for reading it I need tomorrow. :) - Quite some clumsy copying of data happened in EXR code. - cleaned up the api calls already a bit, preparing for more advanced support - Zbuffers were saved 16 bits, now 32 bits - automatic adding of .exr extensions went wrong Imbuf: - added proper imbuf->flags and imbuf->mall support for float buffers, it was created for *each* imbuf. :) - found bugs for float buffers in scaling and flipping. Code there will need more checks still - imbuf also needs to be verified to behave properly when no 32 bits rect exists (for saving for example) TODO: - support internal float images for textures, backbuf, AO probes, and display in Image window Hope this commit won't screwup syncing with bf-blender... :/
Diffstat (limited to 'source/blender/imbuf/intern/rectop.c')
-rw-r--r--source/blender/imbuf/intern/rectop.c77
1 files changed, 45 insertions, 32 deletions
diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c
index 22f2698a8c5..4ddd7ca4814 100644
--- a/source/blender/imbuf/intern/rectop.c
+++ b/source/blender/imbuf/intern/rectop.c
@@ -41,33 +41,17 @@
#include "IMB_allocimbuf.h"
-void IMB_rectcpy(unsigned int *drect, unsigned int *srect, int x, int dummy)
+void IMB_rectcpy(struct ImBuf *dbuf, struct ImBuf *sbuf, int destx,
+ int desty, int srcx, int srcy, int width, int height)
{
- memcpy(drect,srect, x * sizeof(int));
-}
-
-
-void IMB_rectfill(unsigned int *drect, unsigned int *srect, int x, int value)
-{
- for (;x > 0; x--) *drect++ = value;
-}
-
-void IMB_rectop(struct ImBuf *dbuf,
- struct ImBuf *sbuf,
- int destx,
- int desty,
- int srcx,
- int srcy,
- int width,
- int height,
- void (*operation)(unsigned int *, unsigned int*, int, int),
- int value)
-{
- unsigned int *drect,*srect;
- int tmp;
+ unsigned int *drect, *srect;
+ float *drectf = NULL;
+ float *srectf = NULL;
+ int tmp, do_float = 0;
- if (dbuf == 0) return;
- if (operation == 0) return;
+ if (dbuf == NULL) return;
+
+ if (sbuf->rect_float) do_float = 1;
if (destx < 0){
srcx -= destx ;
@@ -96,6 +80,7 @@ void IMB_rectop(struct ImBuf *dbuf,
if (height > tmp) height = tmp;
drect = dbuf->rect + desty * dbuf->x + destx;
+ if (do_float) drectf = dbuf->rect_float + desty * dbuf->x + destx;
destx = dbuf->x;
if (sbuf){
@@ -110,25 +95,53 @@ void IMB_rectop(struct ImBuf *dbuf,
srect = sbuf->rect;
srect += srcy * sbuf->x;
srect += srcx;
+ if (do_float) {
+ srectf = sbuf->rect_float;
+ srectf += srcy * sbuf->x;
+ srectf += srcx;
+ }
srcx = sbuf->x;
} else{
if (width <= 0) return;
if (height <= 0) return;
srect = drect;
+ srectf = drectf;
srcx = destx;
}
for (;height > 0; height--){
- operation(drect,srect,width, value);
- drect += destx;
- srect += srcx;
+
+ memcpy(drect,srect, width * sizeof(int));
+ if (do_float) memcpy(drectf,srectf, width * sizeof(float) * 4);
}
}
-
-void IMB_rectoptot(struct ImBuf *dbuf, struct ImBuf *sbuf,
- void (*operation)(unsigned int *, unsigned int*, int, int), int value)
+void IMB_rectfill(struct ImBuf *drect, float col[4])
{
- IMB_rectop(dbuf,sbuf,0,0,0,0,32767,32767,operation, value);
+ int num;
+ unsigned int *rrect = drect->rect;
+ unsigned char *spot;
+
+ num = drect->x * drect->y;
+ for (;num > 0; num--) {
+ spot = (unsigned char *)rrect;
+ spot[0] = (int)(col[0]*255);
+ spot[1] = (int)(col[1]*255);
+ spot[2] = (int)(col[2]*255);
+ spot[3] = (int)(col[3]*255);
+ *rrect++;
+ }
+ if(drect->rect_float) {
+ float *rrectf = drect->rect_float;
+
+ num = drect->x * drect->y;
+ for (;num > 0; num--) {
+ *rrectf++ = col[0];
+ *rrectf++ = col[1];
+ *rrectf++ = col[2];
+ *rrectf++ = col[3];
+ }
+ }
}
+