Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/blender/editors/screen/area.c12
-rw-r--r--source/blender/windowmanager/WM_api.h2
-rw-r--r--source/blender/windowmanager/intern/wm_draw.c2
-rw-r--r--source/blender/windowmanager/intern/wm_subwindow.c16
4 files changed, 22 insertions, 10 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c
index 27b519c4355..e805b3f30fc 100644
--- a/source/blender/editors/screen/area.c
+++ b/source/blender/editors/screen/area.c
@@ -387,7 +387,7 @@ void ED_region_set(const bContext *C, ARegion *ar)
ar->drawrct = ar->winrct;
/* note; this sets state, so we can use wmOrtho and friends */
- wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
+ wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct, true);
UI_SetTheme(sa ? sa->spacetype : 0, ar->type ? ar->type->regionid : 0);
@@ -401,21 +401,25 @@ void ED_region_do_draw(bContext *C, ARegion *ar)
wmWindow *win = CTX_wm_window(C);
ScrArea *sa = CTX_wm_area(C);
ARegionType *at = ar->type;
-
+ bool scissor_pad;
+
/* see BKE_spacedata_draw_locks() */
if (at->do_lock)
return;
/* if no partial draw rect set, full rect */
- if (ar->drawrct.xmin == ar->drawrct.xmax)
+ if (ar->drawrct.xmin == ar->drawrct.xmax) {
ar->drawrct = ar->winrct;
+ scissor_pad = true;
+ }
else {
/* extra clip for safety */
BLI_rcti_isect(&ar->winrct, &ar->drawrct, &ar->drawrct);
+ scissor_pad = false;
}
/* note; this sets state, so we can use wmOrtho and friends */
- wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct);
+ wmSubWindowScissorSet(win, ar->swinid, &ar->drawrct, scissor_pad);
UI_SetTheme(sa ? sa->spacetype : 0, at->regionid);
diff --git a/source/blender/windowmanager/WM_api.h b/source/blender/windowmanager/WM_api.h
index 76fb88c8d25..8894be111e7 100644
--- a/source/blender/windowmanager/WM_api.h
+++ b/source/blender/windowmanager/WM_api.h
@@ -342,7 +342,7 @@ ListBase *WM_dropboxmap_find(const char *idname, int spaceid, int regionid);
/* Set a subwindow active in pixelspace view, with optional scissor subset */
void wmSubWindowSet (struct wmWindow *win, int swinid);
-void wmSubWindowScissorSet (struct wmWindow *win, int swinid, struct rcti *srct);
+void wmSubWindowScissorSet (struct wmWindow *win, int swinid, const struct rcti *srct, bool srct_pad);
/* OpenGL utilities with safety check + working in modelview matrix mode */
void wmFrustum (float x1, float x2, float y1, float y2, float n, float f);
diff --git a/source/blender/windowmanager/intern/wm_draw.c b/source/blender/windowmanager/intern/wm_draw.c
index 3e9dc0f10c8..dac62d624b5 100644
--- a/source/blender/windowmanager/intern/wm_draw.c
+++ b/source/blender/windowmanager/intern/wm_draw.c
@@ -569,7 +569,7 @@ static void wm_draw_region_blend(wmWindow *win, ARegion *ar)
/* region blend always is 1, except when blend timer is running */
if (fac < 1.0f) {
- wmSubWindowScissorSet(win, win->screen->mainwin, &ar->winrct);
+ wmSubWindowScissorSet(win, win->screen->mainwin, &ar->winrct, true);
glEnable(GL_BLEND);
wm_triple_draw_textures(win, win->drawdata, 1.0f - fac);
diff --git a/source/blender/windowmanager/intern/wm_subwindow.c b/source/blender/windowmanager/intern/wm_subwindow.c
index 01bebe8a1b8..4ad4286b657 100644
--- a/source/blender/windowmanager/intern/wm_subwindow.c
+++ b/source/blender/windowmanager/intern/wm_subwindow.c
@@ -239,7 +239,7 @@ void wm_subwindow_position(wmWindow *win, int swinid, rcti *winrct)
static wmWindow *_curwindow = NULL;
static wmSubWindow *_curswin = NULL;
-void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
+void wmSubWindowScissorSet(wmWindow *win, int swinid, const rcti *srct, bool srct_pad)
{
int width, height;
_curswin = swin_from_swinid(win, swinid);
@@ -257,8 +257,16 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
glViewport(_curswin->winrct.xmin, _curswin->winrct.ymin, width, height);
if (srct) {
- int scissor_width = BLI_rcti_size_x(srct) + 1; /* only here */
- int scissor_height = BLI_rcti_size_y(srct) + 1;
+ int scissor_width = BLI_rcti_size_x(srct);
+ int scissor_height = BLI_rcti_size_y(srct);
+
+ /* typically a single pixel doesn't matter,
+ * but one pixel offset is noticable with viewport border render */
+ if (srct_pad) {
+ scissor_width += 1;
+ scissor_height += 1;
+ }
+
glScissor(srct->xmin, srct->ymin, scissor_width, scissor_height);
}
else
@@ -273,7 +281,7 @@ void wmSubWindowScissorSet(wmWindow *win, int swinid, rcti *srct)
/* enable the WM versions of opengl calls */
void wmSubWindowSet(wmWindow *win, int swinid)
{
- wmSubWindowScissorSet(win, swinid, NULL);
+ wmSubWindowScissorSet(win, swinid, NULL, true);
}
void wmFrustum(float x1, float x2, float y1, float y2, float n, float f)