Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/interface_draw.c
| Show First 20 Lines • Show All 56 Lines • ▼ Show 20 Lines | |||||
| #include "UI_interface.h" | #include "UI_interface.h" | ||||
| /* own include */ | /* own include */ | ||||
| #include "interface_intern.h" | #include "interface_intern.h" | ||||
| static int roundboxtype = UI_CNR_ALL; | 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 | /* 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 | * if this is undone, its not that big a deal, only makes curves edges | ||||
| * square for the */ | * square for the */ | ||||
| roundboxtype = type; | roundboxtype = type; | ||||
| } | } | ||||
| int uiGetRoundBox(void) | int UI_draw_roundbox_corner_get(void) | ||||
| { | { | ||||
| return roundboxtype; | 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}, | 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}}; | {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; | ||||
| int a; | int a; | ||||
| /* mult */ | /* mult */ | ||||
| for (a = 0; a < 7; a++) { | for (a = 0; a < 7; a++) { | ||||
| mul_v2_fl(vec[a], rad); | mul_v2_fl(vec[a], rad); | ||||
| ▲ Show 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | static void round_box_shade_col(const float col1[3], float const col2[3], const float fac) | ||||
| col[0] = (fac * col1[0] + (1.0f - fac) * col2[0]); | col[0] = (fac * col1[0] + (1.0f - fac) * col2[0]); | ||||
| col[1] = (fac * col1[1] + (1.0f - fac) * col2[1]); | col[1] = (fac * col1[1] + (1.0f - fac) * col2[1]); | ||||
| col[2] = (fac * col1[2] + (1.0f - fac) * col2[2]); | col[2] = (fac * col1[2] + (1.0f - fac) * col2[2]); | ||||
| glColor3fv(col); | glColor3fv(col); | ||||
| } | } | ||||
| /* linear horizontal shade within button or in outline */ | /* linear horizontal shade within button or in outline */ | ||||
| /* view2d scrollers use it */ | /* 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}, | 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}}; | {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; | ||||
| const float div = maxy - miny; | const float div = maxy - miny; | ||||
| const float idiv = 1.0f / div; | const float idiv = 1.0f / div; | ||||
| float coltop[3], coldown[3], color[4]; | float coltop[3], coldown[3], color[4]; | ||||
| int a; | int a; | ||||
| ▲ Show 20 Lines • Show All 91 Lines • ▼ Show 20 Lines | void UI_draw_roundbox_shade_x( | ||||
| } | } | ||||
| glEnd(); | glEnd(); | ||||
| glShadeModel(GL_FLAT); | glShadeModel(GL_FLAT); | ||||
| } | } | ||||
| /* linear vertical shade within button or in outline */ | /* linear vertical shade within button or in outline */ | ||||
| /* view2d scrollers use it */ | /* view2d scrollers use it */ | ||||
| void uiDrawBoxVerticalShade(int mode, float minx, float miny, float maxx, float maxy, | void UI_draw_roundbox_shade_y( | ||||
| int mode, float minx, float miny, float maxx, float maxy, | |||||
| float rad, float shadeLeft, float shadeRight) | 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}, | 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}}; | {0.831, 0.45}, {0.924, 0.617}, {0.98, 0.805}}; | ||||
| const float div = maxx - minx; | const float div = maxx - minx; | ||||
| const float idiv = 1.0f / div; | const float idiv = 1.0f / div; | ||||
| float colLeft[3], colRight[3], color[4]; | float colLeft[3], colRight[3], color[4]; | ||||
| int a; | int a; | ||||
| ▲ Show 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | else { | ||||
| glVertex2f(minx, miny); | glVertex2f(minx, miny); | ||||
| } | } | ||||
| glEnd(); | glEnd(); | ||||
| glShadeModel(GL_FLAT); | glShadeModel(GL_FLAT); | ||||
| } | } | ||||
| /* plain antialiased unfilled rectangle */ | /* 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]; | float color[4]; | ||||
| if (roundboxtype & UI_RB_ALPHA) { | if (roundboxtype & UI_RB_ALPHA) { | ||||
| glGetFloatv(GL_CURRENT_COLOR, color); | glGetFloatv(GL_CURRENT_COLOR, color); | ||||
| color[3] = 0.5; | color[3] = 0.5; | ||||
| glColor4fv(color); | glColor4fv(color); | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| } | } | ||||
| /* set antialias line */ | /* set antialias line */ | ||||
| glEnable(GL_LINE_SMOOTH); | glEnable(GL_LINE_SMOOTH); | ||||
| glEnable(GL_BLEND); | 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_BLEND); | ||||
| glDisable(GL_LINE_SMOOTH); | glDisable(GL_LINE_SMOOTH); | ||||
| } | } | ||||
| /* (old, used in outliner) plain antialiased filled box */ | /* (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); | ui_draw_anti_roundbox(GL_POLYGON, minx, miny, maxx, maxy, rad, roundboxtype & UI_RB_ALPHA); | ||||
| } | } | ||||
| /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ | /* ************** SPECIAL BUTTON DRAWING FUNCTIONS ************* */ | ||||
| void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect) | void ui_draw_but_IMAGE(ARegion *UNUSED(ar), uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
| { | { | ||||
| /* restore scissortest */ | /* restore scissortest */ | ||||
| glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); | glScissor(scissor[0], scissor[1], scissor[2], scissor[3]); | ||||
| glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||||
| /* outline */ | /* outline */ | ||||
| glColor4f(0.f, 0.f, 0.f, 0.5f); | glColor4f(0.f, 0.f, 0.f, 0.5f); | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiDrawBox(GL_LINE_LOOP, rect->xmin - 1, rect->ymin, rect->xmax + 1, rect->ymax + 1, 3.0f); | 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, | static void histogram_draw_one(float r, float g, float b, float alpha, | ||||
| float x, float y, float w, float h, const float *data, int res, const bool is_line) | float x, float y, float w, float h, const float *data, int res, const bool is_line) | ||||
| { | { | ||||
| int i; | int i; | ||||
| if (is_line) { | if (is_line) { | ||||
| ▲ Show 20 Lines • Show All 67 Lines • ▼ Show 20 Lines | void ui_draw_but_HISTOGRAM(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| w = BLI_rctf_size_x(&rect); | w = BLI_rctf_size_x(&rect); | ||||
| h = BLI_rctf_size_y(&rect) * hist->ymax; | h = BLI_rctf_size_y(&rect) * hist->ymax; | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||||
| glColor4f(0.f, 0.f, 0.f, 0.3f); | glColor4f(0.f, 0.f, 0.f, 0.3f); | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); | 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 */ | /* need scissor test, histogram can draw outside of boundary */ | ||||
| glGetIntegerv(GL_VIEWPORT, scissor); | glGetIntegerv(GL_VIEWPORT, scissor); | ||||
| glScissor(ar->winrct.xmin + (rect.xmin - 1), | glScissor(ar->winrct.xmin + (rect.xmin - 1), | ||||
| ar->winrct.ymin + (rect.ymin - 1), | ar->winrct.ymin + (rect.ymin - 1), | ||||
| (rect.xmax + 1) - (rect.xmin - 1), | (rect.xmax + 1) - (rect.xmin - 1), | ||||
| (rect.ymax + 1) - (rect.ymin - 1)); | (rect.ymax + 1) - (rect.ymin - 1)); | ||||
| ▲ Show 20 Lines • Show All 69 Lines • ▼ Show 20 Lines | for (i = 0; i < 3; i++) { | ||||
| colorsycc_alpha[c][i] = colorsycc[c][i] * alpha; | colorsycc_alpha[c][i] = colorsycc[c][i] * alpha; | ||||
| } | } | ||||
| } | } | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||||
| glColor4f(0.f, 0.f, 0.f, 0.3f); | glColor4f(0.f, 0.f, 0.f, 0.3f); | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); | 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 */ | /* need scissor test, waveform can draw outside of boundary */ | ||||
| glGetIntegerv(GL_VIEWPORT, scissor); | glGetIntegerv(GL_VIEWPORT, scissor); | ||||
| glScissor(ar->winrct.xmin + (rect.xmin - 1), | glScissor(ar->winrct.xmin + (rect.xmin - 1), | ||||
| ar->winrct.ymin + (rect.ymin - 1), | ar->winrct.ymin + (rect.ymin - 1), | ||||
| (rect.xmax + 1) - (rect.xmin - 1), | (rect.xmax + 1) - (rect.xmin - 1), | ||||
| (rect.ymax + 1) - (rect.ymin - 1)); | (rect.ymax + 1) - (rect.ymin - 1)); | ||||
| ▲ Show 20 Lines • Show All 201 Lines • ▼ Show 20 Lines | void ui_draw_but_VECTORSCOPE(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| diam = (w < h) ? w : h; | diam = (w < h) ? w : h; | ||||
| alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha; | alpha = scopes->vecscope_alpha * scopes->vecscope_alpha * scopes->vecscope_alpha; | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); | ||||
| glColor4f(0.f, 0.f, 0.f, 0.3f); | glColor4f(0.f, 0.f, 0.f, 0.3f); | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin - 1, rect.xmax + 1, rect.ymax + 1, 3.0f); | 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 */ | /* need scissor test, hvectorscope can draw outside of boundary */ | ||||
| glGetIntegerv(GL_VIEWPORT, scissor); | glGetIntegerv(GL_VIEWPORT, scissor); | ||||
| glScissor(ar->winrct.xmin + (rect.xmin - 1), | glScissor(ar->winrct.xmin + (rect.xmin - 1), | ||||
| ar->winrct.ymin + (rect.ymin - 1), | ar->winrct.ymin + (rect.ymin - 1), | ||||
| (rect.xmax + 1) - (rect.xmin - 1), | (rect.xmax + 1) - (rect.xmin - 1), | ||||
| (rect.ymax + 1) - (rect.ymin - 1)); | (rect.ymax + 1) - (rect.ymin - 1)); | ||||
| ▲ Show 20 Lines • Show All 208 Lines • ▼ Show 20 Lines | void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect) | ||||
| int a; | int a; | ||||
| float pos, colf[4] = {0, 0, 0, 0}; /* initialize in case the colorband isn't valid */ | float pos, colf[4] = {0, 0, 0, 0}; /* initialize in case the colorband isn't valid */ | ||||
| struct ColorManagedDisplay *display = NULL; | struct ColorManagedDisplay *display = NULL; | ||||
| coba = (ColorBand *)(but->editcoba ? but->editcoba : but->poin); | coba = (ColorBand *)(but->editcoba ? but->editcoba : but->poin); | ||||
| if (coba == NULL) return; | if (coba == NULL) return; | ||||
| if (but->block->color_profile) | if (but->block->color_profile) | ||||
| display = ui_block_display_get(but->block); | display = ui_block_cm_display_get(but->block); | ||||
| x1 = rect->xmin; | x1 = rect->xmin; | ||||
| sizex = rect->xmax - x1; | sizex = rect->xmax - x1; | ||||
| sizey = BLI_rcti_size_y(rect); | sizey = BLI_rcti_size_y(rect); | ||||
| sizey_solid = sizey / 4; | sizey_solid = sizey / 4; | ||||
| y1 = rect->ymin; | y1 = rect->ymin; | ||||
| /* layer: background, to show tranparency */ | /* layer: background, to show tranparency */ | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | void ui_draw_but_COLORBAND(uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *rect) | ||||
| /* layer: active handle */ | /* layer: active handle */ | ||||
| if (coba->tot != 0) { | if (coba->tot != 0) { | ||||
| cbd = &coba->data[coba->cur]; | cbd = &coba->data[coba->cur]; | ||||
| pos = x1 + cbd->pos * (sizex - 1) + 1; | pos = x1 + cbd->pos * (sizex - 1) + 1; | ||||
| ui_draw_colorband_handle(rect, pos, &cbd->r, display, true); | ui_draw_colorband_handle(rect, pos, &cbd->r, display, true); | ||||
| } | } | ||||
| } | } | ||||
| 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; | static GLuint displist = 0; | ||||
| int a, old[8]; | int a, old[8]; | ||||
| GLfloat diff[4], diffn[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | GLfloat diff[4], diffn[4] = {1.0f, 1.0f, 1.0f, 1.0f}; | ||||
| float vec0[4] = {0.0f, 0.0f, 0.0f, 0.0f}; | float vec0[4] = {0.0f, 0.0f, 0.0f, 0.0f}; | ||||
| float dir[4], size; | float dir[4], size; | ||||
| /* store stuff */ | /* store stuff */ | ||||
| glGetMaterialfv(GL_FRONT, GL_DIFFUSE, diff); | glGetMaterialfv(GL_FRONT, GL_DIFFUSE, diff); | ||||
| /* backdrop */ | /* backdrop */ | ||||
| glColor3ubv((unsigned char *)wcol->inner); | glColor3ubv((unsigned char *)wcol->inner); | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiDrawBox(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); | UI_draw_roundbox_gl_mode(GL_POLYGON, rect->xmin, rect->ymin, rect->xmax, rect->ymax, 5.0f); | ||||
| /* sphere color */ | /* sphere color */ | ||||
| glMaterialfv(GL_FRONT, GL_DIFFUSE, diffn); | glMaterialfv(GL_FRONT, GL_DIFFUSE, diffn); | ||||
| glCullFace(GL_BACK); | glCullFace(GL_BACK); | ||||
| glEnable(GL_CULL_FACE); | glEnable(GL_CULL_FACE); | ||||
| /* disable blender light */ | /* disable blender light */ | ||||
| for (a = 0; a < 8; a++) { | for (a = 0; a < 8; a++) { | ||||
| old[a] = glIsEnabled(GL_LIGHT0 + a); | old[a] = glIsEnabled(GL_LIGHT0 + a); | ||||
| glDisable(GL_LIGHT0 + a); | glDisable(GL_LIGHT0 + a); | ||||
| } | } | ||||
| /* own light */ | /* own light */ | ||||
| glEnable(GL_LIGHT7); | glEnable(GL_LIGHT7); | ||||
| glEnable(GL_LIGHTING); | 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 */ | dir[3] = 0.0f; /* glLightfv needs 4 args, 0.0 is sun */ | ||||
| glLightfv(GL_LIGHT7, GL_POSITION, dir); | glLightfv(GL_LIGHT7, GL_POSITION, dir); | ||||
| glLightfv(GL_LIGHT7, GL_DIFFUSE, diffn); | glLightfv(GL_LIGHT7, GL_DIFFUSE, diffn); | ||||
| glLightfv(GL_LIGHT7, GL_SPECULAR, vec0); | glLightfv(GL_LIGHT7, GL_SPECULAR, vec0); | ||||
| glLightf(GL_LIGHT7, GL_CONSTANT_ATTENUATION, 1.0f); | glLightf(GL_LIGHT7, GL_CONSTANT_ATTENUATION, 1.0f); | ||||
| glLightf(GL_LIGHT7, GL_LINEAR_ATTENUATION, 0.0f); | glLightf(GL_LIGHT7, GL_LINEAR_ATTENUATION, 0.0f); | ||||
| ▲ Show 20 Lines • Show All 305 Lines • ▼ Show 20 Lines | void ui_draw_but_TRACKPREVIEW(ARegion *ar, uiBut *but, uiWidgetColors *UNUSED(wcol), const rcti *recti) | ||||
| glGetIntegerv(GL_VIEWPORT, scissor); | glGetIntegerv(GL_VIEWPORT, scissor); | ||||
| glScissor(ar->winrct.xmin + (rect.xmin - 1), | glScissor(ar->winrct.xmin + (rect.xmin - 1), | ||||
| ar->winrct.ymin + (rect.ymin - 1), | ar->winrct.ymin + (rect.ymin - 1), | ||||
| (rect.xmax + 1) - (rect.xmin - 1), | (rect.xmax + 1) - (rect.xmin - 1), | ||||
| (rect.ymax + 1) - (rect.ymin - 1)); | (rect.ymax + 1) - (rect.ymin - 1)); | ||||
| if (scopes->track_disabled) { | if (scopes->track_disabled) { | ||||
| glColor4f(0.7f, 0.3f, 0.3f, 0.3f); | glColor4f(0.7f, 0.3f, 0.3f, 0.3f); | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); | UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); | ||||
| ok = 1; | ok = 1; | ||||
| } | } | ||||
| else if ((scopes->track_search) && | else if ((scopes->track_search) && | ||||
| ((!scopes->track_preview) || | ((!scopes->track_preview) || | ||||
| (scopes->track_preview->x != width || scopes->track_preview->y != height))) | (scopes->track_preview->x != width || scopes->track_preview->y != height))) | ||||
| { | { | ||||
| ImBuf *tmpibuf; | ImBuf *tmpibuf; | ||||
| Show All 30 Lines | if (!ok && scopes->track_preview) { | ||||
| /* draw content of pattern area */ | /* draw content of pattern area */ | ||||
| glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, scissor[2], scissor[3]); | glScissor(ar->winrct.xmin + rect.xmin, ar->winrct.ymin + rect.ymin, scissor[2], scissor[3]); | ||||
| if (width > 0 && height > 0) { | if (width > 0 && height > 0) { | ||||
| drawibuf = scopes->track_preview; | drawibuf = scopes->track_preview; | ||||
| if (scopes->use_track_mask) { | if (scopes->use_track_mask) { | ||||
| glColor4f(0.0f, 0.0f, 0.0f, 0.3f); | glColor4f(0.0f, 0.0f, 0.0f, 0.3f); | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); | 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, | glaDrawPixelsSafe(rect.xmin, rect.ymin + 1, drawibuf->x, drawibuf->y, | ||||
| drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect); | drawibuf->x, GL_RGBA, GL_UNSIGNED_BYTE, drawibuf->rect); | ||||
| /* draw cross for pizel position */ | /* draw cross for pizel position */ | ||||
| glTranslatef(rect.xmin + track_pos[0], rect.ymin + track_pos[1], 0.f); | glTranslatef(rect.xmin + track_pos[0], rect.ymin + track_pos[1], 0.f); | ||||
| glScissor(ar->winrct.xmin + rect.xmin, | glScissor(ar->winrct.xmin + rect.xmin, | ||||
| Show All 23 Lines | if (!ok && scopes->track_preview) { | ||||
| glDisable(GL_LINE_STIPPLE); | glDisable(GL_LINE_STIPPLE); | ||||
| glPopMatrix(); | glPopMatrix(); | ||||
| ok = 1; | ok = 1; | ||||
| } | } | ||||
| if (!ok) { | if (!ok) { | ||||
| glColor4f(0.f, 0.f, 0.f, 0.3f); | glColor4f(0.f, 0.f, 0.f, 0.3f); | ||||
| uiSetRoundBox(UI_CNR_ALL); | UI_draw_roundbox_corner_set(UI_CNR_ALL); | ||||
| uiDrawBox(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); | UI_draw_roundbox_gl_mode(GL_POLYGON, rect.xmin - 1, rect.ymin, rect.xmax + 1, rect.ymax + 1, 3.0f); | ||||
| } | } | ||||
| /* outline */ | /* outline */ | ||||
| draw_scope_end(&rect, scissor); | draw_scope_end(&rect, scissor); | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 99 Lines • ▼ Show 20 Lines | static void ui_shadowbox(float minx, float miny, float maxx, float maxy, float shadsize, unsigned char alpha) | ||||
| glVertex2f(maxx, miny - shadsize); | glVertex2f(maxx, miny - shadsize); | ||||
| glVertex2f(minx + 0.5f * shadsize, miny - shadsize); | glVertex2f(minx + 0.5f * shadsize, miny - shadsize); | ||||
| glEnd(); | glEnd(); | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| glShadeModel(GL_FLAT); | 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 */ | /* accumulated outline boxes to make shade not linear, is more pleasant */ | ||||
| ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8); | ui_shadowbox(minx, miny, maxx, maxy, 11.0, (20 * alpha) >> 8); | ||||
| ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40 * alpha) >> 8); | ui_shadowbox(minx, miny, maxx, maxy, 7.0, (40 * alpha) >> 8); | ||||
| ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80 * alpha) >> 8); | ui_shadowbox(minx, miny, maxx, maxy, 5.0, (80 * alpha) >> 8); | ||||
| } | } | ||||
| 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; | int i; | ||||
| float rad; | float rad; | ||||
| float a; | float a; | ||||
| float dalpha = alpha * 2.0f / 255.0f, calpha; | float dalpha = alpha * 2.0f / 255.0f, calpha; | ||||
| glEnable(GL_BLEND); | glEnable(GL_BLEND); | ||||
| Show All 14 Lines | #endif | ||||
| } | } | ||||
| calpha = dalpha; | calpha = dalpha; | ||||
| for (; i--; a -= aspect) { | for (; i--; a -= aspect) { | ||||
| /* alpha ranges from 2 to 20 or so */ | /* alpha ranges from 2 to 20 or so */ | ||||
| glColor4f(0.0f, 0.0f, 0.0f, calpha); | glColor4f(0.0f, 0.0f, 0.0f, calpha); | ||||
| calpha += dalpha; | 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 */ | /* outline emphasis */ | ||||
| glEnable(GL_LINE_SMOOTH); | glEnable(GL_LINE_SMOOTH); | ||||
| glColor4ub(0, 0, 0, 100); | 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_LINE_SMOOTH); | ||||
| glDisable(GL_BLEND); | glDisable(GL_BLEND); | ||||
| } | } | ||||