[Bf-blender-cvs] [a9635c63842] master: Cleanup: rename set_inverted_drawing, move to GPU_state

Campbell Barton noreply at git.blender.org
Tue Jul 2 04:43:35 CEST 2019


Commit: a9635c63842d47009cbb9b9de7ca8afa112254bf
Author: Campbell Barton
Date:   Tue Jul 2 12:30:55 2019 +1000
Branches: master
https://developer.blender.org/rBa9635c63842d47009cbb9b9de7ca8afa112254bf

Cleanup: rename set_inverted_drawing, move to GPU_state

===================================================================

M	source/blender/draw/modes/edit_text_mode.c
M	source/blender/editors/include/BIF_glutil.h
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/transform/transform_constraints.c
M	source/blender/gpu/GPU_state.h
M	source/blender/gpu/intern/gpu_state.c

===================================================================

diff --git a/source/blender/draw/modes/edit_text_mode.c b/source/blender/draw/modes/edit_text_mode.c
index 03f26e8ce63..448dc33077e 100644
--- a/source/blender/draw/modes/edit_text_mode.c
+++ b/source/blender/draw/modes/edit_text_mode.c
@@ -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 */
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 7d4b6dbeea2..101a65d151a 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -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);
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index fc771e0db77..db44723fdb7 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -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;
diff --git a/source/blender/editors/transform/transform_constraints.c b/source/blender/editors/transform/transform_constraints.c
index 06851451461..cb539c8d1a5 100644
--- a/source/blender/editors/transform/transform_constraints.c
+++ b/source/blender/editors/transform/transform_constraints.c
@@ -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();
 
diff --git a/source/blender/gpu/GPU_state.h b/source/blender/gpu/GPU_state.h
index 7b970786e5e..efea02eb5a4 100644
--- a/source/blender/gpu/GPU_state.h
+++ b/source/blender/gpu/GPU_state.h
@@ -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__ */
diff --git a/source/blender/gpu/intern/gpu_state.c b/source/blender/gpu/intern/gpu_state.c
index 7a27fea2f0d..caf97a620ab 100644
--- a/source/blender/gpu/intern/gpu_state.c
+++ b/source/blender/gpu/intern/gpu_state.c
@@ -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);
+  }
+}



More information about the Bf-blender-cvs mailing list