diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-23 08:04:03 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-23 08:04:03 +0300 |
commit | 9282d305bdc56522543129436db1e8a5d19cf39f (patch) | |
tree | b6d0cdcc7dd3f4113cf9e4f9813c40f44d29746e /source/blender/editors/interface/interface_draw.c | |
parent | de724a258eda45d1fed2b2176006c3b2df8abea2 (diff) | |
parent | 646a96bf8edc211a06f3df652101c265ee166e8d (diff) |
Merge branch 'master' into texture_nodes_refactortexture_nodes_refactor
Conflicts:
source/blender/nodes/texture/nodes/node_texture_math.c
Diffstat (limited to 'source/blender/editors/interface/interface_draw.c')
-rw-r--r-- | source/blender/editors/interface/interface_draw.c | 73 |
1 files changed, 41 insertions, 32 deletions
diff --git a/source/blender/editors/interface/interface_draw.c b/source/blender/editors/interface/interface_draw.c index 235d7652539..bcd9b9a5547 100644 --- a/source/blender/editors/interface/interface_draw.c +++ b/source/blender/editors/interface/interface_draw.c @@ -62,7 +62,7 @@ static int roundboxtype = UI_CNR_ALL; -void uiSetRoundBox(int type) +void UI_draw_roundbox_corner_set(int type) { /* Not sure the roundbox function is the best place to change this * if this is undone, its not that big a deal, only makes curves edges @@ -71,12 +71,12 @@ void uiSetRoundBox(int type) } -int uiGetRoundBox(void) +int UI_draw_roundbox_corner_get(void) { return roundboxtype; } -void uiDrawBox(int mode, float minx, float miny, float maxx, float maxy, float rad) +void UI_draw_roundbox_gl_mode(int mode, float minx, float miny, float maxx, float maxy, float rad) { float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; @@ -152,7 +152,9 @@ static void round_box_shade_col(const float col1[3], float const col2[3], const /* linear horizontal shade within button or in outline */ /* view2d scrollers use it */ -void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, float rad, float shadetop, float shadedown) +void UI_draw_roundbox_shade_x( + int mode, float minx, float miny, float maxx, float maxy, + float rad, float shadetop, float shadedown) { float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; @@ -260,8 +262,9 @@ void uiDrawBoxShade(int mode, float minx, float miny, float maxx, float maxy, fl /* linear vertical shade within button or in outline */ /* view2d scrollers use it */ -void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, - float rad, float shadeLeft, float shadeRight) +void UI_draw_roundbox_shade_y( + int mode, float minx, float miny, float maxx, float maxy, + float rad, float shadeLeft, float shadeRight) { float vec[7][2] = {{0.195, 0.02}, {0.383, 0.067}, {0.55, 0.169}, {0.707, 0.293}, {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; @@ -365,7 +368,7 @@ void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float } /* plain antialiased unfilled rectangle */ -void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad) +void UI_draw_roundbox_unfilled(float minx, float miny, float maxx, float maxy, float rad) { float color[4]; @@ -380,18 +383,24 @@ void uiRoundRect(float minx, float miny, float maxx, float maxy, float rad) glEnable(GL_LINE_SMOOTH); glEnable(GL_BLEND); - uiDrawBox(GL_LINE_LOOP, minx, miny, maxx, maxy, rad); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, minx, miny, maxx, maxy, rad); glDisable(GL_BLEND); glDisable(GL_LINE_SMOOTH); } /* (old, used in outliner) plain antialiased filled box */ -void uiRoundBox(float minx, float miny, float maxx, float maxy, float rad) +void UI_draw_roundbox(float minx, float miny, float maxx, float maxy, float rad) { ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad, roundboxtype & UI_RB_ALPHA); } +void UI_draw_text_underline(int pos_x, int pos_y, int len, int height) +{ + int ofs_y = 4 * U.pixelsize; + glRecti(pos_x, pos_y - ofs_y, pos_x + len, pos_y - ofs_y + (height * U.pixelsize)); +} + /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect) @@ -450,8 +459,8 @@ static void draw_scope_end(const rctf *rect, GLint *scissor) /* outline */ glColor4f(0.f, 0.f, 0.f, 0.5f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_LINE_LOOP, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f); } static void histogram_draw_one(float r, float g, float b, float alpha, @@ -535,8 +544,8 @@ void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); /* need scissor test, histogram can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); @@ -622,8 +631,8 @@ void ui_draw_but_WAVEFORM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); /* need scissor test, waveform can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); @@ -841,8 +850,8 @@ void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wco glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); /* need scissor test, hvectorscope can draw outside of boundary */ glGetIntegerv(GL_VIEWPORT, scissor); @@ -1067,7 +1076,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti if (coba == NULL) return; if (but->block->color_profile) - display = ui_block_display_get(but->block); + display = ui_block_cm_display_get(but->block); x1 = rect->xmin; sizex = rect->xmax - x1; @@ -1158,7 +1167,7 @@ void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti } } -void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, const rcti *rect) +void ui_draw_but_UNITVEC(uiBut *but, uiWidgetColors *wcol, const rcti *rect) { static GLuint displist = 0; int a, old[8]; @@ -1171,8 +1180,8 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, const rcti *rect) /* backdrop */ glColor3ubv((unsigned char *)wcol->inner); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); /* sphere color */ glMaterialfv(GL_FRONT, GL_DIFFUSE, diffn); @@ -1189,7 +1198,7 @@ void ui_draw_but_NORMAL(uiBut *but, uiWidgetColors *wcol, const rcti *rect) glEnable(GL_LIGHT7); glEnable(GL_LIGHTING); - ui_get_but_vectorf(but, dir); + ui_but_v3_get(but, dir); dir[3] = 0.0f; /* glLightfv needs 4 args, 0.0 is sun */ glLightfv(GL_LIGHT7, GL_POSITION, dir); @@ -1511,8 +1520,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc if (scopes->track_disabled) { glColor4f(0.7f, 0.3f, 0.3f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); ok = 1; } @@ -1559,8 +1568,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc if (scopes->use_track_mask) { glColor4f(0.0f, 0.0f, 0.0f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); } glaDrawPixelsSafe(rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, @@ -1600,8 +1609,8 @@ void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wc if (!ok) { glColor4f(0.f, 0.f, 0.f, 0.3f); - uiSetRoundBox(UI_CNR_ALL); - uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); + UI_draw_roundbox_corner_set(UI_CNR_ALL); + UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); } /* outline */ @@ -1717,7 +1726,7 @@ static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float s glShadeModel(GL_FLAT); } -void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) +void UI_draw_box_shadow(unsigned char alpha, float minx, float miny, float maxx, float maxy) { /* accumulated outline boxes to make shade not linear, is more pleasant */ ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8); @@ -1727,7 +1736,7 @@ void uiDrawBoxShadow(unsigned char alpha, float minx, float miny, float maxx, fl } -void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select)) +void ui_draw_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int UNUSED(select)) { int i; float rad; @@ -1758,13 +1767,13 @@ void ui_dropshadow(const rctf *rct, float radius, float aspect, float alpha, int glColor4f(0.0f, 0.0f, 0.0f, calpha); calpha += dalpha; - uiDrawBox(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a); + UI_draw_roundbox_gl_mode(GL_POLYGON, rct->xmin - a, rct->ymin - a, rct->xmax + a, rct->ymax - 10.0f + a, rad + a); } /* outline emphasis */ glEnable(GL_LINE_SMOOTH); glColor4ub(0, 0, 0, 100); - uiDrawBox(GL_LINE_LOOP, rct->xmin - 0.5f, rct->ymin - 0.5f, rct->xmax + 0.5f, rct->ymax + 0.5f, radius + 0.5f); + UI_draw_roundbox_gl_mode(GL_LINE_LOOP, rct->xmin - 0.5f, rct->ymin - 0.5f, rct->xmax + 0.5f, rct->ymax + 0.5f, radius + 0.5f); glDisable(GL_LINE_SMOOTH); glDisable(GL_BLEND); |