diff options
author | Campbell Barton <ideasman42@gmail.com> | 2020-02-07 17:02:18 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2020-02-07 17:02:18 +0300 |
commit | 6f3e498e7d5e0c772ef795e7301dd332bccada22 (patch) | |
tree | 9d3651565edbf3d4549f9b1f3c924af99d065902 /source/blender/editors | |
parent | 80415ee2031f1b1b9ef38774fa9a297f7a5018aa (diff) |
Cleanup: use of 'unsigned'
- Replace 'unsigned' used on it's own with 'uint'.
- Replace 'unsigned const char' with 'const uchar'.
Diffstat (limited to 'source/blender/editors')
-rw-r--r-- | source/blender/editors/include/ED_node.h | 2 | ||||
-rw-r--r-- | source/blender/editors/include/ED_view3d.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/view2d.c | 2 | ||||
-rw-r--r-- | source/blender/editors/object/object_vgroup.c | 10 | ||||
-rw-r--r-- | source/blender/editors/screen/area.c | 2 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 10 | ||||
-rw-r--r-- | source/blender/editors/space_graph/graph_draw.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_image/image_draw.c | 26 | ||||
-rw-r--r-- | source/blender/editors/space_node/drawnode.c | 25 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_draw.c | 12 | ||||
-rw-r--r-- | source/blender/editors/space_outliner/outliner_draw.c | 14 | ||||
-rw-r--r-- | source/blender/editors/space_view3d/drawobject.c | 2 |
12 files changed, 61 insertions, 67 deletions
diff --git a/source/blender/editors/include/ED_node.h b/source/blender/editors/include/ED_node.h index d2d8972c245..de7d2e1a395 100644 --- a/source/blender/editors/include/ED_node.h +++ b/source/blender/editors/include/ED_node.h @@ -72,7 +72,7 @@ void ED_init_standard_node_socket_type(struct bNodeSocketType *stype); void ED_init_node_socket_type_virtual(struct bNodeSocketType *stype); void ED_node_sample_set(const float col[4]); void ED_node_draw_snap( - struct View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned pos); + struct View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned int pos); /* node_draw.c */ void ED_node_tree_update(const struct bContext *C); diff --git a/source/blender/editors/include/ED_view3d.h b/source/blender/editors/include/ED_view3d.h index 37ffb1b9d6d..622b64f547f 100644 --- a/source/blender/editors/include/ED_view3d.h +++ b/source/blender/editors/include/ED_view3d.h @@ -452,7 +452,7 @@ float ED_view3d_radius_to_dist(const struct View3D *v3d, const bool use_aspect, const float radius); -void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos); +void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned int pos); /* backbuffer select and draw support */ void ED_view3d_backbuf_depth_validate(struct ViewContext *vc); diff --git a/source/blender/editors/interface/view2d.c b/source/blender/editors/interface/view2d.c index a23bd7dad35..8af3664d41b 100644 --- a/source/blender/editors/interface/view2d.c +++ b/source/blender/editors/interface/view2d.c @@ -1343,7 +1343,7 @@ void UI_view2d_multi_grid_draw(View2D *v2d, int colorid, float step, int level_s uchar grid_line_color[3]; /* Make an estimate of at least how many vertices will be needed */ - unsigned vertex_count = 4; + uint vertex_count = 4; vertex_count += 2 * ((int)((v2d->cur.xmax - v2d->cur.xmin) / lstep) + 1); vertex_count += 2 * ((int)((v2d->cur.ymax - v2d->cur.ymin) / lstep) + 1); diff --git a/source/blender/editors/object/object_vgroup.c b/source/blender/editors/object/object_vgroup.c index 05fa78aab1c..9ccbc7a1a0a 100644 --- a/source/blender/editors/object/object_vgroup.c +++ b/source/blender/editors/object/object_vgroup.c @@ -701,7 +701,7 @@ const EnumPropertyItem *ED_object_vgroup_selection_itemf_helper(const bContext * PointerRNA *UNUSED(ptr), PropertyRNA *UNUSED(prop), bool *r_free, - const unsigned int selection_mask) + const uint selection_mask) { Object *ob; EnumPropertyItem *item = NULL; @@ -1807,10 +1807,10 @@ static void vgroup_smooth_subset(Object *ob, float *weight_accum_prev; float *weight_accum_curr; - unsigned int subset_index; + uint subset_index; /* vertex indices that will be smoothed, (only to avoid iterating over verts that do nothing) */ - unsigned int *verts_used; + uint *verts_used; STACK_DECLARE(verts_used); BKE_object_defgroup_subset_to_index_array(vgroup_validmap, vgroup_tot, vgroup_subset_map); @@ -1882,12 +1882,12 @@ static void vgroup_smooth_subset(Object *ob, memcpy(weight_accum_curr, weight_accum_prev, sizeof(*weight_accum_curr) * dvert_tot); for (iter = 0; iter < repeat; iter++) { - unsigned *vi_step, *vi_end = verts_used + STACK_SIZE(verts_used); + uint *vi_step, *vi_end = verts_used + STACK_SIZE(verts_used); /* avoid looping over all verts */ // for (i = 0; i < dvert_tot; i++) for (vi_step = verts_used; vi_step != vi_end; vi_step++) { - const unsigned int i = *vi_step; + const uint i = *vi_step; float weight_tot = 0.0f; float weight = 0.0f; diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 7db634660af..c85beefe1f4 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -3290,7 +3290,7 @@ void ED_region_grid_draw(ARegion *ar, float zoomx, float zoomy, float x0, float if (count_fine > 0) { GPU_vertformat_clear(format); pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - unsigned color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GPU_PRIM_LINES, 4 * count_fine + 4 * count_large); diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 015657318b2..cf66ba14328 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -291,7 +291,7 @@ static void sculpt_vertex_neighbors_get_faces(SculptSession *ss, for (i = 0; i < ss->pmap[(int)index].count; i++) { const MPoly *p = &ss->mpoly[vert_map->indices[i]]; - unsigned f_adj_v[2]; + uint f_adj_v[2]; if (poly_get_adj_loops_from_vert(p, ss->mloop, (int)index, f_adj_v) != -1) { int j; for (j = 0; j < ARRAY_SIZE(f_adj_v); j += 1) { @@ -2203,7 +2203,7 @@ static void update_brush_local_mat(Sculpt *sd, Object *ob) /* For the smooth brush, uses the neighboring vertices around vert to calculate * a smoothed location for vert. Skips corner vertices (used by only one * polygon.) */ -static void neighbor_average(SculptSession *ss, float avg[3], unsigned vert) +static void neighbor_average(SculptSession *ss, float avg[3], uint vert) { const MeshElemMap *vert_map = &ss->pmap[vert]; const MVert *mvert = ss->mvert; @@ -2217,7 +2217,7 @@ static void neighbor_average(SculptSession *ss, float avg[3], unsigned vert) for (i = 0; i < vert_map->count; i++) { const MPoly *p = &ss->mpoly[vert_map->indices[i]]; - unsigned f_adj_v[2]; + uint f_adj_v[2]; if (poly_get_adj_loops_from_vert(p, ss->mloop, vert, f_adj_v) != -1) { int j; @@ -2243,7 +2243,7 @@ static void neighbor_average(SculptSession *ss, float avg[3], unsigned vert) /* Similar to neighbor_average(), but returns an averaged mask value * instead of coordinate. Also does not restrict based on border or * corner vertices. */ -static float neighbor_average_mask(SculptSession *ss, unsigned vert) +static float neighbor_average_mask(SculptSession *ss, uint vert) { const float *vmask = ss->vmask; float avg = 0; @@ -2251,7 +2251,7 @@ static float neighbor_average_mask(SculptSession *ss, unsigned vert) for (i = 0; i < ss->pmap[vert].count; i++) { const MPoly *p = &ss->mpoly[ss->pmap[vert].indices[i]]; - unsigned f_adj_v[2]; + uint f_adj_v[2]; if (poly_get_adj_loops_from_vert(p, ss->mloop, vert, f_adj_v) != -1) { int j; diff --git a/source/blender/editors/space_graph/graph_draw.c b/source/blender/editors/space_graph/graph_draw.c index 42a1566629a..8dd5a7c7d0c 100644 --- a/source/blender/editors/space_graph/graph_draw.c +++ b/source/blender/editors/space_graph/graph_draw.c @@ -164,7 +164,7 @@ static void set_fcurve_vertex_color(FCurve *fcu, bool sel) } static void draw_fcurve_selected_keyframe_vertices( - FCurve *fcu, View2D *v2d, bool edit, bool sel, unsigned pos) + FCurve *fcu, View2D *v2d, bool edit, bool sel, uint pos) { const float fac = 0.05f * BLI_rctf_size_x(&v2d->cur); @@ -200,7 +200,7 @@ static void draw_fcurve_selected_keyframe_vertices( } /* helper func - draw keyframe vertices only for an F-Curve */ -static void draw_fcurve_keyframe_vertices(FCurve *fcu, View2D *v2d, bool edit, unsigned pos) +static void draw_fcurve_keyframe_vertices(FCurve *fcu, View2D *v2d, bool edit, uint pos) { immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_AA); @@ -214,7 +214,7 @@ static void draw_fcurve_keyframe_vertices(FCurve *fcu, View2D *v2d, bool edit, u /* helper func - draw handle vertices only for an F-Curve (if it is not protected) */ static void draw_fcurve_selected_handle_vertices( - FCurve *fcu, View2D *v2d, bool sel, bool sel_handle_only, unsigned pos) + FCurve *fcu, View2D *v2d, bool sel, bool sel_handle_only, uint pos) { (void)v2d; /* TODO: use this to draw only points in view */ @@ -259,10 +259,7 @@ static void draw_fcurve_selected_handle_vertices( } /* helper func - draw handle vertices only for an F-Curve (if it is not protected) */ -static void draw_fcurve_handle_vertices(FCurve *fcu, - View2D *v2d, - bool sel_handle_only, - unsigned pos) +static void draw_fcurve_handle_vertices(FCurve *fcu, View2D *v2d, bool sel_handle_only, uint pos) { /* smooth outlines for more consistent appearance */ immBindBuiltinProgram(GPU_SHADER_2D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA); @@ -353,7 +350,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu) BezTriple *bezt = fcu->bezt, *prevbezt = NULL; int basecol = (sel) ? TH_HANDLE_SEL_FREE : TH_HANDLE_FREE; const float *fp; - unsigned char col[4]; + uchar col[4]; for (b = 0; b < fcu->totvert; b++, prevbezt = bezt, bezt++) { /* if only selected keyframes can get their handles shown, @@ -428,7 +425,7 @@ static void draw_fcurve_handles(SpaceGraph *sipo, FCurve *fcu) * have a consistent appearance (due to off-pixel alignments)... */ static void draw_fcurve_sample_control( - float x, float y, float xscale, float yscale, float hsize, unsigned int pos) + float x, float y, float xscale, float yscale, float hsize, uint pos) { /* adjust view transform before starting */ GPU_matrix_push(); @@ -491,8 +488,7 @@ static void draw_fcurve_samples(SpaceGraph *sipo, ARegion *ar, FCurve *fcu) /* Helper func - just draw the F-Curve by sampling the visible region * (for drawing curves with modifiers). */ -static void draw_fcurve_curve( - bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, unsigned int pos) +static void draw_fcurve_curve(bAnimContext *ac, ID *id, FCurve *fcu_, View2D *v2d, uint pos) { SpaceGraph *sipo = (SpaceGraph *)ac->sl; float samplefreq; @@ -684,8 +680,7 @@ static bool fcurve_can_use_simple_bezt_drawing(FCurve *fcu) } /* helper func - draw one repeat of an F-Curve (using Bezier curve approximations) */ -static void draw_fcurve_curve_bezts( - bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, unsigned int pos) +static void draw_fcurve_curve_bezts(bAnimContext *ac, ID *id, FCurve *fcu, View2D *v2d, uint pos) { BezTriple *prevbezt = fcu->bezt; BezTriple *bezt = prevbezt + 1; diff --git a/source/blender/editors/space_image/image_draw.c b/source/blender/editors/space_image/image_draw.c index 3f563fe9033..c455b7d7c54 100644 --- a/source/blender/editors/space_image/image_draw.c +++ b/source/blender/editors/space_image/image_draw.c @@ -147,7 +147,7 @@ void ED_image_draw_info(Scene *scene, int channels, int x, int y, - const unsigned char cp[4], + const uchar cp[4], const float fp[4], const float linearcol[4], int *zp, @@ -164,13 +164,13 @@ void ED_image_draw_info(Scene *scene, /* text colors */ /* XXX colored text not allowed in Blender UI */ #if 0 - unsigned char red[3] = {255, 50, 50}; - unsigned char green[3] = {0, 255, 0}; - unsigned char blue[3] = {100, 100, 255}; + uchar red[3] = {255, 50, 50}; + uchar green[3] = {0, 255, 0}; + uchar blue[3] = {100, 100, 255}; #else - unsigned char red[3] = {255, 255, 255}; - unsigned char green[3] = {255, 255, 255}; - unsigned char blue[3] = {255, 255, 255}; + uchar red[3] = {255, 255, 255}; + uchar green[3] = {255, 255, 255}; + uchar blue[3] = {255, 255, 255}; #endif float hue = 0, sat = 0, val = 0, lum = 0, u = 0, v = 0; float col[4], finalcol[4]; @@ -613,7 +613,7 @@ static void draw_image_buffer(const bContext *C, } else { float shuffle[4] = {0.0f, 0.0f, 0.0f, 0.0f}; - unsigned char *display_buffer; + uchar *display_buffer; void *cache_handle; ColorManagedViewSettings *view_settings; ColorManagedDisplaySettings *display_settings; @@ -760,7 +760,7 @@ static void draw_image_paint_helpers( float col[4] = {1.0f, 1.0f, 1.0f, brush->clone.alpha}; UI_view2d_view_to_region(&ar->v2d, brush->clone.offset[0], brush->clone.offset[1], &x, &y); - unsigned char *display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle); + uchar *display_buffer = IMB_display_buffer_acquire_ctx(C, ibuf, &cache_handle); if (!display_buffer) { BKE_image_release_ibuf(brush->clone.image, ibuf, NULL); @@ -794,8 +794,8 @@ static void draw_image_paint_helpers( } } -static void draw_udim_tile_grid(unsigned int pos_attr, - unsigned int color_attr, +static void draw_udim_tile_grid(uint pos_attr, + uint color_attr, ARegion *ar, int x, int y, @@ -832,8 +832,8 @@ static void draw_udim_tile_grids(ARegion *ar, SpaceImage *sima, Image *ima) float stepy = BLI_rcti_size_y(&ar->v2d.mask) / BLI_rctf_size_y(&ar->v2d.cur); GPUVertFormat *format = immVertexFormat(); - unsigned int pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); - unsigned color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 2, GPU_FETCH_FLOAT); + uint color = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR); immBegin(GPU_PRIM_LINES, 8 * num_tiles); diff --git a/source/blender/editors/space_node/drawnode.c b/source/blender/editors/space_node/drawnode.c index 35c9082b54c..121c597c1bb 100644 --- a/source/blender/editors/space_node/drawnode.c +++ b/source/blender/editors/space_node/drawnode.c @@ -376,7 +376,7 @@ static void node_draw_frame_label(bNodeTree *ntree, bNode *node, const float asp const int font_size = data->label_size / aspect; const float margin = (float)(NODE_DY / 4); int label_height; - unsigned char color[3]; + uchar color[3]; nodeLabel(ntree, node, label, sizeof(label)); @@ -3483,7 +3483,7 @@ void draw_nodespace_back_pix(const bContext *C, y = (ar->winy - snode->zoom * ibuf->y) / 2 + snode->yof; if (ibuf->rect || ibuf->rect_float) { - unsigned char *display_buffer = NULL; + uchar *display_buffer = NULL; void *cache_handle = NULL; if (snode->flag & (SNODE_SHOW_R | SNODE_SHOW_G | SNODE_SHOW_B | SNODE_SHOW_ALPHA)) { @@ -3707,11 +3707,11 @@ static struct { GPUBatch *batch; /* for batching line together */ GPUBatch *batch_single; /* for single line */ GPUVertBuf *inst_vbo; - unsigned int p0_id, p1_id, p2_id, p3_id; - unsigned int colid_id; + uint p0_id, p1_id, p2_id, p3_id; + uint colid_id; GPUVertBufRaw p0_step, p1_step, p2_step, p3_step; GPUVertBufRaw colid_step; - unsigned int count; + uint count; bool enabled; } g_batch_link = {0}; @@ -3727,11 +3727,11 @@ static void nodelink_batch_reset(void) } static void set_nodelink_vertex(GPUVertBuf *vbo, - unsigned int uv_id, - unsigned int pos_id, - unsigned int exp_id, - unsigned int v, - const unsigned char uv[2], + uint uv_id, + uint pos_id, + uint exp_id, + uint v, + const uchar uv[2], const float pos[2], const float exp[2]) { @@ -3756,7 +3756,7 @@ static void nodelink_batch_init(void) int v = 0; for (int k = 0; k < 2; k++) { - unsigned char uv[2] = {0, 0}; + uchar uv[2] = {0, 0}; float pos[2] = {0.0f, 0.0f}; float exp[2] = {0.0f, 1.0f}; @@ -4000,8 +4000,7 @@ void node_draw_link(View2D *v2d, SpaceNode *snode, bNodeLink *link) // node_draw_link_straight(v2d, snode, link, th_col1, do_shaded, th_col2, do_triple, th_col3); } -void ED_node_draw_snap( - View2D *v2d, const float cent[2], float size, NodeBorder border, unsigned pos) +void ED_node_draw_snap(View2D *v2d, const float cent[2], float size, NodeBorder border, uint pos) { immBegin(GPU_PRIM_LINES, 4); diff --git a/source/blender/editors/space_node/node_draw.c b/source/blender/editors/space_node/node_draw.c index 2081c69a1a4..6e165df3e2b 100644 --- a/source/blender/editors/space_node/node_draw.c +++ b/source/blender/editors/space_node/node_draw.c @@ -722,18 +722,18 @@ static void node_socket_draw(const bContext *C, bNodeTree *ntree, PointerRNA node_ptr, bNodeSocket *sock, - unsigned pos_id, - unsigned col_id, - unsigned shape_id, - unsigned size_id, - unsigned outline_col_id, + uint pos_id, + uint col_id, + uint shape_id, + uint size_id, + uint outline_col_id, float size, bool selected) { PointerRNA ptr; float color[4]; float outline_color[4]; - unsigned int flags = 0; + uint flags = 0; RNA_pointer_create((ID *)ntree, &RNA_NodeSocket, sock, &ptr); sock->typeinfo->draw_color((bContext *)C, &ptr, &node_ptr, color); diff --git a/source/blender/editors/space_outliner/outliner_draw.c b/source/blender/editors/space_outliner/outliner_draw.c index a341be5bf65..8bd1fae645f 100644 --- a/source/blender/editors/space_outliner/outliner_draw.c +++ b/source/blender/editors/space_outliner/outliner_draw.c @@ -2700,7 +2700,7 @@ static void outliner_draw_iconrow_number(const uiFontStyle *fstyle, color); /* Now the numbers. */ - unsigned char text_col[4]; + uchar text_col[4]; UI_GetThemeColor4ubv(TH_TEXT_HI, text_col); text_col[3] = 255; @@ -2953,7 +2953,7 @@ static void outliner_draw_tree_element(bContext *C, float ufac = UI_UNIT_X / 20.0f; int offsx = 0; eOLDrawState active = OL_DRAWSEL_NONE; - unsigned char text_color[4]; + uchar text_color[4]; UI_GetThemeColor4ubv(TH_TEXT, text_color); float icon_bgcolor[4], icon_border[4]; outliner_icon_background_colors(icon_bgcolor, icon_border); @@ -3208,11 +3208,11 @@ static void outliner_draw_tree_element(bContext *C, } } -static void outliner_draw_hierarchy_lines_recursive(unsigned pos, +static void outliner_draw_hierarchy_lines_recursive(uint pos, SpaceOutliner *soops, ListBase *lb, int startx, - const unsigned char col[4], + const uchar col[4], bool draw_grayed_out, int *starty) { @@ -3234,7 +3234,7 @@ static void outliner_draw_hierarchy_lines_recursive(unsigned pos, dash.step_len = UI_UNIT_X / dash.steps_num; dash.gap_len = dash.step_len / 2; - const unsigned char grayed_alpha = col[3] / 2; + const uchar grayed_alpha = col[3] / 2; /* For vertical lines between objects. */ y1 = y2 = y1_dashed = y2_dashed = *starty; @@ -3316,7 +3316,7 @@ static void outliner_draw_hierarchy_lines(SpaceOutliner *soops, { GPUVertFormat *format = immVertexFormat(); uint pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_I32, 2, GPU_FETCH_INT_TO_FLOAT); - unsigned char col[4]; + uchar col[4]; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); UI_GetThemeColorBlend3ubv(TH_BACK, TH_TEXT, 0.4f, col); @@ -3369,7 +3369,7 @@ static void outliner_draw_struct_marks(ARegion *ar, } } -static void outliner_draw_highlights_recursive(unsigned pos, +static void outliner_draw_highlights_recursive(uint pos, const ARegion *ar, const SpaceOutliner *soops, const ListBase *lb, diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c index 2cdfd8039c1..0daa5aa53ae 100644 --- a/source/blender/editors/space_view3d/drawobject.c +++ b/source/blender/editors/space_view3d/drawobject.c @@ -87,7 +87,7 @@ static void circball_array_fill(float verts[CIRCLE_RESOL][3], } } -void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], unsigned pos) +void imm_drawcircball(const float cent[3], float rad, const float tmat[4][4], uint pos) { float verts[CIRCLE_RESOL][3]; |