[Bf-blender-cvs] [ed0c9654ddf] master: Cleanup: remove unused OpenGL functions, rename some for clarity

Brecht Van Lommel noreply at git.blender.org
Sat Apr 20 13:33:28 CEST 2019


Commit: ed0c9654ddfdcbe19d8094d4b4a43f0f06d9ee5c
Author: Brecht Van Lommel
Date:   Sat Apr 20 12:56:29 2019 +0200
Branches: master
https://developer.blender.org/rBed0c9654ddfdcbe19d8094d4b4a43f0f06d9ee5c

Cleanup: remove unused OpenGL functions, rename some for clarity

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

M	source/blender/editors/include/BIF_glutil.h
M	source/blender/editors/screen/glutil.c
M	source/blender/editors/space_clip/clip_draw.c
M	source/blender/editors/space_image/image_draw.c
M	source/blender/editors/space_node/drawnode.c
M	source/blender/imbuf/intern/colormanagement.c

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

diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index a2e8d6afd4b..c30674907da 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -32,35 +32,6 @@ struct ColorManagedViewSettings;
 struct ImBuf;
 struct bContext;
 
-/* A few functions defined here are being DEPRECATED for Blender 2.8
- *
- * Do not use them in new code, and you are encouraged to
- * convert existing code to draw without these.
- *
- * These will be deleted before we ship 2.8!
- * - merwin
- */
-
-/**
- * Returns a float value as obtained by glGetFloatv.
- * The param must cause only one value to be gotten from GL.
- */
-float glaGetOneFloat(int param);
-int glaGetOneInt(int param);
-
-/**
- * Functions like glRasterPos2i, except ensures that the resulting
- * raster position is valid. \a known_good_x and \a known_good_y
- * should be coordinates of a point known to be within the current
- * view frustum.
- * \attention This routine should be used when the distance of \a x
- * and \a y away from the known good point is small (ie. for small icons
- * and for bitmap characters), when drawing large+zoomed images it is
- * possible for overflow to occur, the glaDrawPixelsSafe routine should
- * be used instead.
- */
-void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y);
-
 typedef struct IMMDrawPixelsTexState {
   struct GPUShader *shader;
   unsigned int pos;
@@ -148,29 +119,47 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
                                      float yzoom,
                                      float color[4]);
 
