Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/space_file/file_draw.c
| Context not available. | |||||
| #include "WM_api.h" | #include "WM_api.h" | ||||
| #include "WM_types.h" | #include "WM_types.h" | ||||
| //#include "GPU_draw.h" | |||||
| //#include "GPU_basic_shader.h" | |||||
| #include "GPU_immediate.h" | |||||
| #include "filelist.h" | #include "filelist.h" | ||||
| #include "file_intern.h" // own include | #include "file_intern.h" // own include | ||||
| Context not available. | |||||
| const int step = (layout->tile_w + 2 * layout->tile_border_x); | const int step = (layout->tile_w + 2 * layout->tile_border_x); | ||||
| int v1[2], v2[2]; | int v1[2], v2[2]; | ||||
| int sx; | int sx; | ||||
| unsigned int vertex_ct = 0; | |||||
| unsigned char col_hi[3], col_lo[3]; | unsigned char col_hi[3], col_lo[3]; | ||||
| VertexFormat* format = immVertexFormat(); | |||||
| unsigned pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT); | |||||
| unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT); | |||||
| vertex_ct = (v2d->cur.xmax - v2d->tot.xmin) / step + 1; /* paint at least 1 divider */ | |||||
| vertex_ct *= 4; /* vertex_count = 2 points per divider * 2 lines per divider */ | |||||
| UI_GetThemeColorShade3ubv(TH_BACK, 30, col_hi); | UI_GetThemeColorShade3ubv(TH_BACK, 30, col_hi); | ||||
| UI_GetThemeColorShade3ubv(TH_BACK, -30, col_lo); | UI_GetThemeColorShade3ubv(TH_BACK, -30, col_lo); | ||||
| v1[1] = v2d->cur.ymax - layout->tile_border_y; | v1[1] = v2d->cur.ymax - layout->tile_border_y; | ||||
| v2[1] = v2d->cur.ymin; | v2[1] = v2d->cur.ymin; | ||||
| immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); | glBegin(GL_LINES); | ||||
| immBegin(GL_LINES, vertex_ct); | |||||
| /* vertical column dividers */ | /* vertical column dividers */ | ||||
| sx = (int)v2d->tot.xmin; | sx = (int)v2d->tot.xmin; | ||||
| while (sx < v2d->cur.xmax) { | while (sx < v2d->cur.xmax) { | ||||
| sx += step; | sx += step; | ||||
| glColor3ubv(col_lo); | |||||
| v1[0] = v2[0] = sx; | v1[0] = v2[0] = sx; | ||||
| immAttrib3ubv(color, col_lo); | glVertex2iv(v1); | ||||
| immVertex2iv(pos, v1); | glVertex2iv(v2); | ||||
| immVertex2iv(pos, v2); | |||||
| glColor3ubv(col_hi); | |||||
| v1[0] = v2[0] = sx + 1; | v1[0] = v2[0] = sx + 1; | ||||
| immAttrib3ubv(color, col_hi); | glVertex2iv(v1); | ||||
| immVertex2iv(pos, v1); | glVertex2iv(v2); | ||||
| immVertex2iv(pos, v2); | |||||
| } | } | ||||
| immEnd(); | glEnd(); | ||||
| immUnbindProgram(); | |||||
| } | } | ||||
| void file_draw_list(const bContext *C, ARegion *ar) | void file_draw_list(const bContext *C, ARegion *ar) | ||||
| Context not available. | |||||