diff options
author | Campbell Barton <ideasman42@gmail.com> | 2013-08-05 08:52:27 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2013-08-05 08:52:27 +0400 |
commit | 0395b8eee8aeaac33d42e0e560412baebacc6248 (patch) | |
tree | c464ec302888052611568d4a065ea49e55c9cd5f /source/blender/windowmanager/intern/wm_subwindow.c | |
parent | 37ff3a0e8a3d47943d8f73a21f0551dfc5587009 (diff) |
border render with cycles had 1 pixel offset on the top-right edge of the image, issue was caused by wmSubWindowScissorSet adding 1 to the ar->drawrct, now only add the padding when drawing the entire area
Diffstat (limited to 'source/blender/windowmanager/intern/wm_subwindow.c')
-rw-r--r-- | source/blender/windowmanager/intern/wm_subwindow.c | 16 |
1 files changed, 12 insertions, 4 deletions
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) |