diff options
Diffstat (limited to 'source/blender/src')
-rw-r--r-- | source/blender/src/Makefile | 4 | ||||
-rw-r--r-- | source/blender/src/buttons_scene.c | 18 | ||||
-rw-r--r-- | source/blender/src/editface.c | 16 | ||||
-rw-r--r-- | source/blender/src/editmesh_mods.c | 104 | ||||
-rw-r--r-- | source/blender/src/filesel.c | 6 | ||||
-rw-r--r-- | source/blender/src/imasel.c | 10 | ||||
-rw-r--r-- | source/blender/src/interface_icons.c | 5 | ||||
-rw-r--r-- | source/blender/src/screendump.c | 3 | ||||
-rw-r--r-- | source/blender/src/sequence.c | 18 | ||||
-rw-r--r-- | source/blender/src/toets.c | 20 | ||||
-rw-r--r-- | source/blender/src/vpaint.c | 19 | ||||
-rw-r--r-- | source/blender/src/writeimage.c | 23 | ||||
-rw-r--r-- | source/blender/src/writemovie.c | 17 |
13 files changed, 140 insertions, 123 deletions
diff --git a/source/blender/src/Makefile b/source/blender/src/Makefile index f0728897d47..f89f8965fd5 100644 --- a/source/blender/src/Makefile +++ b/source/blender/src/Makefile @@ -112,6 +112,10 @@ ifeq ($(WITH_QUICKTIME),true) CPPFLAGS += -DWITH_QUICKTIME endif +ifeq ($(WITH_OPENEXR),true) + CPPFLAGS += -DWITH_OPENEXR +endif + ifeq ($(INTERNATIONAL), true) CPPFLAGS += -DINTERNATIONAL endif diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c index 7f565a9317c..55450005793 100644 --- a/source/blender/src/buttons_scene.c +++ b/source/blender/src/buttons_scene.c @@ -979,14 +979,19 @@ static char *imagetype_pup(void) "HamX", R_HAMX, "Iris", R_IRIS, "Iris + Zbuffer", R_IRIZ, - "Radiance HDR", R_RADHDR, + "Radiance HDR", R_RADHDR #ifdef __sgi - "Movie", R_MOVIE, + ,"Movie", R_MOVIE #endif - "Ftype", R_FTYPE ); } +#ifdef WITH_OPENEXR + strcpy(formatstring, "|%s %%x%d"); + sprintf(appendstring, formatstring, "OpenEXR", R_OPENEXR); + strcat(string, appendstring); +#endif + if (G.have_libtiff) { strcpy(formatstring, "|%s %%x%d"); sprintf(appendstring, formatstring, "TIFF", R_TIFF); @@ -1252,7 +1257,14 @@ static void render_panel_format(void) #endif uiDefBut(block, BUT,B_SELECTCODEC, "Set codec", 892,yofs,112,20, 0, 0, 0, 0, 0, "Set codec settings for AVI"); } +#ifdef WITH_OPENEXR + } else if (G.scene->r.imtype == R_OPENEXR ) { + if (G.scene->r.quality > 5) G.scene->r.quality = 0; + uiDefButS(block, MENU,B_SET_OPENEXR, "Codec %t|None %x0|Pxr24 (lossy) %x1|ZIP (lossless) %x2|PIZ (lossless) %x3|RLE (lossless) %x4", 892,yofs,112,20, &G.scene->r.quality, 0, 0, 0, 0, "Set codec settings for OpenEXR"); +#endif } else { + if(G.scene->r.quality < 5) G.scene->r.quality = 90; // temp + uiDefButS(block, NUM,B_DIFF, "Quality:", 892,yofs,112,20, &G.scene->r.quality, 10.0, 100.0, 0, 0, "Quality setting for JPEG images, AVI Jpeg and SGI movies"); } uiDefButS(block, NUM,B_FRAMEMAP,"Frs/sec:", 1006,yofs,113,20, &G.scene->r.frs_sec, 1.0, 120.0, 100.0, 0, "Frames per second"); diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c index 787b6a6471a..11179467a2f 100644 --- a/source/blender/src/editface.c +++ b/source/blender/src/editface.c @@ -34,10 +34,6 @@ #include <math.h> #include <string.h> -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include "MEM_guardedalloc.h" #include "BLI_blenlib.h" @@ -1023,7 +1019,8 @@ void face_borderselect() Mesh *me; TFace *tface; rcti rect; - unsigned int *rectm, *rt; + struct ImBuf *ibuf; + unsigned int *rt; int a, sx, sy, index, val; char *selar; @@ -1046,9 +1043,10 @@ void face_borderselect() sy= (rect.ymax-rect.ymin+1); if(sx*sy<=0) return; - rt=rectm= MEM_mallocN(sizeof(int)*sx*sy, "selrect"); - glReadPixels(rect.xmin+curarea->winrct.xmin, rect.ymin+curarea->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, rectm); - if(G.order==B_ENDIAN) IMB_convert_rgba_to_abgr(sx*sy, rectm); + ibuf = IMB_allocImBuf(sx,sy,32,0,0); + rt = ibuf->rect; + glReadPixels(rect.xmin+curarea->winrct.xmin, rect.ymin+curarea->winrct.ymin, sx, sy, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); + if(G.order==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf); a= sx*sy; while(a--) { @@ -1070,7 +1068,7 @@ void face_borderselect() } } - MEM_freeN(rectm); + IMB_freeImBuf(ibuf); MEM_freeN(selar); BIF_undo_push("Border Select UV face"); diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c index 8cefaf4221b..4fc0eb7f293 100644 --- a/source/blender/src/editmesh_mods.c +++ b/source/blender/src/editmesh_mods.c @@ -40,10 +40,6 @@ editmesh_mods.c, UI level access, no geometry changes #include <string.h> #include <math.h> -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include "MEM_guardedalloc.h" #include "MTC_matrixops.h" @@ -92,6 +88,7 @@ editmesh_mods.c, UI level access, no geometry changes #include "BSE_edit.h" #include "BSE_view.h" +#include "IMB_imbuf_types.h" #include "IMB_imbuf.h" #include "mydevice.h" @@ -155,11 +152,12 @@ static unsigned int sample_backbuf(int x, int y) } /* reads full rect, converts indices */ -static unsigned int *read_backbuf(short xmin, short ymin, short xmax, short ymax) +struct ImBuf *read_backbuf(short xmin, short ymin, short xmax, short ymax) { - unsigned int *dr, *buf; + unsigned int *dr, *rd; + struct ImBuf *ibuf, *ibuf1; int a; - short xminc, yminc, xmaxc, ymaxc; + short xminc, yminc, xmaxc, ymaxc, xs, ys; /* clip */ if(xmin<0) xminc= 0; else xminc= xmin; @@ -170,55 +168,49 @@ static unsigned int *read_backbuf(short xmin, short ymin, short xmax, short ymax if(ymax>=curarea->winy) ymaxc= curarea->winy-1; else ymaxc= ymax; if(yminc > ymaxc) return NULL; - buf= MEM_mallocN( (xmaxc-xminc+1)*(ymaxc-yminc+1)*sizeof(int), "sample rect"); + ibuf= IMB_allocImBuf((xmaxc-xminc+1),(ymaxc-yminc+1),32,IB_rect,0); check_backbuf(); // actually not needed for apple #ifdef __APPLE__ glReadBuffer(GL_AUX0); #endif - glReadPixels(curarea->winrct.xmin+xminc, curarea->winrct.ymin+yminc, (xmaxc-xminc+1), (ymaxc-yminc+1), GL_RGBA, GL_UNSIGNED_BYTE, buf); + glReadPixels(curarea->winrct.xmin+xminc, curarea->winrct.ymin+yminc, (xmaxc-xminc+1), (ymaxc-yminc+1), GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); glReadBuffer(GL_BACK); - if(G.order==B_ENDIAN) IMB_convert_rgba_to_abgr((xmaxc-xminc+1)*(ymaxc-yminc+1), buf); + if(G.order==B_ENDIAN) IMB_convert_rgba_to_abgr(ibuf); a= (xmaxc-xminc+1)*(ymaxc-yminc+1); - dr= buf; + dr= ibuf->rect; while(a--) { if(*dr) *dr= framebuffer_to_index(*dr); dr++; } /* put clipped result back, if needed */ - if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax) return buf; - else { - unsigned int *buf1= MEM_callocN( (xmax-xmin+1)*(ymax-ymin+1)*sizeof(int), "sample rect2"); - unsigned int *rd; - short xs, ys; - - rd= buf; - dr= buf1; + if(xminc==xmin && xmaxc==xmax && yminc==ymin && ymaxc==ymax) return ibuf; + ibuf1= IMB_allocImBuf( (xmax-xmin+1),(ymax-ymin+1),32,IB_rect,0); + rd= ibuf->rect; + dr= ibuf1->rect; - for(ys= ymin; ys<=ymax; ys++) { - for(xs= xmin; xs<=xmax; xs++, dr++) { - if( xs>=xminc && xs<=xmaxc && ys>=yminc && ys<=ymaxc) { - *dr= *rd; - rd++; - } + for(ys= ymin; ys<=ymax; ys++) { + for(xs= xmin; xs<=xmax; xs++, dr++) { + if( xs>=xminc && xs<=xmaxc && ys>=yminc && ys<=ymaxc) { + *dr= *rd; + rd++; } } - MEM_freeN(buf); - return buf1; } - - return buf; + IMB_freeImBuf(ibuf); + return ibuf1; } /* smart function to sample a rect spiralling outside, nice for backbuf selection */ static unsigned int sample_backbuf_rect(short mval[2], int size, unsigned int min, unsigned int max, short *dist) { - unsigned int *buf, *bufmin, *bufmax; + struct ImBuf *buf; + unsigned int *bufmin, *bufmax, *tbuf; int minx, miny; int a, b, rc, nr, amount, dirvec[4][2]; short distance=0; @@ -229,8 +221,7 @@ static unsigned int sample_backbuf_rect(short mval[2], int size, unsigned int mi minx = mval[0]-(amount+1); miny = mval[1]-(amount+1); buf = read_backbuf(minx, miny, minx+size-1, miny+size-1); - if (!buf) - return 0; + if (!buf) return 0; rc= 0; @@ -239,23 +230,24 @@ static unsigned int sample_backbuf_rect(short mval[2], int size, unsigned int mi dirvec[2][0]= -1; dirvec[2][1]= 0; dirvec[3][0]= 0; dirvec[3][1]= size; - bufmin= buf; - bufmax= buf+ size*size; - buf+= amount*size+ amount; + bufmin = buf->rect; + tbuf = buf->rect; + bufmax = buf->rect + size*size; + tbuf+= amount*size+ amount; for(nr=1; nr<=size; nr++) { for(a=0; a<2; a++) { for(b=0; b<nr; b++, distance++) { - if (*buf && *buf>=min && *buf<max) { + if (*tbuf && *tbuf>=min && *tbuf<max) { *dist= (short) sqrt( (float)distance ); // XXX, this distance is wrong - zr - index = *buf - min+1; // messy yah, but indices start at 1 + index = *tbuf - min+1; // messy yah, but indices start at 1 goto exit; } - buf+= (dirvec[rc][0]+dirvec[rc][1]); + tbuf+= (dirvec[rc][0]+dirvec[rc][1]); - if(buf<bufmin || buf>=bufmax) { + if(tbuf<bufmin || tbuf>=bufmax) { goto exit; } } @@ -265,7 +257,7 @@ static unsigned int sample_backbuf_rect(short mval[2], int size, unsigned int mi } exit: - MEM_freeN(bufmin); + IMB_freeImBuf(buf); return index; } @@ -322,14 +314,17 @@ static void draw_triangulated(short mcords[][2], short tot) /* returns if all is OK */ int EM_init_backbuf_border(short xmin, short ymin, short xmax, short ymax) { - unsigned int *buf, *dr; + struct ImBuf *buf; + unsigned int *dr; int a; if(G.obedit==NULL || G.vd->drawtype<OB_SOLID || (G.vd->flag & V3D_ZBUF_SELECT)==0) return 0; if(em_vertoffs==0) return 0; - dr= buf= read_backbuf(xmin, ymin, xmax, ymax); + buf= read_backbuf(xmin, ymin, xmax, ymax); if(buf==NULL) return 0; + + dr = buf->rect; /* build selection lookup */ selbuf= MEM_callocN(em_vertoffs+1, "selbuf"); @@ -340,7 +335,7 @@ int EM_init_backbuf_border(short xmin, short ymin, short xmax, short ymax) selbuf[*dr]= 1; dr++; } - MEM_freeN(buf); + IMB_freeImBuf(buf); return 1; } @@ -366,7 +361,8 @@ void EM_free_backbuf(void) */ int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short ymin, short xmax, short ymax) { - unsigned int *buf, *bufmask, *dr, *drm; + unsigned int *dr, *drm; + struct ImBuf *buf, *bufmask; int a; /* method in use for face selecting too */ @@ -378,9 +374,11 @@ int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short if(em_vertoffs==0) return 0; - dr= buf= read_backbuf(xmin, ymin, xmax, ymax); + buf= read_backbuf(xmin, ymin, xmax, ymax); if(buf==NULL) return 0; + dr = buf->rect; + /* draw the mask */ #ifdef __APPLE__ glDrawBuffer(GL_AUX0); @@ -403,7 +401,8 @@ int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short glDrawBuffer(GL_BACK); /* grab mask */ - drm= bufmask= read_backbuf(xmin, ymin, xmax, ymax); + bufmask= read_backbuf(xmin, ymin, xmax, ymax); + drm = bufmask->rect; if(bufmask==NULL) return 0; // only when mem alloc fails, go crash somewhere else! /* build selection lookup */ @@ -414,8 +413,8 @@ int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short if(*dr>0 && *dr<=em_vertoffs && *drm==0) selbuf[*dr]= 1; dr++; drm++; } - MEM_freeN(buf); - MEM_freeN(bufmask); + IMB_freeImBuf(buf); + IMB_freeImBuf(bufmask); return 1; } @@ -423,7 +422,8 @@ int EM_mask_init_backbuf_border(short mcords[][2], short tot, short xmin, short /* circle shaped sample area */ int EM_init_backbuf_circle(short xs, short ys, short rads) { - unsigned int *buf, *dr; + struct ImBuf *buf; + unsigned int *dr; short xmin, ymin, xmax, ymax, xc, yc; int radsq; @@ -437,8 +437,10 @@ int EM_init_backbuf_circle(short xs, short ys, short rads) xmin= xs-rads; xmax= xs+rads; ymin= ys-rads; ymax= ys+rads; - dr= buf= read_backbuf(xmin, ymin, xmax, ymax); + buf= read_backbuf(xmin, ymin, xmax, ymax); if(buf==NULL) return 0; + + dr = buf->rect; /* build selection lookup */ selbuf= MEM_callocN(em_vertoffs+1, "selbuf"); @@ -451,7 +453,7 @@ int EM_init_backbuf_circle(short xs, short ys, short rads) } } - MEM_freeN(buf); + IMB_freeImBuf(buf); return 1; } diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c index ae986cc7789..07d85d48160 100644 --- a/source/blender/src/filesel.c +++ b/source/blender/src/filesel.c @@ -502,10 +502,13 @@ void test_flags_file(SpaceFile *sfile) (BLI_testextensie(file->relname, ".tif") || BLI_testextensie(file->relname, ".tiff"))) { file->flags |= IMAGEFILE; + } else if (BLI_testextensie(file->relname, ".exr")) { + file->flags |= IMAGEFILE; } else if (G.have_quicktime){ if( BLI_testextensie(file->relname, ".jpg") || BLI_testextensie(file->relname, ".jpeg") || BLI_testextensie(file->relname, ".hdr") + || BLI_testextensie(file->relname, ".exr") || BLI_testextensie(file->relname, ".tga") || BLI_testextensie(file->relname, ".rgb") || BLI_testextensie(file->relname, ".bmp") @@ -532,7 +535,8 @@ void test_flags_file(SpaceFile *sfile) } } else { // no quicktime if(BLI_testextensie(file->relname, ".jpg") - || BLI_testextensie(file->relname, ".hdr") + || BLI_testextensie(file->relname, ".hdr") + || BLI_testextensie(file->relname, ".exr") || BLI_testextensie(file->relname, ".tga") || BLI_testextensie(file->relname, ".rgb") || BLI_testextensie(file->relname, ".bmp") diff --git a/source/blender/src/imasel.c b/source/blender/src/imasel.c index c39fe83954e..6c232ea6464 100644 --- a/source/blender/src/imasel.c +++ b/source/blender/src/imasel.c @@ -34,10 +34,6 @@ #include <stdlib.h> #include <string.h> -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #ifndef WIN32 #include <unistd.h> #else @@ -538,7 +534,7 @@ void get_next_image(SpaceImaSel *simasel) /* the whole cmap system is wacko */ if (G.order==B_ENDIAN) - IMB_convert_rgba_to_abgr(ima->dw*ima->dh, ibuf->rect); + IMB_convert_rgba_to_abgr(ibuf); ibuf->mincol = 0; ibuf->maxcol = 256; @@ -555,7 +551,7 @@ void get_next_image(SpaceImaSel *simasel) longtochar(ima->pict_rect, ibuf->rect, size); IMB_applycmap(ibuf); - IMB_convert_rgba_to_abgr(size, ibuf->rect); + IMB_convert_rgba_to_abgr(ibuf); if (ima->pict) IMB_freeImBuf(ima->pict); ima->pict = ibuf; @@ -797,7 +793,7 @@ void get_pib_file(SpaceImaSel *simasel) ima->pict->cmap = simasel->cmap->cmap; ima->pict->maxcol = 256; IMB_applycmap(ima->pict); - IMB_convert_rgba_to_abgr(size, ima->pict->rect); + IMB_convert_rgba_to_abgr(ima->pict); } ima->selected = 0; ima->selectable = 0; diff --git a/source/blender/src/interface_icons.c b/source/blender/src/interface_icons.c index d245e0e1427..dc487ae72fe 100644 --- a/source/blender/src/interface_icons.c +++ b/source/blender/src/interface_icons.c @@ -733,8 +733,11 @@ void BIF_icon_draw(float x, float y, int icon_id) ui_rasterpos_safe(x, y, di->aspect); + if(di->w<1 || di->h<1) { + printf("what the heck!\n"); + } /* di->rect contains image in 'rendersize', we only scale if needed */ - if(di->rw!=di->w && di->rh!=di->h) { + else if(di->rw!=di->w && di->rh!=di->h) { ImBuf *ima; /* first allocate imbuf for scaling and copy preview into it */ ima = IMB_allocImBuf(di->rw, di->rh, 32, IB_rect, 0); diff --git a/source/blender/src/screendump.c b/source/blender/src/screendump.c index ebc5bad88c6..cd51f1fdb0f 100644 --- a/source/blender/src/screendump.c +++ b/source/blender/src/screendump.c @@ -87,6 +87,9 @@ void write_screendump(char *name) else if(G.scene->r.imtype==R_PNG) ibuf->ftype= PNG; else if((G.have_libtiff) && (G.scene->r.imtype==R_TIFF)) ibuf->ftype= TIF; +#ifdef WITH_OPENEXR + else if(G.scene->r.imtype==R_OPENEXR) ibuf->ftype= OPENEXR; +#endif else if(G.scene->r.imtype==R_HAMX) ibuf->ftype= AN_hamx; else if(ELEM5(G.scene->r.imtype, R_MOVIE, R_AVICODEC, R_AVIRAW, R_AVIJPEG, R_JPEG90)) { ibuf->ftype= JPG|G.scene->r.quality; diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c index 17b6e4d90b0..3191ec1095b 100644 --- a/source/blender/src/sequence.c +++ b/source/blender/src/sequence.c @@ -34,10 +34,6 @@ #include <math.h> #include <stdlib.h> -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #include "MEM_guardedalloc.h" #include "PIL_dynlib.h" @@ -1655,19 +1651,19 @@ void do_effect(int cfra, Sequence *seq, StripElem *se) if(cp) strncpy(cp, seq->name+2, 22); if (seq->plugin->version<=2) { - if(se1->ibuf) IMB_convert_rgba_to_abgr(se1->ibuf->x*se1->ibuf->y, se1->ibuf->rect); - if(se2->ibuf) IMB_convert_rgba_to_abgr(se2->ibuf->x*se2->ibuf->y, se2->ibuf->rect); - if(se3->ibuf) IMB_convert_rgba_to_abgr(se3->ibuf->x*se3->ibuf->y, se3->ibuf->rect); + if(se1->ibuf) IMB_convert_rgba_to_abgr(se1->ibuf); + if(se2->ibuf) IMB_convert_rgba_to_abgr(se2->ibuf); + if(se3->ibuf) IMB_convert_rgba_to_abgr(se3->ibuf); } ((SeqDoit)seq->plugin->doit)(seq->plugin->data, fac, facf, x, y, se1->ibuf, se2->ibuf, se->ibuf, se3->ibuf); if (seq->plugin->version<=2) { - if(se1->ibuf) IMB_convert_rgba_to_abgr(se1->ibuf->x*se1->ibuf->y, se1->ibuf->rect); - if(se2->ibuf) IMB_convert_rgba_to_abgr(se2->ibuf->x*se2->ibuf->y, se2->ibuf->rect); - if(se3->ibuf) IMB_convert_rgba_to_abgr(se3->ibuf->x*se3->ibuf->y, se3->ibuf->rect); - IMB_convert_rgba_to_abgr(se->ibuf->x*se->ibuf->y, se->ibuf->rect); + if(se1->ibuf) IMB_convert_rgba_to_abgr(se1->ibuf); + if(se2->ibuf) IMB_convert_rgba_to_abgr(se2->ibuf); + if(se3->ibuf) IMB_convert_rgba_to_abgr(se3->ibuf); + IMB_convert_rgba_to_abgr(se->ibuf); } if((G.f & G_PLAYANIM)==0) waitcursor(0); diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c index acceccafe60..8fc3f740a0b 100644 --- a/source/blender/src/toets.c +++ b/source/blender/src/toets.c @@ -147,13 +147,6 @@ void schrijfplaatje(char *name) unsigned int *temprect=0; char str[FILE_MAXDIR+FILE_MAXFILE]; - /* radhdr: temporary call for direct float buffer save for HDR format */ - if ((R.r.imtype==R_RADHDR) && (R.rectftot)) - { - imb_savehdr_fromfloat(R.rectftot, name, R.rectx, R.recty); - return; - } - /* has RGBA been set? If so: use alpha channel for color zero */ IMB_alpha_to_col0(FALSE); @@ -188,7 +181,7 @@ void schrijfplaatje(char *name) if(ibuf) { ibuf->rect= (unsigned int *) R.rectot; -// ibuf->rect_float = R.rectftot; + ibuf->rect_float = R.rectftot; if(R.r.planes == 8) IMB_cspace(ibuf, rgb_to_bw); @@ -205,8 +198,6 @@ void schrijfplaatje(char *name) } } else if(R.r.imtype==R_RADHDR) { - /* radhdr: save hdr from rgba buffer, not really recommended, probably mistake, so warn user */ - error("Will save, but you might want to enable the floatbuffer to save a real HDRI..."); ibuf->ftype= RADHDR; } else if(R.r.imtype==R_PNG) { @@ -218,6 +209,11 @@ void schrijfplaatje(char *name) else if((G.have_libtiff) && (R.r.imtype==R_TIFF)) { ibuf->ftype= TIF; } +#ifdef WITH_OPENEXR + else if(R.r.imtype==R_OPENEXR) { + ibuf->ftype= OPENEXR; + } +#endif else if((R.r.imtype==R_TARGA) || (R.r.imtype==R_PNG)) { ibuf->ftype= TGA; } @@ -500,6 +496,10 @@ int save_image_filesel_str(char *str) if (G.have_libtiff) { strcpy(str, "Save TIFF"); return 1; } +#ifdef WITH_OPENEXR + case R_OPENEXR: + strcpy(str, "Save OpenEXR"); return 1; +#endif case R_TARGA: strcpy(str, "Save Targa"); return 1; case R_RAWTGA: diff --git a/source/blender/src/vpaint.c b/source/blender/src/vpaint.c index ad62f6c0dc0..836c98bdb22 100644 --- a/source/blender/src/vpaint.c +++ b/source/blender/src/vpaint.c @@ -33,10 +33,6 @@ #include <math.h> #include <string.h> -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #ifdef WIN32 #include <io.h> #else @@ -46,6 +42,7 @@ #include "MEM_guardedalloc.h" #include "IMB_imbuf.h" +#include "IMB_imbuf_types.h" #include "BLI_blenlib.h" #include "BLI_arithb.h" @@ -599,7 +596,8 @@ static void vpaint_blend( unsigned int *col, unsigned int *colorig, unsigned int static int sample_backbuf_area(int x, int y, float size) { - unsigned int rect[129*129], *rt; + unsigned int *rt; + struct ImBuf *ibuf; int x1, y1, x2, y2, a, tot=0, index; if(totvpaintundo>=MAXINDEX) return 0; @@ -617,12 +615,15 @@ static int sample_backbuf_area(int x, int y, float size) #ifdef __APPLE__ glReadBuffer(GL_AUX0); #endif - glReadPixels(x1+curarea->winrct.xmin, y1+curarea->winrct.ymin, x2-x1+1, y2-y1+1, GL_RGBA, GL_UNSIGNED_BYTE, rect); + ibuf = IMB_allocImBuf(size,size,32,IB_rect,0); + glReadPixels(x1+curarea->winrct.xmin, y1+curarea->winrct.ymin, x2-x1+1, y2-y1+1, GL_RGBA, GL_UNSIGNED_BYTE, ibuf->rect); glReadBuffer(GL_BACK); - if(G.order==B_ENDIAN) IMB_convert_rgba_to_abgr( (int)(4*size*size), rect); + if(G.order==B_ENDIAN) { + IMB_convert_rgba_to_abgr(ibuf); + } - rt= rect; + rt= ibuf->rect; size= (y2-y1)*(x2-x1); if(size<=0) return 0; @@ -642,6 +643,8 @@ static int sample_backbuf_area(int x, int y, float size) for(a=1; a<=totvpaintundo; a++) { if(indexar[a]) indexar[tot++]= a; } + + IMB_freeImBuf(ibuf); return tot; } diff --git a/source/blender/src/writeimage.c b/source/blender/src/writeimage.c index f386ea3ecf0..4497ed51e81 100644 --- a/source/blender/src/writeimage.c +++ b/source/blender/src/writeimage.c @@ -63,6 +63,11 @@ int BIF_write_ibuf(ImBuf *ibuf, char *name) else if ((G.have_libtiff) && (G.scene->r.imtype==R_TIFF)) { ibuf->ftype= TIF; } +#ifdef WITH_OPENEXR + else if (G.scene->r.imtype==R_OPENEXR) { + ibuf->ftype= OPENEXR; + } +#endif else if ((G.scene->r.imtype==R_TARGA) || (G.scene->r.imtype==R_PNG)) { // fall back to Targa if PNG writing is not supported ibuf->ftype= TGA; @@ -105,18 +110,12 @@ void BIF_save_envmap(EnvMap *env, char *str) dx= env->cube[0]->ibuf->x; ibuf= IMB_allocImBuf(3*dx, 2*dx, 24, IB_rect, 0); - IMB_rectop(ibuf, env->cube[0]->ibuf, - 0, 0, 0, 0, dx, dx, IMB_rectcpy, 0); - IMB_rectop(ibuf, env->cube[1]->ibuf, - dx, 0, 0, 0, dx, dx, IMB_rectcpy, 0); - IMB_rectop(ibuf, env->cube[2]->ibuf, - 2*dx, 0, 0, 0, dx, dx, IMB_rectcpy, 0); - IMB_rectop(ibuf, env->cube[3]->ibuf, - 0, dx, 0, 0, dx, dx, IMB_rectcpy, 0); - IMB_rectop(ibuf, env->cube[4]->ibuf, - dx, dx, 0, 0, dx, dx, IMB_rectcpy, 0); - IMB_rectop(ibuf, env->cube[5]->ibuf, - 2*dx, dx, 0, 0, dx, dx, IMB_rectcpy, 0); + IMB_rectcpy(ibuf, env->cube[0]->ibuf, 0, 0, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[1]->ibuf, dx, 0, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[2]->ibuf, 2*dx, 0, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[3]->ibuf, 0, dx, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[4]->ibuf, dx, dx, 0, 0, dx, dx); + IMB_rectcpy(ibuf, env->cube[5]->ibuf, 2*dx, dx, 0, 0, dx, dx); BIF_write_ibuf(ibuf, str); IMB_freeImBuf(ibuf); diff --git a/source/blender/src/writemovie.c b/source/blender/src/writemovie.c index f27f7ffd7e3..2c80200f904 100644 --- a/source/blender/src/writemovie.c +++ b/source/blender/src/writemovie.c @@ -30,10 +30,6 @@ * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - #ifdef __sgi #include <unistd.h> @@ -364,6 +360,7 @@ void append_movie(int cfra) char name[FILE_MAXDIR+FILE_MAXFILE]; const char *string; int fd; + float col[4] = {0.0,0.0,0.0,0.0}; set_sfra_efra(); make_movie_name(name); @@ -377,28 +374,28 @@ void append_movie(int cfra) if (ibuf->x != mv_outx || ibuf->y != mv_outy) { tbuf = IMB_allocImBuf(mv_outx, mv_outy, 32, IB_rect, 0); - IMB_rectoptot(tbuf, 0, IMB_rectfill, 0x00); + IMB_rectfill(tbuf,col); ofsx = (tbuf->x - ibuf->x) / 2; ofsy = (tbuf->y - ibuf->y) / 2; if (numfields == 2) ofsy &= ~1; - IMB_rectop(tbuf, ibuf, ofsx, ofsy, 0, 0, 32767, 32767, IMB_rectcpy, 0); + IMB_rectcpy(tbuf, ibuf, ofsx, ofsy, 0, 0, ibuf->x, ibuf->y); IMB_freeImBuf(ibuf); strcpy(tbuf->name, ibuf->name); ibuf = tbuf; } - IMB_convert_rgba_to_abgr(ibuf->x*ibuf->y, ibuf->rect); + IMB_convert_rgba_to_abgr(ibuf); if (numfields == 2) { if (ntsc) { - IMB_rectop(ibuf, ibuf, 0, 0, 0, 1, 32767, 32767, IMB_rectcpy, 0); + IMB_rectcpy(ibuf, ibuf, 0, 0, 0, 1, ibuf->x, ibuf->y); IMB_flipy(ibuf); IMB_de_interlace(ibuf); - if (ntsc) IMB_rectop(ibuf, ibuf, 0, 0, 0, 1, 32767, 32767, IMB_rectcpy, 0); + if (ntsc) IMB_rectcpy(ibuf, ibuf, 0, 0, 0, 1, ibuf->x, ibuf->y); } else { IMB_flipy(ibuf); - IMB_rectop(ibuf, ibuf, 0, 0, 0, 1, 32767, 32767, IMB_rectcpy, 0); + IMB_rectcpy(ibuf, ibuf, 0, 0, 0, 1, ibuf->x, ibuf->y); IMB_de_interlace(ibuf); } } |