Another fix to enable painting in a rendering. Paint works, but it's not
authorTon Roosendaal <ton@blender.org>
Mon, 12 Jun 2006 19:05:58 +0000 (19:05 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 12 Jun 2006 19:05:58 +0000 (19:05 +0000)
persisant (since float buffer is the source, converted to 32 bits for
drawing only)

source/blender/src/drawimage.c

index d67a0bc7931726377e4e693cfc13db588ac4daa0..90aa7492884473c031e3a8e582fcaaeaab986935 100644 (file)
@@ -268,21 +268,19 @@ void what_image(SpaceImage *sima)
                        }
                }
                else if(sima->image && strcmp(sima->image->name, "Render Result")==0) {
-                       RenderResult rres;
-                       /* make ibuf if needed, and initialize it */
-                       
-                       /* allocate for each redraw, we don't want render result pointers hanging around */
-                       IMB_freeImBuf(sima->image->ibuf);
-                       sima->image->ibuf= NULL;
-                       
-                       RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
-                       if(rres.rectf || rres.rect32) {
-                               ImBuf *ibuf= sima->image->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0);
+                       if(sima->image->ibuf==NULL) {
+                               RenderResult rres;
                                
-                               ibuf->x= rres.rectx;
-                               ibuf->y= rres.recty;
-                               ibuf->rect= rres.rect32;
-                               ibuf->rect_float= rres.rectf;
+                               /* make ibuf if needed, and initialize it */
+                               RE_GetResultImage(RE_GetRender(G.scene->id.name), &rres);
+                               if(rres.rectf || rres.rect32) {
+                                       ImBuf *ibuf= sima->image->ibuf= IMB_allocImBuf(rres.rectx, rres.recty, 32, 0, 0);
+                                       
+                                       ibuf->x= rres.rectx;
+                                       ibuf->y= rres.recty;
+                                       ibuf->rect= rres.rect32;
+                                       ibuf->rect_float= rres.rectf;
+                               }
                        }
                }
        }
@@ -1624,7 +1622,7 @@ void drawimagespace(ScrArea *sa, void *spacedata)
        mywinset(sa->win);      /* restore scissor after gla call... */
        myortho2(-0.375, sa->winx-0.375, -0.375, sa->winy-0.375);
 
-       if(show_render==0) {
+       if(G.rendering==0) {
                draw_image_view_tool();
                draw_image_view_icon();
        }
@@ -2002,6 +2000,9 @@ static ScrArea *imagewindow_set_render_display(void)
                sima->image= ima;
        }
        
+       IMB_freeImBuf(sima->image->ibuf);
+       sima->image->ibuf= NULL;
+       
        if(G.displaymode==R_DISPLAYSCREEN) {
                if(sa->full==0) {
                        sima->flag |= SI_FULLWINDOW;