Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/interface/view2d.c
| Show First 20 Lines • Show All 1,715 Lines • ▼ Show 20 Lines | |||||
| } | } | ||||
| /* Draw scrollbars in the given 2d-region */ | /* Draw scrollbars in the given 2d-region */ | ||||
| void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs) | void UI_view2d_scrollers_draw(const bContext *C, View2D *v2d, View2DScrollers *vs) | ||||
| { | { | ||||
| Scene *scene = CTX_data_scene(C); | Scene *scene = CTX_data_scene(C); | ||||
| rcti vert, hor; | rcti vert, hor; | ||||
| int scroll = view2d_scroll_mapped(v2d->scroll); | int scroll = view2d_scroll_mapped(v2d->scroll); | ||||
| /* Gawain variables */ | |||||
| VertexFormat *format; | |||||
| unsigned pos; | |||||
| /* make copies of rects for less typing */ | /* make copies of rects for less typing */ | ||||
| vert = vs->vert; | vert = vs->vert; | ||||
merwin: I recommend getting rid of these. See below... | |||||
| hor = vs->hor; | hor = vs->hor; | ||||
| /* horizontal scrollbar */ | /* horizontal scrollbar */ | ||||
| if (scroll & V2D_SCROLL_HORIZONTAL) { | if (scroll & V2D_SCROLL_HORIZONTAL) { | ||||
| bTheme *btheme = UI_GetTheme(); | bTheme *btheme = UI_GetTheme(); | ||||
| uiWidgetColors wcol = btheme->tui.wcol_scroll; | uiWidgetColors wcol = btheme->tui.wcol_scroll; | ||||
| rcti slider; | rcti slider; | ||||
| int state; | int state; | ||||
| Show All 17 Lines | if ((v2d->keepzoom & V2D_LOCKZOOM_X) == 0 && | ||||
| (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) && | (v2d->scroll & V2D_SCROLL_SCALE_HORIZONTAL) && | ||||
| (BLI_rcti_size_x(&slider) > V2D_SCROLLER_HANDLE_SIZE)) | (BLI_rcti_size_x(&slider) > V2D_SCROLLER_HANDLE_SIZE)) | ||||
| { | { | ||||
| state |= UI_SCROLL_ARROWS; | state |= UI_SCROLL_ARROWS; | ||||
| } | } | ||||
| /* clean rect behind slider, but not with transparent background */ | /* clean rect behind slider, but not with transparent background */ | ||||
| UI_GetThemeColor4ubv(TH_BACK, col); | UI_GetThemeColor4ubv(TH_BACK, col); | ||||
| if (col[3] == 255) { | if (col[3] == 255) { | ||||
define-private-publicAuthorUnsubmitted Done Inline ActionsThis seems a little odd to me that we would draw the scrollbars if and only if the alpha channel is fully visible. Shouldn't it be col[3] != 0? Or do we want to leave it like this. Same goes for line 1873 define-private-public: This seems a little odd to me that we would draw the scrollbars if **and only if** the alpha… | |||||
merwinUnsubmitted Done Inline ActionsFrom the comment above this clears a rect behind the scrollers. If not opaque it lets the existing pixels show through. merwin: From the comment above this clears a rect behind the scrollers. If not opaque it lets the… | |||||
| glColor3ub(col[0], col[1], col[2]); | format = immVertexFormat(); | ||||
| glRecti(v2d->hor.xmin, v2d->hor.ymin, v2d->hor.xmax, v2d->hor.ymax); | pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); | ||||
Not Done Inline Actionsunsigned pos = add_attrib(immVertexFormat(), "pos" ... merwin: unsigned pos = add_attrib(immVertexFormat(), "pos" ... | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immUniformColor3ubv(col); | |||||
| immRecti(pos, v2d->hor.xmin, v2d->hor.ymin, v2d->hor.xmax, v2d->hor.ymax); | |||||
| immUnbindProgram(); | |||||
| } | } | ||||
| UI_draw_widget_scroll(&wcol, &hor, &slider, state); | UI_draw_widget_scroll(&wcol, &hor, &slider, state); | ||||
| /* scale indicators */ | /* scale indicators */ | ||||
| if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) { | if ((scroll & V2D_SCROLL_SCALE_HORIZONTAL) && (vs->grid)) { | ||||
| View2DGrid *grid = vs->grid; | View2DGrid *grid = vs->grid; | ||||
| float fac, dfac, fac2, val; | float fac, dfac, fac2, val; | ||||
| ▲ Show 20 Lines • Show All 83 Lines • ▼ Show 20 Lines | if ((v2d->keepzoom & V2D_LOCKZOOM_Y) == 0 && | ||||
| (BLI_rcti_size_y(&slider) > V2D_SCROLLER_HANDLE_SIZE)) | (BLI_rcti_size_y(&slider) > V2D_SCROLLER_HANDLE_SIZE)) | ||||
| { | { | ||||
| state |= UI_SCROLL_ARROWS; | state |= UI_SCROLL_ARROWS; | ||||
| } | } | ||||
| /* clean rect behind slider, but not with transparent background */ | /* clean rect behind slider, but not with transparent background */ | ||||
| UI_GetThemeColor4ubv(TH_BACK, col); | UI_GetThemeColor4ubv(TH_BACK, col); | ||||
| if (col[3] == 255) { | if (col[3] == 255) { | ||||
| glColor3ub(col[0], col[1], col[2]); | format = immVertexFormat(); | ||||
| glRecti(v2d->vert.xmin, v2d->vert.ymin, v2d->vert.xmax, v2d->vert.ymax); | pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); | ||||
Not Done Inline Actionssame here merwin: same here | |||||
| immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); | |||||
| immUniformColor3ubv(col); | |||||
| immRecti(pos, v2d->vert.xmin, v2d->vert.ymin, v2d->vert.xmax, v2d->vert.ymax); | |||||
| immUnbindProgram(); | |||||
| } | } | ||||
| UI_draw_widget_scroll(&wcol, &vert, &slider, state); | UI_draw_widget_scroll(&wcol, &vert, &slider, state); | ||||
| /* scale indiators */ | /* scale indiators */ | ||||
| if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) { | if ((scroll & V2D_SCROLL_SCALE_VERTICAL) && (vs->grid)) { | ||||
| View2DGrid *grid = vs->grid; | View2DGrid *grid = vs->grid; | ||||
| ▲ Show 20 Lines • Show All 589 Lines • Show Last 20 Lines | |||||
I recommend getting rid of these. See below...