Fix #19431: gestures would sometimes draw incorrect, now ensures they
authorBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 17 Dec 2009 19:55:08 +0000 (19:55 +0000)
committerBrecht Van Lommel <brechtvanlommel@pandora.be>
Thu, 17 Dec 2009 19:55:08 +0000 (19:55 +0000)
are always drawn in pixel space.

source/blender/windowmanager/WM_api.h
source/blender/windowmanager/intern/wm_draw.c
source/blender/windowmanager/intern/wm_gesture.c
source/blender/windowmanager/intern/wm_subwindow.c

index e90360fde456b851349c596d75cd64236047bfcd..c4270fbc8b048763c6bf64893eea77b1b0201b6a 100644 (file)
@@ -264,6 +264,7 @@ void                wmPopMatrix                     (void);         /* one level only */
 void           wmFrustum                       (float x1, float x2, float y1, float y2, float n, float f);
 void           wmOrtho                         (float x1, float x2, float y1, float y2, float n, float f);
 void           wmOrtho2                        (float x1, float x2, float y1, float y2);
+void           wmOrthoPixelSpace       (void);
 
                        /* utilities */
 void           WM_set_framebuffer_index_color(int index);
index b9e6ca2d28153652e89c110ce43b1efa5f2630f6..9ee67cd4047419b2ddfd2528ebe6290d7b63b16f 100644 (file)
@@ -585,7 +585,7 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
                }
        }
 
-       if(win->screen->do_draw_gesture)
+       if(screen->do_draw_gesture)
                wm_gesture_draw(win);
 
        if(wm->paintcursors.first) {
index 882da1794c6931ebc0d8c7e1c729a520d566b034..b95d171c1b0cbd88d5dc6fab7a66c547eccfbcdc 100644 (file)
@@ -248,6 +248,7 @@ void wm_gesture_draw(wmWindow *win)
        for(; gt; gt= gt->next) {
                /* all in subwindow space */
                wmSubWindowSet(win, gt->swinid);
+               wmOrthoPixelSpace();
                
                if(gt->type==WM_GESTURE_RECT)
                        wm_gesture_draw_rect(win, gt);
index 00af9eb0bb9b91e951ed64ef6a1bdca2f03b5a71..decf1f0d676bb9b3e059fecbb0d0d415618cd361 100644 (file)
@@ -405,6 +405,16 @@ void wmOrtho2(float x1, float x2, float y1, float y2)
        wmOrtho(x1, x2, y1, y2, -100, 100);
 }
 
+void wmOrthoPixelSpace(void)
+{
+       if(_curswin) {
+               int width, height;
+
+               wm_subwindow_getsize(_curwindow, _curswin->swinid, &width, &height);
+               wmOrtho2(-0.375, (float)width-0.375, -0.375, (float)height-0.375);
+               wmLoadIdentity();
+       }
+}
 
 /* *************************** Framebuffer color depth, for selection codes ********************** */