From 600a627f6e326f4542a876e6e82f771cd3da218f Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Fri, 3 Apr 2020 16:21:24 +1100 Subject: Cleanup: use abbreviated names for unsigned types in editors --- source/blender/editors/sculpt_paint/paint_cursor.c | 18 +--- .../blender/editors/sculpt_paint/paint_image_2d.c | 107 ++++++++++----------- .../editors/sculpt_paint/paint_image_proj.c | 72 +++++++------- source/blender/editors/sculpt_paint/paint_utils.c | 27 ++---- .../editors/sculpt_paint/paint_vertex_color_ops.c | 2 +- source/blender/editors/sculpt_paint/sculpt_uv.c | 10 +- 6 files changed, 107 insertions(+), 129 deletions(-) (limited to 'source/blender/editors/sculpt_paint') diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c index c035863203b..04ca5770a97 100644 --- a/source/blender/editors/sculpt_paint/paint_cursor.c +++ b/source/blender/editors/sculpt_paint/paint_cursor.c @@ -876,12 +876,8 @@ static bool paint_draw_alpha_overlay(UnifiedPaintSettings *ups, return alpha_overlay_active; } -BLI_INLINE void draw_tri_point(unsigned int pos, - const float sel_col[4], - float pivot_col[4], - float *co, - float width, - bool selected) +BLI_INLINE void draw_tri_point( + uint pos, const float sel_col[4], float pivot_col[4], float *co, float width, bool selected) { immUniformColor4fv(selected ? sel_col : pivot_col); @@ -910,12 +906,8 @@ BLI_INLINE void draw_tri_point(unsigned int pos, immEnd(); } -BLI_INLINE void draw_rect_point(unsigned int pos, - const float sel_col[4], - float handle_col[4], - float *co, - float width, - bool selected) +BLI_INLINE void draw_rect_point( + uint pos, const float sel_col[4], float handle_col[4], float *co, float width, bool selected) { immUniformColor4fv(selected ? sel_col : handle_col); @@ -935,7 +927,7 @@ BLI_INLINE void draw_rect_point(unsigned int pos, imm_draw_box_wire_2d(pos, minx, miny, maxx, maxy); } -BLI_INLINE void draw_bezier_handle_lines(unsigned int pos, float sel_col[4], BezTriple *bez) +BLI_INLINE void draw_bezier_handle_lines(uint pos, float sel_col[4], BezTriple *bez) { immUniformColor4f(0.0f, 0.0f, 0.0f, 0.5f); GPU_line_width(3.0f); diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 73c099c9407..3485941d3df 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -80,11 +80,11 @@ typedef struct BrushPainterCache { ImBuf *ibuf; ImBuf *texibuf; - unsigned short *curve_mask; - unsigned short *tex_mask; - unsigned short *tex_mask_old; - unsigned int tex_mask_old_w; - unsigned int tex_mask_old_h; + ushort *curve_mask; + ushort *tex_mask; + ushort *tex_mask_old; + uint tex_mask_old_w; + uint tex_mask_old_h; int image_size[2]; } BrushPainterCache; @@ -228,7 +228,7 @@ static void brush_imbuf_tex_co(rctf *mapping, int x, int y, float texco[3]) } /* create a mask with the mask texture */ -static unsigned short *brush_painter_mask_ibuf_new(BrushPainter *painter, const int size) +static ushort *brush_painter_mask_ibuf_new(BrushPainter *painter, const int size) { Scene *scene = painter->scene; Brush *brush = painter->brush; @@ -236,10 +236,10 @@ static unsigned short *brush_painter_mask_ibuf_new(BrushPainter *painter, const struct ImagePool *pool = painter->pool; float texco[3]; - unsigned short *mask, *m; + ushort *mask, *m; int x, y, thread = 0; - mask = MEM_mallocN(sizeof(unsigned short) * size * size, "brush_painter_mask"); + mask = MEM_mallocN(sizeof(ushort) * size * size, "brush_painter_mask"); m = mask; for (y = 0; y < size; y++) { @@ -247,7 +247,7 @@ static unsigned short *brush_painter_mask_ibuf_new(BrushPainter *painter, const float res; brush_imbuf_tex_co(&mask_mapping, x, y, texco); res = BKE_brush_sample_masktex(scene, brush, texco, thread, pool); - *m = (unsigned short)(65535.0f * res); + *m = (ushort)(65535.0f * res); } } @@ -257,7 +257,7 @@ static unsigned short *brush_painter_mask_ibuf_new(BrushPainter *painter, const /* update rectangular section of the brush image */ static void brush_painter_mask_imbuf_update(BrushPainter *painter, ImagePaintTile *tile, - unsigned short *tex_mask_old, + ushort *tex_mask_old, int origx, int origy, int w, @@ -271,14 +271,14 @@ static void brush_painter_mask_imbuf_update(BrushPainter *painter, BrushPainterCache *cache = &tile->cache; rctf tex_mapping = painter->mask_mapping; struct ImagePool *pool = painter->pool; - unsigned short res; + ushort res; bool use_texture_old = (tex_mask_old != NULL); int x, y, thread = 0; - unsigned short *tex_mask = cache->tex_mask; - unsigned short *tex_mask_cur = cache->tex_mask_old; + ushort *tex_mask = cache->tex_mask; + ushort *tex_mask_cur = cache->tex_mask_old; /* fill pixels */ for (y = origy; y < h; y++) { @@ -287,13 +287,12 @@ static void brush_painter_mask_imbuf_update(BrushPainter *painter, float texco[3]; /* handle byte pixel */ - unsigned short *b = tex_mask + (y * diameter + x); - unsigned short *t = tex_mask_cur + (y * diameter + x); + ushort *b = tex_mask + (y * diameter + x); + ushort *t = tex_mask_cur + (y * diameter + x); if (!use_texture_old) { brush_imbuf_tex_co(&tex_mapping, x, y, texco); - res = (unsigned short)(65535.0f * - BKE_brush_sample_masktex(scene, brush, texco, thread, pool)); + res = (ushort)(65535.0f * BKE_brush_sample_masktex(scene, brush, texco, thread, pool)); } /* read from old texture buffer */ @@ -320,19 +319,17 @@ static void brush_painter_mask_imbuf_partial_update(BrushPainter *painter, const int diameter) { BrushPainterCache *cache = &tile->cache; - unsigned short *tex_mask_old; + ushort *tex_mask_old; int destx, desty, srcx, srcy, w, h, x1, y1, x2, y2; /* create brush image buffer if it didn't exist yet */ if (!cache->tex_mask) { - cache->tex_mask = MEM_mallocN(sizeof(unsigned short) * diameter * diameter, - "brush_painter_mask"); + cache->tex_mask = MEM_mallocN(sizeof(ushort) * diameter * diameter, "brush_painter_mask"); } /* create new texture image buffer with coordinates relative to old */ tex_mask_old = cache->tex_mask_old; - cache->tex_mask_old = MEM_mallocN(sizeof(unsigned short) * diameter * diameter, - "brush_painter_mask"); + cache->tex_mask_old = MEM_mallocN(sizeof(ushort) * diameter * diameter, "brush_painter_mask"); if (tex_mask_old) { ImBuf maskibuf; @@ -393,18 +390,18 @@ static void brush_painter_mask_imbuf_partial_update(BrushPainter *painter, } /* create a mask with the falloff strength */ -static unsigned short *brush_painter_curve_mask_new(BrushPainter *painter, - int diameter, - float radius, - const float pos[2]) +static ushort *brush_painter_curve_mask_new(BrushPainter *painter, + int diameter, + float radius, + const float pos[2]) { Brush *brush = painter->brush; int offset = (int)floorf(diameter / 2.0f); - unsigned short *mask, *m; + ushort *mask, *m; - mask = MEM_mallocN(sizeof(unsigned short) * diameter * diameter, "brush_painter_mask"); + mask = MEM_mallocN(sizeof(ushort) * diameter * diameter, "brush_painter_mask"); m = mask; int aa_samples = 1.0f / (radius * 0.20f); @@ -458,7 +455,7 @@ static unsigned short *brush_painter_curve_mask_new(BrushPainter *painter, total_samples += curve * hardness_factor; } } - *m = (unsigned short)(total_samples * norm_factor); + *m = (ushort)(total_samples * norm_factor); } } @@ -528,7 +525,7 @@ static ImBuf *brush_painter_imbuf_new( } else { /* write to byte pixel */ - unsigned char *dst = (unsigned char *)ibuf->rect + (y * size + x) * 4; + uchar *dst = (uchar *)ibuf->rect + (y * size + x) * 4; rgb_float_to_uchar(dst, rgba); dst[3] = unit_float_to_uchar_clamp(rgba[3]); @@ -624,16 +621,16 @@ static void brush_painter_imbuf_update(BrushPainter *painter, bf[3] = rgba[3]; } else { - unsigned char crgba[4]; + uchar crgba[4]; /* handle byte pixel */ - unsigned char *b = (unsigned char *)ibuf->rect + (y * ibuf->x + x) * 4; - unsigned char *t = (unsigned char *)texibuf->rect + (y * texibuf->x + x) * 4; + uchar *b = (uchar *)ibuf->rect + (y * ibuf->x + x) * 4; + uchar *t = (uchar *)texibuf->rect + (y * texibuf->x + x) * 4; /* read from old texture buffer */ if (use_texture_old) { - unsigned char *ot = (unsigned char *)oldtexibuf->rect + - ((y - origy + yt) * oldtexibuf->x + (x - origx + xt)) * 4; + uchar *ot = (uchar *)oldtexibuf->rect + + ((y - origy + yt) * oldtexibuf->x + (x - origx + xt)) * 4; crgba[0] = ot[0]; crgba[1] = ot[1]; crgba[2] = ot[2]; @@ -975,7 +972,7 @@ static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, float r_rgb[4]) copy_v4_v4(r_rgb, rrgbf); } else { - unsigned char *rrgb = (unsigned char *)ibuf->rect + (ibuf->x * y + x) * 4; + uchar *rrgb = (uchar *)ibuf->rect + (ibuf->x * y + x) * 4; straight_uchar_to_premul_float(r_rgb, rrgb); } } @@ -1001,8 +998,8 @@ static void paint_2d_ibuf_rgb_set( rrgbf[3] = rgb[3]; } else { - unsigned char straight[4]; - unsigned char *rrgb = (unsigned char *)ibuf->rect + (ibuf->x * y + x) * 4; + uchar straight[4]; + uchar *rrgb = (uchar *)ibuf->rect + (ibuf->x * y + x) * 4; premul_float_to_straight_uchar(straight, rgb); rrgb[0] = straight[0]; @@ -1329,7 +1326,7 @@ static void paint_2d_do_making_brush(ImagePaintState *s, for (int ty = tiley; ty <= tileh; ty++) { for (int tx = tilex; tx <= tilew; tx++) { /* retrieve original pixels + mask from undo buffer */ - unsigned short *mask; + ushort *mask; int origx = region->destx - tx * ED_IMAGE_UNDO_TILE_SIZE; int origy = region->desty - ty * ED_IMAGE_UNDO_TILE_SIZE; @@ -1829,7 +1826,7 @@ static void paint_2d_fill_add_pixel_byte(const int x_px, if (!BLI_BITMAP_TEST(touched, coordinate)) { float color_f[4]; - unsigned char *color_b = (unsigned char *)(ibuf->rect + coordinate); + uchar *color_b = (uchar *)(ibuf->rect + coordinate); rgba_uchar_to_float(color_f, color_b); straight_to_premul_v4(color_f); @@ -1895,7 +1892,7 @@ void paint_2d_bucket_fill(const bContext *C, ImBuf *ibuf; int x_px, y_px; - unsigned int color_b; + uint color_b; float color_f[4]; float strength = br ? BKE_brush_alpha_get(s->scene, br) : 1.0f; @@ -1935,7 +1932,7 @@ void paint_2d_bucket_fill(const bContext *C, * be in gamma space. strictly speaking this is not correct, but blender does not paint * byte images in linear space */ if (!do_float) { - linearrgb_to_srgb_uchar3((unsigned char *)&color_b, color); + linearrgb_to_srgb_uchar3((uchar *)&color_b, color); *(((char *)&color_b) + 3) = strength * 255; } else { @@ -1959,9 +1956,9 @@ void paint_2d_bucket_fill(const bContext *C, else { for (x_px = 0; x_px < ibuf->x; x_px++) { for (y_px = 0; y_px < ibuf->y; y_px++) { - blend_color_mix_byte((unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), - (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), - (unsigned char *)&color_b); + blend_color_mix_byte((uchar *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), + (uchar *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), + (uchar *)&color_b); } } } @@ -2000,7 +1997,7 @@ void paint_2d_bucket_fill(const bContext *C, } else { int pixel_color_b = *(ibuf->rect + coordinate); - rgba_uchar_to_float(pixel_color, (unsigned char *)&pixel_color_b); + rgba_uchar_to_float(pixel_color, (uchar *)&pixel_color_b); straight_to_premul_v4(pixel_color); } @@ -2055,9 +2052,9 @@ void paint_2d_bucket_fill(const bContext *C, while (!BLI_stack_is_empty(stack)) { BLI_stack_pop(stack, &coordinate); - IMB_blend_color_byte((unsigned char *)(ibuf->rect + coordinate), - (unsigned char *)(ibuf->rect + coordinate), - (unsigned char *)&color_b, + IMB_blend_color_byte((uchar *)(ibuf->rect + coordinate), + (uchar *)(ibuf->rect + coordinate), + (uchar *)&color_b, br->blend); /* reconstruct the coordinates here */ @@ -2117,7 +2114,7 @@ void paint_2d_gradient_fill( ImBuf *ibuf; int x_px, y_px; - unsigned int color_b; + uint color_b; float color_f[4]; float image_init[2], image_final[2]; float tangent[2]; @@ -2212,11 +2209,11 @@ void paint_2d_gradient_fill( BKE_colorband_evaluate(br->gradient, f, color_f); linearrgb_to_srgb_v3_v3(color_f, color_f); - rgba_float_to_uchar((unsigned char *)&color_b, color_f); - ((unsigned char *)&color_b)[3] *= brush_alpha; - IMB_blend_color_byte((unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), - (unsigned char *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), - (unsigned char *)&color_b, + rgba_float_to_uchar((uchar *)&color_b, color_f); + ((uchar *)&color_b)[3] *= brush_alpha; + IMB_blend_color_byte((uchar *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), + (uchar *)(ibuf->rect + ((size_t)y_px) * ibuf->x + x_px), + (uchar *)&color_b, br->blend); } } diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index c56ce8fd183..6494e53e182 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -112,7 +112,7 @@ static void partial_redraw_array_init(ImagePaintPartialRedraw *pr); /* Defines and Structs */ /* unit_float_to_uchar_clamp as inline function */ -BLI_INLINE unsigned char f_to_char(const float val) +BLI_INLINE uchar f_to_char(const float val) { return unit_float_to_uchar_clamp(val); } @@ -206,7 +206,7 @@ typedef struct ProjPaintImage { volatile void **undoRect; /** The mask accumulation must happen on canvas, not on space screen bucket. * Here we store the mask rectangle. */ - unsigned short **maskRect; + ushort **maskRect; /** Store flag to enforce validation of undo rectangle. */ bool **valid; bool touch; @@ -279,7 +279,7 @@ typedef struct ProjPaintState { /** bucketRect aligned array linkList of faces overlapping each bucket. */ LinkNode **bucketFaces; /** store if the bucks have been initialized. */ - unsigned char *bucketFlags; + uchar *bucketFlags; /** store options per vert, now only store if the vert is pointing away from the view. */ char *vertFlags; @@ -443,13 +443,13 @@ typedef union pixelPointer { /** float buffer. */ float *f_pt; /** 2 ways to access a char buffer. */ - unsigned int *uint_pt; - unsigned char *ch_pt; + uint *uint_pt; + uchar *ch_pt; } PixelPointer; typedef union pixelStore { - unsigned char ch[4]; - unsigned int uint; + uchar ch[4]; + uint uint; float f[4]; } PixelStore; @@ -461,17 +461,17 @@ typedef struct ProjPixel { short x_px, y_px; /** if anyone wants to paint onto more than 65535 images they can bite me. */ - unsigned short image_index; - unsigned char bb_cell_index; + ushort image_index; + uchar bb_cell_index; /* for various reasons we may want to mask out painting onto this pixel */ - unsigned short mask; + ushort mask; /* Only used when the airbrush is disabled. * Store the max mask value to avoid painting over an area with a lower opacity * with an advantage that we can avoid touching the pixel at all, if the * new mask value is lower then mask_accum */ - unsigned short *mask_accum; + ushort *mask_accum; /* horrible hack, store tile valid flag pointer here to re-validate tiles * used for anchored and drag-dot strokes */ @@ -491,7 +491,7 @@ typedef struct ProjPixelClone { typedef struct { SpinLock *lock; bool masked; - unsigned short tile_width; + ushort tile_width; ImBuf **tmpibuf; ProjPaintImage *pjima; } TileInfo; @@ -717,11 +717,8 @@ static void uvco_to_wrapped_pxco(const float uv[2], int ibuf_x, int ibuf_y, floa /* Set the top-most face color that the screen space coord 'pt' touches * (or return 0 if none touch) */ -static bool project_paint_PickColor(const ProjPaintState *ps, - const float pt[2], - float *rgba_fp, - unsigned char *rgba, - const bool interp) +static bool project_paint_PickColor( + const ProjPaintState *ps, const float pt[2], float *rgba_fp, uchar *rgba, const bool interp) { const MLoopTri *lt; const float *lt_tri_uv[3]; @@ -774,7 +771,7 @@ static bool project_paint_PickColor(const ProjPaintState *ps, bilinear_interpolation_color_wrap(ibuf, rgba, NULL, x, y); } else { - unsigned char rgba_tmp[4]; + uchar rgba_tmp[4]; bilinear_interpolation_color_wrap(ibuf, rgba_tmp, NULL, x, y); straight_uchar_to_premul_float(rgba_fp, rgba_tmp); } @@ -795,8 +792,7 @@ static bool project_paint_PickColor(const ProjPaintState *ps, premul_float_to_straight_uchar(rgba, rgba_tmp_fp); } else { - *((unsigned int *)rgba) = *(unsigned int *)(((char *)ibuf->rect) + - ((xi + yi * ibuf->x) * 4)); + *((uint *)rgba) = *(uint *)(((char *)ibuf->rect) + ((xi + yi * ibuf->x) * 4)); } } @@ -805,7 +801,7 @@ static bool project_paint_PickColor(const ProjPaintState *ps, copy_v4_v4(rgba_fp, (ibuf->rect_float + ((xi + yi * ibuf->x) * 4))); } else { - unsigned char *tmp_ch = ((unsigned char *)ibuf->rect) + ((xi + yi * ibuf->x) * 4); + uchar *tmp_ch = ((uchar *)ibuf->rect) + ((xi + yi * ibuf->x) * 4); straight_uchar_to_premul_float(rgba_fp, tmp_ch); } } @@ -1150,8 +1146,8 @@ static bool check_seam(const ProjPaintState *ps, const MLoopTri *orig_lt = &ps->mlooptri_eval[orig_face]; const float *orig_lt_tri_uv[3] = {PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, orig_lt)}; /* vert indices from face vert order indices */ - const unsigned int i1 = ps->mloop_eval[orig_lt->tri[orig_i1_fidx]].v; - const unsigned int i2 = ps->mloop_eval[orig_lt->tri[orig_i2_fidx]].v; + const uint i1 = ps->mloop_eval[orig_lt->tri[orig_i1_fidx]].v; + const uint i2 = ps->mloop_eval[orig_lt->tri[orig_i2_fidx]].v; LinkNode *node; /* index in face */ int i1_fidx = -1, i2_fidx = -1; @@ -1641,7 +1637,7 @@ static float screen_px_line_point_factor_v2_persp(const ProjPaintState *ps, static void project_face_pixel(const float *lt_tri_uv[3], ImBuf *ibuf_other, const float w[3], - unsigned char rgba_ub[4], + uchar rgba_ub[4], float rgba_f[4]) { float uv_other[2], x, y; @@ -1677,7 +1673,7 @@ static float project_paint_uvpixel_mask(const ProjPaintState *ps, const float *lt_other_tri_uv[3] = {PS_LOOPTRI_AS_UV_3(ps->poly_to_loop_uv, lt_other)}; /* BKE_image_acquire_ibuf - TODO - this may be slow */ - unsigned char rgba_ub[4]; + uchar rgba_ub[4]; float rgba_f[4]; project_face_pixel(lt_other_tri_uv, ibuf_other, w, rgba_ub, rgba_f); @@ -1937,8 +1933,8 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps, zero_v4(projPixel->newColor.f); } else { - projPixel->pixel.ch_pt = (unsigned char *)(ibuf->rect + (x_px + y_px * ibuf->x)); - projPixel->origColor.uint_pt = (unsigned int *)projima->undoRect[tile_index] + tile_offset; + projPixel->pixel.ch_pt = (uchar *)(ibuf->rect + (x_px + y_px * ibuf->x)); + projPixel->origColor.uint_pt = (uint *)projima->undoRect[tile_index] + tile_offset; projPixel->newColor.uint = 0; } @@ -1952,7 +1948,7 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps, projPixel->x_px = x_px; projPixel->y_px = y_px; - projPixel->mask = (unsigned short)(mask * 65535); + projPixel->mask = (ushort)(mask * 65535); if (ps->do_masking) { projPixel->mask_accum = projima->maskRect[tile_index] + tile_offset; } @@ -1984,7 +1980,7 @@ static ProjPixel *project_paint_uvpixel_init(const ProjPaintState *ps, lt_other_tri_uv, ibuf_other, w, NULL, ((ProjPixelClone *)projPixel)->clonepx.f); } else { /* from char to float */ - unsigned char rgba_ub[4]; + uchar rgba_ub[4]; float rgba[4]; project_face_pixel(lt_other_tri_uv, ibuf_other, w, rgba_ub, NULL); if (ps->use_colormanagement) { @@ -4844,15 +4840,15 @@ typedef struct ProjectHandle { static void do_projectpaint_clone(ProjPaintState *ps, ProjPixel *projPixel, float mask) { - const unsigned char *clone_pt = ((ProjPixelClone *)projPixel)->clonepx.ch; + const uchar *clone_pt = ((ProjPixelClone *)projPixel)->clonepx.ch; if (clone_pt[3]) { - unsigned char clone_rgba[4]; + uchar clone_rgba[4]; clone_rgba[0] = clone_pt[0]; clone_rgba[1] = clone_pt[1]; clone_rgba[2] = clone_pt[2]; - clone_rgba[3] = (unsigned char)(clone_pt[3] * mask); + clone_rgba[3] = (uchar)(clone_pt[3] * mask); if (ps->do_masking) { IMB_blend_color_byte( @@ -4895,7 +4891,7 @@ static void do_projectpaint_smear(ProjPaintState *ps, LinkNode **smearPixels, const float co[2]) { - unsigned char rgba_ub[4]; + uchar rgba_ub[4]; if (project_paint_PickColor(ps, co, NULL, rgba_ub, 1) == 0) { return; @@ -5016,7 +5012,7 @@ static void do_projectpaint_soften(ProjPaintState *ps, } if (LIKELY(accum_tot != 0)) { - unsigned char *rgba_ub = projPixel->newColor.ch; + uchar *rgba_ub = projPixel->newColor.ch; mul_v4_fl(rgba, 1.0f / (float)accum_tot); @@ -5061,7 +5057,7 @@ static void do_projectpaint_draw(ProjPaintState *ps, float v) { float rgb[3]; - unsigned char rgba_ub[4]; + uchar rgba_ub[4]; if (ps->is_texbrush) { mul_v3_v3v3(rgb, texrgb, ps->paint_color_linear); @@ -5119,7 +5115,7 @@ static void do_projectpaint_draw_f(ProjPaintState *ps, static void do_projectpaint_mask(ProjPaintState *ps, ProjPixel *projPixel, float mask) { - unsigned char rgba_ub[4]; + uchar rgba_ub[4]; rgba_ub[0] = rgba_ub[1] = rgba_ub[2] = ps->stencil_value * 255.0f; rgba_ub[3] = f_to_char(mask); @@ -5204,7 +5200,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool), /* for smear only */ float pos_ofs[2] = {0}; float co[2]; - unsigned short mask_short; + ushort mask_short; const float brush_alpha = BKE_brush_alpha_get(ps->scene, brush); const float brush_radius = ps->brush_size; /* avoid a square root with every dist comparison */ @@ -5468,7 +5464,7 @@ static void do_projectpaint_thread(TaskPool *__restrict UNUSED(pool), } mask = min_ff(mask, 65535.0f); - mask_short = (unsigned short)mask; + mask_short = (ushort)mask; if (mask_short > *projPixel->mask_accum) { *projPixel->mask_accum = mask_short; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index e67d43d4571..60b4a2f8e0c 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -294,12 +294,8 @@ static void imapaint_tri_weights(float matrix[4][4], } /* compute uv coordinates of mouse in face */ -static void imapaint_pick_uv(Mesh *me_eval, - Scene *scene, - Object *ob_eval, - unsigned int faceindex, - const int xy[2], - float uv[2]) +static void imapaint_pick_uv( + Mesh *me_eval, Scene *scene, Object *ob_eval, uint faceindex, const int xy[2], float uv[2]) { int i, findex; float p[2], w[3], absw, minabsw; @@ -376,10 +372,7 @@ static void imapaint_pick_uv(Mesh *me_eval, } /* returns 0 if not found, otherwise 1 */ -static int imapaint_pick_face(ViewContext *vc, - const int mval[2], - unsigned int *r_index, - unsigned int totpoly) +static int imapaint_pick_face(ViewContext *vc, const int mval[2], uint *r_index, uint totpoly) { if (totpoly == 0) { return 0; @@ -389,7 +382,7 @@ static int imapaint_pick_face(ViewContext *vc, ED_view3d_select_id_validate(vc); *r_index = DRW_select_buffer_sample_point(vc->depsgraph, vc->region, vc->v3d, mval); - if ((*r_index) == 0 || (*r_index) > (unsigned int)totpoly) { + if ((*r_index) == 0 || (*r_index) > (uint)totpoly) { return 0; } @@ -464,8 +457,8 @@ void paint_sample_color( Palette *palette = BKE_paint_palette(paint); PaletteColor *color = NULL; Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C)); - unsigned int col; - const unsigned char *cp; + uint col; + const uchar *cp; CLAMP(x, 0, region->winx); CLAMP(y, 0, region->winy); @@ -497,8 +490,8 @@ void paint_sample_color( ViewContext vc; const int mval[2] = {x, y}; - unsigned int faceindex; - unsigned int totpoly = me->totpoly; + uint faceindex; + uint totpoly = me->totpoly; if (CustomData_has_layer(&me_eval->ldata, CD_MLOOPUV)) { ED_view3d_viewcontext_init(C, &vc, depsgraph); @@ -563,7 +556,7 @@ void paint_sample_color( } } else { - unsigned char rgba[4]; + uchar rgba[4]; bilinear_interpolation_color_wrap(ibuf, rgba, NULL, u, v); if (use_palette) { rgb_uchar_to_float(color->rgb, rgba); @@ -598,7 +591,7 @@ void paint_sample_color( x + region->winrct.xmin, y + region->winrct.ymin, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, &col); glReadBuffer(GL_BACK); } - cp = (unsigned char *)&col; + cp = (uchar *)&col; if (use_palette) { rgb_uchar_to_float(color->rgb, cp); diff --git a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c index 6e706c907dd..addf7e9f868 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_color_ops.c @@ -109,7 +109,7 @@ static int vertex_color_set_exec(bContext *C, wmOperator *UNUSED(op)) { Scene *scene = CTX_data_scene(C); Object *obact = CTX_data_active_object(C); - unsigned int paintcol = vpaint_get_current_col(scene, scene->toolsettings->vpaint, false); + uint paintcol = vpaint_get_current_col(scene, scene->toolsettings->vpaint, false); if (vertex_color_set(obact, paintcol)) { WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, obact); diff --git a/source/blender/editors/sculpt_paint/sculpt_uv.c b/source/blender/editors/sculpt_paint/sculpt_uv.c index f364c174f0f..0a5814be626 100644 --- a/source/blender/editors/sculpt_paint/sculpt_uv.c +++ b/source/blender/editors/sculpt_paint/sculpt_uv.c @@ -70,8 +70,8 @@ typedef struct UvAdjacencyElement { } UvAdjacencyElement; typedef struct UvEdge { - unsigned int uv1; - unsigned int uv2; + uint uv1; + uint uv2; /* general use flag * (Used to check if edge is boundary here, and propagates to adjacency elements) */ char flag; @@ -315,7 +315,7 @@ static void uv_sculpt_stroke_apply(bContext *C, Scene *scene = CTX_data_scene(C); ARegion *region = CTX_wm_region(C); BMEditMesh *em = BKE_editmesh_from_object(obedit); - unsigned int tool; + uint tool; UvSculptData *sculptdata = (UvSculptData *)op->customdata; SpaceImage *sima; int invert; @@ -386,7 +386,7 @@ static void uv_sculpt_stroke_apply(bContext *C, * Smooth Tool */ else if (tool == UV_SCULPT_TOOL_RELAX) { - unsigned int method = toolsettings->uv_relax_method; + uint method = toolsettings->uv_relax_method; if (method == UV_SCULPT_TOOL_RELAX_HC) { HC_relaxation_iteration_uv(em, sculptdata, co, alpha, radius, aspectRatio); } @@ -464,7 +464,7 @@ static int uv_element_offset_from_face_get( return element - map->buf; } -static unsigned int uv_edge_hash(const void *key) +static uint uv_edge_hash(const void *key) { const UvEdge *edge = key; return (BLI_ghashutil_uinthash(edge->uv2) + BLI_ghashutil_uinthash(edge->uv1)); -- cgit v1.2.3