From 634648699586cf409e19cfeb4bd405647cf4c698 Mon Sep 17 00:00:00 2001 From: Ton Roosendaal Date: Thu, 14 Oct 2004 23:03:12 +0000 Subject: [PATCH] fix for #1635 Field render, and field option for image texture, had error due to returns in middle of calls... this bug was there already for long while, not much used eh ;) --- source/blender/blenkernel/intern/image.c | 26 +++++++++++++----------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 05022b5d809..28254264f30 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -608,10 +608,6 @@ int imagewrap(Tex *tex, float *texvec) if (ima->ok) { ibuf = ima->ibuf; - if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) { - ibuf->rect+= (ibuf->x*ibuf->y); - } - if(tex->imaflag & TEX_IMAROT) { fy= texvec[0]; fx= texvec[1]; @@ -674,9 +670,18 @@ int imagewrap(Tex *tex, float *texvec) } } + /* warning, no return before setting back! */ + if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) { + ibuf->rect+= (ibuf->x*ibuf->y); + } + ofs = y * ibuf->x + x; rect = (char *)( ibuf->rect+ ofs); + if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) { + ibuf->rect-= (ibuf->x*ibuf->y); + } + Talpha= 0; if(tex->imaflag & TEX_USEALPHA) { if(tex->imaflag & TEX_CALCALPHA); @@ -719,9 +724,6 @@ int imagewrap(Tex *tex, float *texvec) if(tex->flag & TEX_NEGALPHA) Ta= 1.0f-Ta; - if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) { - ibuf->rect-= (ibuf->x*ibuf->y); - } } if(tex->nor) return 3; @@ -1259,10 +1261,6 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt) ibuf = ima->ibuf; - if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) { - ibuf->rect+= (ibuf->x*ibuf->y); - } - Talpha= 0; if(tex->imaflag & TEX_USEALPHA) { if(tex->imaflag & TEX_CALCALPHA); @@ -1278,7 +1276,6 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt) fy= texvec[1]; } - if(ibuf->flags & IB_fields) { if(R.r.mode & R_FIELDS) { /* field render */ if(R.flag & R_SEC_FIELD) { /* correction for 2nd field */ @@ -1404,6 +1401,11 @@ int imagewraposa(Tex *tex, float *texvec, float *dxt, float *dyt) else if(fy<0.0) fy+= 1-(int)(fy); } } + + /* warning no return! */ + if( (R.flag & R_SEC_FIELD) && (ibuf->flags & IB_fields) ) { + ibuf->rect+= (ibuf->x*ibuf->y); + } /* choice: */ if(tex->imaflag & TEX_MIPMAP) {