diff options
author | Luca Rood <dev@lucarood.com> | 2017-02-24 06:16:46 +0300 |
---|---|---|
committer | Luca Rood <dev@lucarood.com> | 2017-02-24 07:09:50 +0300 |
commit | 4c6190d08f00d48cbfb6ec8b0bbc3edf18c2152b (patch) | |
tree | 75c8f4a10e38a956ffae464bba12aa49d23b1005 /source/blender/editors/screen/glutil.c | |
parent | c2453007f4f61c2dda84a6a9dda0f9d275659f3f (diff) |
Add immDrawBorderCorners function
This replaces `glaDrawBorderCorners`.
Diffstat (limited to 'source/blender/editors/screen/glutil.c')
-rw-r--r-- | source/blender/editors/screen/glutil.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c index 1b321c220a1..a4befa48eed 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(); +} |