2.5
authorTon Roosendaal <ton@blender.org>
Sun, 19 Jul 2009 12:15:20 +0000 (12:15 +0000)
committerTon Roosendaal <ton@blender.org>
Sun, 19 Jul 2009 12:15:20 +0000 (12:15 +0000)
Small fix: Triple Buffer mode didn't clip custom paint cursors correctly
for overlapping regions (example, view3d paint circle drawing into toolbar)

source/blender/editors/include/ED_screen.h
source/blender/editors/screen/area.c
source/blender/windowmanager/intern/wm_draw.c
source/blender/windowmanager/intern/wm_gesture.c

index 3449458168ee392853712419233f404608566e41..6036a4c9e0fd235a665c3cc7328c16eed741585b 100644 (file)
@@ -50,6 +50,7 @@ void  ED_region_do_listen(struct ARegion *ar, struct wmNotifier *note);
 void   ED_region_do_draw(struct bContext *C, struct ARegion *ar);
 void   ED_region_exit(struct bContext *C, struct ARegion *ar);
 void   ED_region_pixelspace(struct ARegion *ar);
 void   ED_region_do_draw(struct bContext *C, struct ARegion *ar);
 void   ED_region_exit(struct bContext *C, struct ARegion *ar);
 void   ED_region_pixelspace(struct ARegion *ar);
+void   ED_region_set(const struct bContext *C, struct ARegion *ar);
 void   ED_region_init(struct bContext *C, struct ARegion *ar);
 void   ED_region_tag_redraw(struct ARegion *ar);
 void   ED_region_tag_redraw_partial(struct ARegion *ar, struct rcti *rct);
 void   ED_region_init(struct bContext *C, struct ARegion *ar);
 void   ED_region_tag_redraw(struct ARegion *ar);
 void   ED_region_tag_redraw_partial(struct ARegion *ar, struct rcti *rct);
index e84aab787c1bf13c547a02952fbbd0e6f494a7d2..cdb4322d7f28c8e9f2dd1790f3d192987bcfeec3 100644 (file)
@@ -273,6 +273,28 @@ static void region_scissor_winrct(ARegion *ar, rcti *winrct)
        }
 }
 
        }
 }
 
+/* only exported for WM */
+/* makes region ready for drawing, sets pixelspace */
+void ED_region_set(const bContext *C, ARegion *ar)
+{
+       wmWindow *win= CTX_wm_window(C);
+       ScrArea *sa= CTX_wm_area(C);
+       rcti winrct;
+       
+       /* checks other overlapping regions */
+       region_scissor_winrct(ar, &winrct);
+       
+       ar->drawrct= winrct;
+       
+       /* note; this sets state, so we can use wmOrtho and friends */
+       wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
+       
+       UI_SetTheme(sa?sa->spacetype:0, ar->type?ar->type->regionid:0);
+       
+       ED_region_pixelspace(ar);
+}
+
+
 /* only exported for WM */
 void ED_region_do_draw(bContext *C, ARegion *ar)
 {
 /* only exported for WM */
 void ED_region_do_draw(bContext *C, ARegion *ar)
 {
index ef89b2b35ada6cba6144075a6d8744f21999aefd..1df567e3c923e39ad58a78fd2c0fafea3628ff38 100644 (file)
@@ -574,8 +574,8 @@ static void wm_method_draw_triple(bContext *C, wmWindow *win)
                                        CTX_wm_area_set(C, sa);
                                        CTX_wm_region_set(C, ar);
 
                                        CTX_wm_area_set(C, sa);
                                        CTX_wm_region_set(C, ar);
 
-                                       wmSubWindowSet(win, ar->swinid);
-                                       ED_region_pixelspace(ar);
+                                       /* make region ready for draw, scissor, pixelspace */
+                                       ED_region_set(C, ar);
                                        wm_paintcursor_draw(C, ar);
 
                                        CTX_wm_region_set(C, NULL);
                                        wm_paintcursor_draw(C, ar);
 
                                        CTX_wm_region_set(C, NULL);
index c899d1d290e7d9c446bd012f065232ae9f3f1296..05471329f323d2d11fcd25d6ca464a11c614ea03 100644 (file)
@@ -236,7 +236,7 @@ static void wm_gesture_draw_cross(wmWindow *win, wmGesture *gt)
        glDisable(GL_LINE_STIPPLE);
 }
 
        glDisable(GL_LINE_STIPPLE);
 }
 
-/* called in wm_event_system.c */
+/* called in wm_draw.c */
 void wm_gesture_draw(wmWindow *win)
 {
        wmGesture *gt= (wmGesture *)win->gesture.first;
 void wm_gesture_draw(wmWindow *win)
 {
        wmGesture *gt= (wmGesture *)win->gesture.first;