Bugfix #4620
authorTon Roosendaal <ton@blender.org>
Wed, 5 Jul 2006 17:32:49 +0000 (17:32 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 5 Jul 2006 17:32:49 +0000 (17:32 +0000)
Hurmf, then you bring back old backbuffer, and they want to have fields
work on that!
OK... here it is. Although using Compositor features will make this much
easier and advanced to control. :)

source/blender/blenkernel/BKE_image.h
source/blender/blenkernel/intern/image.c
source/blender/render/intern/source/imagetexture.c
source/blender/render/intern/source/pipeline.c

index a18489746bf7b3616f773435f1520a8c8491b2ff..8ba0fd73cc4ae599fcf4bc5b84225303542eda2b 100644 (file)
@@ -59,7 +59,8 @@ struct anim *openanim(char * name, int flags);
 void ima_ibuf_is_nul(struct Tex *tex, struct Image *ima);
 void load_image(struct Image * ima, int flags, char *relabase, int framenum);
 void converttopremul(struct ImBuf *ibuf);
-
+void image_de_interlace(struct Image *ima, int odd);
+       
 void tag_image_time(struct Image *ima);
 void free_old_images(void);
 
index 976b525d841747d486bfdd6035a5912e7d042ef6..ddf0daa5f7323a02b828fbd5949cd4f5a262ae76 100644 (file)
@@ -620,6 +620,14 @@ static void de_interlace_st(struct ImBuf *ibuf)    /* standard fields */
        ibuf->y /= 2;
 }
 
+void image_de_interlace(Image *ima, int odd)
+{
+       if(odd)
+               de_interlace_st(ima->ibuf);
+       else
+               de_interlace_ng(ima->ibuf);
+}
+
 /* important note: all calls here and calls inside can NOT use threadsafe malloc! */
 /* this entire function is mutex'ed with the same lock as for mallocs */
 void ima_ibuf_is_nul(Tex *tex, Image *ima)
index 39a5cedea984b5c1aaf26be5a03006fdcef8711a..b819181606b66bfb57aa5baaa4344ede8ccce7c1 100644 (file)
@@ -597,12 +597,17 @@ void image_sample(Image *ima, float fx, float fy, float dx, float dy, float *res
                return;
        }
        
+       if( (R.flag & R_SEC_FIELD) && (ima->ibuf->flags & IB_fields) )
+               ima->ibuf->rect+= (ima->ibuf->x*ima->ibuf->y);
+       
        boxsample(ima->ibuf, fx, fy, fx+dx, fy+dy, &texres, 0, 0);
        result[0]= texres.tr;
        result[1]= texres.tg;
        result[2]= texres.tb;
        result[3]= texres.ta;
 
+       if( (R.flag & R_SEC_FIELD) && (ima->ibuf->flags & IB_fields) )
+               ima->ibuf->rect-= (ima->ibuf->x*ima->ibuf->y);
 }
 
 int imagewraposa(Tex *tex, Image *ima, float *texvec, float *dxt, float *dyt, TexResult *texres)
index fed2aa71b75bab4173729dcdd4fb53bcb7a3e472..3c66ec02cdd69b4f460c3432c86cffab92203225 100644 (file)
@@ -1463,8 +1463,14 @@ static void load_backbuffer(Render *re)
                
                if(re->backbuf && re->backbuf->ibuf==NULL) {
                        re->backbuf->ibuf= IMB_loadiffname(re->backbuf->name, IB_rect);
-                       if(re->backbuf->ibuf==NULL) re->backbuf->ok= 0;
-                       else re->backbuf->ok= 1;
+                       if(re->backbuf->ibuf==NULL) 
+                               re->backbuf->ok= 0;
+                       else {
+                               re->backbuf->ok= 1;
+                               
+                               if (re->r.mode & R_FIELDS)
+                                       image_de_interlace(re->backbuf, re->r.mode & R_ODDFIELD);
+                       }
                }
                if(re->backbuf==NULL || re->backbuf->ok==0) {
                        // error() doesnt work with render window open