diff options
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 37 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 2 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 4 | ||||
-rw-r--r-- | source/blender/gpu/GPU_state.h | 3 | ||||
-rw-r--r-- | source/blender/gpu/intern/gpu_state.cc | 7 |
5 files changed, 27 insertions, 26 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index fb09320a0f2..0a40c39851a 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -748,7 +748,7 @@ void ui_draw_but_IMAGE(ARegion *UNUSED(region), # if 0 /* prevent drawing outside widget area */ int scissor[4]; - GPU_scissor_get_i(scissor); + GPU_scissor_get(scissor); GPU_scissor(rect->xmin, rect->ymin, w, h); # endif @@ -830,11 +830,8 @@ void UI_draw_safe_areas(uint pos, } } -static void draw_scope_end(const rctf *rect, GLint *scissor) +static void draw_scope_end(const rctf *rect) { - /* Restore scissor test. */ - GPU_scissor(scissor[0], scissor[1], scissor[2], scissor[3]); - GPU_blend_set_func_separate( GPU_SRC_ALPHA, GPU_ONE_MINUS_SRC_ALPHA, GPU_ONE, GPU_ONE_MINUS_SRC_ALPHA); @@ -942,7 +939,7 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region), /* need scissor test, histogram can draw outside of boundary */ int scissor[4]; - GPU_scissor_get_i(scissor); + GPU_scissor_get(scissor); GPU_scissor((rect.xmin - 1), (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), @@ -999,8 +996,11 @@ void ui_draw_but_HISTOGRAM(ARegion *UNUSED(region), immUnbindProgram(); + /* Restore scissor test. */ + GPU_scissor(UNPACK4(scissor)); + /* outline */ - draw_scope_end(&rect, scissor); + draw_scope_end(&rect); } #undef HISTOGRAM_TOT_GRID_LINES @@ -1082,7 +1082,7 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region), true, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f, color); /* need scissor test, waveform can draw outside of boundary */ - GPU_scissor_get_i(scissor); + GPU_scissor_get(scissor); GPU_scissor((rect.xmin - 1), (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), @@ -1257,8 +1257,11 @@ void ui_draw_but_WAVEFORM(ARegion *UNUSED(region), immUnbindProgram(); + /* Restore scissor test. */ + GPU_scissor(UNPACK4(scissor)); + /* outline */ - draw_scope_end(&rect, scissor); + draw_scope_end(&rect); GPU_blend(false); } @@ -1413,7 +1416,7 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region), /* need scissor test, hvectorscope can draw outside of boundary */ int scissor[4]; - GPU_scissor_get_i(scissor); + GPU_scissor_get(scissor); GPU_scissor((rect.xmin - 1), (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), @@ -1481,8 +1484,10 @@ void ui_draw_but_VECTORSCOPE(ARegion *UNUSED(region), immUnbindProgram(); + /* Restore scissor test. */ + GPU_scissor(UNPACK4(scissor)); /* outline */ - draw_scope_end(&rect, scissor); + draw_scope_end(&rect); GPU_blend(false); } @@ -1917,7 +1922,7 @@ void ui_draw_but_CURVE(ARegion *region, uiBut *but, const uiWidgetColors *wcol, /* need scissor test, curve can draw outside of boundary */ int scissor[4]; - GPU_scissor_get_i(scissor); + GPU_scissor_get(scissor); rcti scissor_new = { .xmin = rect->xmin, .ymin = rect->ymin, @@ -2194,7 +2199,7 @@ void ui_draw_but_CURVEPROFILE(ARegion *region, /* Test needed because path can draw outside of boundary. */ int scissor[4]; - GPU_scissor_get_i(scissor); + GPU_scissor_get(scissor); rcti scissor_new = { .xmin = rect->xmin, .ymin = rect->ymin, @@ -2468,7 +2473,7 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region), /* need scissor test, preview image can draw outside of boundary */ int scissor[4]; - GPU_scissor_get_i(scissor); + GPU_scissor_get(scissor); GPU_scissor((rect.xmin - 1), (rect.ymin - 1), (rect.xmax + 1) - (rect.xmin - 1), @@ -2593,8 +2598,10 @@ void ui_draw_but_TRACKPREVIEW(ARegion *UNUSED(region), true, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f, color); } + /* Restore scissor test. */ + GPU_scissor(UNPACK4(scissor)); /* outline */ - draw_scope_end(&rect, scissor); + draw_scope_end(&rect); GPU_blend(false); } diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 02a1e1fa2f6..267fc441f20 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -3270,7 +3270,7 @@ void ED_region_info_draw_multiline(ARegion *region, rect.ymin = rect.ymax - header_height * num_lines; /* setup scissor */ - GPU_scissor_get_i(scissor); + GPU_scissor_get(scissor); GPU_scissor(rect.xmin, rect.ymin, BLI_rcti_size_x(&rect) + 1, BLI_rcti_size_y(&rect) + 1); GPU_blend(true); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index 28e233b6dd2..6a91a8f7b49 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -3508,12 +3508,12 @@ static void outliner_draw_tree(bContext *C, outliner_draw_highlights(region, space_outliner, startx, &starty); /* set scissor so tree elements or lines can't overlap restriction icons */ - float scissor[4] = {0}; + int scissor[4] = {0}; if (restrict_column_width > 0.0f) { int mask_x = BLI_rcti_size_x(®ion->v2d.mask) - (int)restrict_column_width + 1; CLAMP_MIN(mask_x, 0); - GPU_scissor_get_f(scissor); + GPU_scissor_get(scissor); GPU_scissor(0, 0, mask_x, region->winy); } diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h index 4a2c90e241b..2a940b97104 100644 --- a/source/blender/gpu/GPU_state.h +++ b/source/blender/gpu/GPU_state.h @@ -75,8 +75,7 @@ void GPU_point_size(float size); void GPU_polygon_smooth(bool enable); void GPU_program_point_size(bool enable); void GPU_scissor(int x, int y, int width, int height); -void GPU_scissor_get_f(float coords[4]); -void GPU_scissor_get_i(int coords[4]); +void GPU_scissor_get(int coords[4]); void GPU_viewport(int x, int y, int width, int height); void GPU_viewport_size_get_f(float coords[4]); void GPU_viewport_size_get_i(int coords[4]); diff --git a/source/blender/gpu/intern/gpu_state.cc b/source/blender/gpu/intern/gpu_state.cc index 794c7a3eb97..d697b465458 100644 --- a/source/blender/gpu/intern/gpu_state.cc +++ b/source/blender/gpu/intern/gpu_state.cc @@ -188,12 +188,7 @@ void GPU_viewport(int x, int y, int width, int height) glViewport(x, y, width, height); } -void GPU_scissor_get_f(float coords[4]) -{ - glGetFloatv(GL_SCISSOR_BOX, coords); -} - -void GPU_scissor_get_i(int coords[4]) +void GPU_scissor_get(int coords[4]) { glGetIntegerv(GL_SCISSOR_BOX, coords); } |