Cleanup: rename set_inverted_drawing, move to GPU_state

This commit is contained in:
2019-07-02 12:30:55 +10:00
parent 1278853849
commit a9635c6384
6 changed files with 20 additions and 17 deletions

View File

@@ -383,10 +383,10 @@ static void EDIT_TEXT_draw_scene(void *vedata)
DRW_draw_pass(psl->text_box_pass);
}
set_inverted_drawing(1);
GPU_logic_op_invert_set(true);
DRW_draw_pass(psl->overlay_select_pass);
DRW_draw_pass(psl->overlay_cursor_pass);
set_inverted_drawing(0);
GPU_logic_op_invert_set(false);
/* If you changed framebuffer, double check you rebind
* the default one with its textures attached before finishing */

View File

@@ -172,8 +172,6 @@ int ED_draw_imbuf_method(struct ImBuf *ibuf);
/* OpenGL drawing utility functions. Do not use these in new code, these
* are intended to be moved or removed in the future. */
void set_inverted_drawing(int enable);
/* own working polygon offset */
float bglPolygonOffsetCalc(const float winmat[16], float viewdist, float dist);
void bglPolygonOffset(float viewdist, float dist);

View File

@@ -47,17 +47,6 @@
/* ******************************************** */
/* Invert line handling */
#define GL_TOGGLE(mode, onoff) (((onoff) ? glEnable : glDisable)(mode))
void set_inverted_drawing(int enable)
{
glLogicOp(enable ? GL_INVERT : GL_COPY);
GL_TOGGLE(GL_COLOR_LOGIC_OP, enable);
GL_TOGGLE(GL_DITHER, !enable);
}
static int get_cached_work_texture(int *r_w, int *r_h)
{
static GLint texid = -1;

View File

@@ -863,9 +863,9 @@ void drawPropCircle(const struct bContext *C, TransInfo *t)
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_GRID);
set_inverted_drawing(1);
GPU_logic_op_invert_set(true);
imm_drawcircball(t->center_global, t->prop_size, imat, pos);
set_inverted_drawing(0);
GPU_logic_op_invert_set(false);
immUnbindProgram();

View File

@@ -59,4 +59,6 @@ void GPU_viewport_size_get_i(int coords[4]);
void GPU_flush(void);
void GPU_finish(void);
void GPU_logic_op_invert_set(bool enable);
#endif /* __GPU_STATE_H__ */

View File

@@ -175,3 +175,17 @@ void GPU_finish(void)
{
glFinish();
}
void GPU_logic_op_invert_set(bool enable)
{
if (enable) {
glLogicOp(GL_INVERT);
glEnable(GL_COLOR_LOGIC_OP);
glDisable(GL_DITHER);
}
else {
glLogicOp(GL_COPY);
glDisable(GL_COLOR_LOGIC_OP);
glEnable(GL_DITHER);
}
}