2.5
authorTon Roosendaal <ton@blender.org>
Wed, 20 May 2009 11:07:34 +0000 (11:07 +0000)
committerTon Roosendaal <ton@blender.org>
Wed, 20 May 2009 11:07:34 +0000 (11:07 +0000)
Fix: Node Editor backdrop drawing messed up viewport, making drawing of
UI elements not pixel accurate anymore.

source/blender/editors/screen/glutil.c
source/blender/editors/space_node/drawnode.c

index e0849bae51f08aa6b0d98a5cb0c080bd0488a051..a81a52fd5444aea0d5fcd56a0a709c7e73b18801 100644 (file)
@@ -591,8 +591,8 @@ void glaDrawPixelsSafe(float x, float y, int img_w, int img_h, int row_w, int fo
 
 void glaDefine2DArea(rcti *screen_rect)
 {
-       int sc_w= screen_rect->xmax - screen_rect->xmin;
-       int sc_h= screen_rect->ymax - screen_rect->ymin;
+       int sc_w= screen_rect->xmax - screen_rect->xmin + 1;
+       int sc_h= screen_rect->ymax - screen_rect->ymin + 1;
 
        glViewport(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
        glScissor(screen_rect->xmin, screen_rect->ymin, sc_w, sc_h);
index 9c2cf5dc5dd020fba759e37186b80a7d716b1bf1..cfbb03b986569082df211d69798d3808a0cb2193 100644 (file)
@@ -2440,6 +2440,9 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode)
                ImBuf *ibuf= BKE_image_get_ibuf(ima, NULL);
                if(ibuf) {
                        float x, y; 
+                       
+                       wmPushMatrix();
+                       
                        /* somehow the offset has to be calculated inverse */
                        
                        glaDefine2DArea(&ar->winrct);
@@ -2454,9 +2457,7 @@ void draw_nodespace_back_pix(ARegion *ar, SpaceNode *snode)
                        else if(ibuf->channels==4)
                                glaDrawPixelsSafe(x, y, ibuf->x, ibuf->y, ibuf->x, GL_RGBA, GL_FLOAT, ibuf->rect_float);
                        
-                       /* sort this out, this should not be needed */
-                       wmOrtho2(ar->v2d.cur.xmin, ar->v2d.cur.xmax, ar->v2d.cur.ymin, ar->v2d.cur.ymax);
-                       glLoadIdentity();
+                       wmPopMatrix();
                }
        }
 }