-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);
-
-/* **** Color management helper functions for GLSL display/transform ***** */
-
-/* Draw imbuf on a screen, preferably using GLSL display transform */
-void glaDrawImBuf_glsl(struct ImBuf *ibuf,
+/* Image buffer drawing functions, with display transform
+ *
+ * The view and display settings can either be specified manually, or retrived
+ * from the context with the _ctx variations.
+ *
+ * For better performance clipping coordinates can be specified so parts of the
+ * image outside the view are skipped. */
+
+void ED_draw_imbuf(struct ImBuf *ibuf,
+                   float x,
+                   float y,
+                   int zoomfilter,
+                   struct ColorManagedViewSettings *view_settings,
+                   struct ColorManagedDisplaySettings *display_settings,
+                   float zoom_x,
+                   float zoom_y);
+void ED_draw_imbuf_clipping(struct ImBuf *ibuf,
+                            float x,
+                            float y,
+                            int zoomfilter,
+                            struct ColorManagedViewSettings *view_settings,
+                            struct ColorManagedDisplaySettings *display_settings,
+                            float clip_min_x,
+                            float clip_min_y,
+                            float clip_max_x,
+                            float clip_max_y,
+                            float zoom_x,
+                            float zoom_y);
+
+void ED_draw_imbuf_ctx(const struct bContext *C,
+                       struct ImBuf *ibuf,
                        float x,
                        float y,
                        int zoomfilter,
-                       struct ColorManagedViewSettings *view_settings,
-                       struct ColorManagedDisplaySettings *display_settings,
                        float zoom_x,
                        float zoom_y);
-void glaDrawImBuf_glsl_clipping(struct ImBuf *ibuf,
+void ED_draw_imbuf_ctx_clipping(const struct bContext *C,
+                                struct ImBuf *ibuf,
                                 float x,
                                 float y,
                                 int zoomfilter,
-                                struct ColorManagedViewSettings *view_settings,
-                                struct ColorManagedDisplaySettings *display_settings,
                                 float clip_min_x,
                                 float clip_min_y,
                                 float clip_max_x,
@@ -178,25 +167,14 @@ void glaDrawImBuf_glsl_clipping(struct ImBuf *ibuf,
                                 float zoom_x,
                                 float zoom_y);
 
-/* Draw imbuf on a screen, preferably using GLSL display transform */
-void glaDrawImBuf_glsl_ctx(const struct bContext *C,
-                           struct ImBuf *ibuf,
-                           float x,
-                           float y,
-                           int zoomfilter,
-                           float zoom_x,
-                           float zoom_y);
-void glaDrawImBuf_glsl_ctx_clipping(const struct bContext *C,
-                                    struct ImBuf *ibuf,
-                                    float x,
-                                    float y,
-                                    int zoomfilter,
-                                    float clip_min_x,
-                                    float clip_min_y,
-                                    float clip_max_x,
-                                    float clip_max_y,
-                                    float zoom_x,
-                                    float zoom_y);
+/* 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);
 
 void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy);
 
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 7fec62157c1..868bc982c51 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -58,37 +58,6 @@ void set_inverted_drawing(int enable)
   GL_TOGGLE(GL_DITHER, !enable);
 }
 
-float glaGetOneFloat(int param)
-{
-  GLfloat v;
-  glGetFloatv(param, &v);
-  return v;
-}
-
-int glaGetOneInt(int param)
-{
-  GLint v;
-  glGetIntegerv(param, &v);
-  return v;
-}
-
-void glaRasterPosSafe2f(float x, float y, float known_good_x, float known_good_y)
-{
-  GLubyte dummy = 0;
-
-  /* As long as known good coordinates are correct
-   * this is guaranteed to generate an ok raster
-   * position (ignoring potential (real) overflow
-   * issues).
-   */
-  glRasterPos2f(known_good_x, known_good_y);
-
-  /* Now shift the raster position to where we wanted
-   * it in the first place using the glBitmap trick.
-   */
-  glBitmap(0, 0, 0, 0, x - known_good_x, y - known_good_y, &dummy);
-}
-
 static int get_cached_work_texture(int *r_w, int *r_h)
 {
   static GLint texid = -1;
@@ -564,18 +533,18 @@ void bglPolygonOffset(float viewdist, float dist)
 /* **** Color management helper functions for GLSL display/transform ***** */
 
 /* Draw given image buffer on a screen using GLSL for display transform */
-void glaDrawImBuf_glsl_clipping(ImBuf *ibuf,
-                                float x,
-                                float y,
-                                int zoomfilter,
-                                ColorManagedViewSettings *view_settings,
-                                ColorManagedDisplaySettings *display_settings,
-                                float clip_min_x,
-                                float clip_min_y,
-                                float clip_max_x,
-                                float clip_max_y,
-                                float zoom_x,
-                                float zoom_y)
+void ED_draw_imbuf_clipping(ImBuf *ibuf,
+                            float x,
+                            float y,
+                            int zoomfilter,
+                            ColorManagedViewSettings *view_settings,
+                            ColorManagedDisplaySettings *display_settings,
+                            float clip_min_x,
+                            float clip_min_y,
+                            float clip_max_x,
+                            float clip_max_y,
+                            float zoom_x,
+                            float zoom_y)
 {
   bool force_fallback = false;
   bool need_fallback = true;
@@ -702,65 +671,64 @@ void glaDrawImBuf_glsl_clipping(ImBuf *ibuf,
   }
 }
 
-void glaDrawImBuf_glsl(ImBuf *ibuf,
-                       float x,
-                       float y,
-                       int zoomfilter,
-                       ColorManagedViewSettings *view_settings,
-                       ColorManagedDisplaySettings *display_settings,
-                       float zoom_x,
-                       float zoom_y)
+void ED_draw_imbuf(ImBuf *ibuf,
+                   float x,
+                   float y,
+                   int zoomfilter,
+                   ColorManagedViewSettings *view_settings,
+                   ColorManagedDisplaySettings *display_settings,
+                   float zoom_x,
+                   float zoom_y)
 {
-  glaDrawImBuf_glsl_clipping(ibuf,
-                             x,
-                             y,
-                             zoomfilter,
-                             view_settings,
-                             display_settings,
-                             0.0f,
-                             0.0f,
-                             0.0f,
-                             0.0f,
-                             zoom_x,
-                             zoom_y);
+  ED_draw_imbuf_clipping(ibuf,
+                         x,
+                         y,
+                         zoomfilter,
+                         view_settings,
+                         display_settings,
+                         0.0f,
+                         0.0f,
+                         0.0f,
+                         0.0f,
+                         zoom_x,
+                         zoom_y);
 }
 

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list