[Bf-blender-cvs] [4c6190d08f] blender2.8: Add immDrawBorderCorners function

Luca Rood noreply at git.blender.org
Fri Feb 24 05:14:03 CET 2017


Commit: 4c6190d08f00d48cbfb6ec8b0bbc3edf18c2152b
Author: Luca Rood
Date:   Fri Feb 24 00:16:46 2017 -0300
Branches: blender2.8
https://developer.blender.org/rB4c6190d08f00d48cbfb6ec8b0bbc3edf18c2152b

Add immDrawBorderCorners function

This replaces `glaDrawBorderCorners`.

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

M	source/blender/editors/include/BIF_glutil.h
M	source/blender/editors/screen/glutil.c

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

diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index b81c7a8dcf..a3161b49d4 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -320,5 +320,7 @@ void glaDrawImBuf_glsl_ctx_clipping(const struct bContext *C,
 
 void glaDrawBorderCorners(const struct rcti *border, float zoomx, float zoomy);
 
+void immDrawBorderCorners(unsigned int pos, const struct rcti *border, float zoomx, float zoomy);
+
 #endif /* __BIF_GLUTIL_H__ */
 
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 1b321c220a..a4befa48ee 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -1172,6 +1172,7 @@ void cpack(unsigned int x)
 
 void glaDrawBorderCorners(const rcti *border, float zoomx, float zoomy)
 {
+	/* DEPRECATED: use immDrawBorderCorners */
 	float delta_x = 4.0f * UI_DPI_FAC / zoomx;
 	float delta_y = 4.0f * UI_DPI_FAC / zoomy;
 
@@ -1206,3 +1207,40 @@ void glaDrawBorderCorners(const rcti *border, float zoomx, float zoomy)
 	glVertex2f(border->xmax, border->ymax - delta_y);
 	glEnd();
 }
+
+void immDrawBorderCorners(unsigned int pos, const rcti *border, float zoomx, float zoomy)
+{
+	float delta_x = 4.0f * UI_DPI_FAC / zoomx;
+	float delta_y = 4.0f * UI_DPI_FAC / zoomy;
+
+	delta_x = min_ff(delta_x, border->xmax - border->xmin);
+	delta_y = min_ff(delta_y, border->ymax - border->ymin);
+
+	/* left bottom corner */
+	immBegin(GL_LINE_STRIP, 3);
+	immVertex2f(pos, border->xmin, border->ymin + delta_y);
+	immVertex2f(pos, border->xmin, border->ymin);
+	immVertex2f(pos, border->xmin + delta_x, border->ymin);
+	immEnd();
+
+	/* left top corner */
+	immBegin(GL_LINE_STRIP, 3);
+	immVertex2f(pos, border->xmin, border->ymax - delta_y);
+	immVertex2f(pos, border->xmin, border->ymax);
+	immVertex2f(pos, border->xmin + delta_x, border->ymax);
+	immEnd();
+
+	/* right bottom corner */
+	immBegin(GL_LINE_STRIP, 3);
+	immVertex2f(pos, border->xmax - delta_x, border->ymin);
+	immVertex2f(pos, border->xmax, border->ymin);
+	immVertex2f(pos, border->xmax, border->ymin + delta_y);
+	immEnd();
+
+	/* right top corner */
+	immBegin(GL_LINE_STRIP, 3);
+	immVertex2f(pos, border->xmax - delta_x, border->ymax);
+	immVertex2f(pos, border->xmax, border->ymax);
+	immVertex2f(pos, border->xmax, border->ymax - delta_y);
+	immEnd();
+}




More information about the Bf-blender-cvs mailing list