2.5
authorTon Roosendaal <ton@blender.org>
Mon, 8 Jun 2009 16:24:37 +0000 (16:24 +0000)
committerTon Roosendaal <ton@blender.org>
Mon, 8 Jun 2009 16:24:37 +0000 (16:24 +0000)
Small fixes:

- Preview render now accepts resize of 1 pixel without re-render,
  solves re-renders on scrolling window or dragging panel, because
  of float rounding.
- Panel dragging outline was off 0.5 pixel, showed as fat AA lines
- On switching tab, the preview gets re-rendered

source/blender/editors/interface/interface_panel.c
source/blender/editors/interface/interface_widgets.c
source/blender/editors/preview/previewrender.c
source/blender/editors/space_buttons/buttons_header.c

index a141e58fbe9802ef4fb9b9806fb1f58634c9e7ad..278f7c026b116a03bf29d4759f9f890159c893ac 100644 (file)
@@ -580,7 +580,7 @@ void ui_draw_aligned_panel(ARegion *ar, uiStyle *style, uiBlock *block, rcti *re
                        else uiSetRoundBox(3);
                        
                        UI_ThemeColorShade(TH_BACK, -120);
-                       uiRoundRect(rect->xmin, rect->ymin, rect->xmax, headrect.ymax+1, 8);
+                       uiRoundRect(0.5f + rect->xmin, 0.5f + rect->ymin, 0.5f + rect->xmax, 0.5f + headrect.ymax+1, 8);
                }
                if(panel->flag & PNL_OVERLAP) {
                        if(panel->control & UI_PNL_SOLID) uiSetRoundBox(15);
index 0660b7f19a9748462abf68245b70c10d92d14c4b..03487e2301ce38630d6b845fa956195097cba9b6 100644 (file)
@@ -1632,6 +1632,7 @@ static void widget_draw_extra_mask(const bContext *C, uiBut *but, uiWidgetType *
        widget_init(&wtb);
        
        if(but->block->drawextra) {
+               /* note: drawextra can change rect +1 or -1, to match round errors of existing previews */
                but->block->drawextra(C, but->poin, rect);
                
                /* make mask to draw over image */
index 56ec22a44b0515302214f33c1426ac8f8663f150..b0d093dc10b9ee9d68a3a7a495d02e45b1ee3ae4 100644 (file)
@@ -639,7 +639,12 @@ void ED_preview_draw(const bContext *C, void *idp, rcti *rect)
        RE_GetResultImage(RE_GetRender(name), &rres);
 
        if(rres.rectf) {
-               if(rres.rectx==newx && rres.recty==newy) {
+               
+               if( ABS(rres.rectx-newx)<2 && ABS(rres.recty-newy)<2 ) {
+                       /* correct size, then black outline matches */
+                       rect->xmax= rect->xmin + rres.rectx;
+                       rect->ymax= rect->ymin + rres.recty;
+               
                        glaDrawPixelsSafe(rect->xmin, rect->ymin, rres.rectx, rres.recty, rres.rectx, GL_RGBA, GL_FLOAT, rres.rectf);
                        ok= 1;
                }
@@ -1039,7 +1044,8 @@ static void shader_preview_startjob(void *customdata, short *stop, short *do_upd
        }
        /* lens adjust */
        oldlens= ((Camera *)sce->camera->data)->lens;
-       ((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sp->sizex;
+       if(sp->sizex > sp->sizey)
+               ((Camera *)sce->camera->data)->lens *= (float)sp->sizey/(float)sp->sizex;
 
        /* entire cycle for render engine */
        RE_SetCamera(re, sce->camera);
index ee710cd7b6715ea5122231a6a38dd326e17caf49..80f7ff42c5b10bd1ea0fad2a11c68c6507bd2679 100644 (file)
@@ -130,6 +130,7 @@ static void do_buttons_buttons(bContext *C, void *arg, int event)
                        else if(sbuts->mainb != BCONTEXT_TEXTURE)
                                sbuts->flag &= ~SB_WORLD_TEX;
 
+                       sbuts->preview= 1;
                        break;
        }
 }