diff options
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index f31d79ff76b..0edde66ffff 100644 --- a/source/blender/editors/screen/glutil.c +++ b/source/blender/editors/screen/glutil.c @@ -50,6 +50,8 @@ #include "IMB_colormanagement.h" #include "IMB_imbuf_types.h" +#include "UI_interface.h" + #ifndef GL_CLAMP_TO_EDGE #define GL_CLAMP_TO_EDGE 0x812F #endif @@ -1139,3 +1141,40 @@ void cpack(unsigned int x) (((x) >> 8) & 0xFF), (((x) >> 16) & 0xFF) ); } + +void glaDrawBorderCorners(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 */ + glBegin(GL_LINE_STRIP); + glVertex2f(border->xmin, border->ymin + delta_y); + glVertex2f(border->xmin, border->ymin); + glVertex2f(border->xmin + delta_x, border->ymin); + glEnd(); + + /* left top corner */ + glBegin(GL_LINE_STRIP); + glVertex2f(border->xmin, border->ymax - delta_y); + glVertex2f(border->xmin, border->ymax); + glVertex2f(border->xmin + delta_x, border->ymax); + glEnd(); + + /* right bottom corner */ + glBegin(GL_LINE_STRIP); + glVertex2f(border->xmax - delta_x, border->ymin); + glVertex2f(border->xmax, border->ymin); + glVertex2f(border->xmax, border->ymin + delta_y); + glEnd(); + + /* right top corner */ + glBegin(GL_LINE_STRIP); + glVertex2f(border->xmax - delta_x, border->ymax); + glVertex2f(border->xmax, border->ymax); + glVertex2f(border->xmax, border->ymax - delta_y); + glEnd(); +} |