[Bf-blender-cvs] [1434ab54a43] soc-2016-pbvh-painting: Cleanup: use shorter uchar, uint type names
Campbell Barton
noreply at git.blender.org
Wed Sep 27 02:51:12 CEST 2017
Commit: 1434ab54a431f324d929f9cc55a4f35f8184acaf
Author: Campbell Barton
Date: Wed Sep 27 11:03:47 2017 +1000
Branches: soc-2016-pbvh-painting
https://developer.blender.org/rB1434ab54a431f324d929f9cc55a4f35f8184acaf
Cleanup: use shorter uchar, uint type names
===================================================================
M source/blender/editors/sculpt_paint/paint_vertex.c
===================================================================
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c
index 54669e575d3..53e4f639540 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.c
+++ b/source/blender/editors/sculpt_paint/paint_vertex.c
@@ -173,13 +173,13 @@ static VPaint *new_vpaint(int wpaint)
return vp;
}
-unsigned int vpaint_get_current_col(Scene *scene, VPaint *vp)
+uint vpaint_get_current_col(Scene *scene, VPaint *vp)
{
Brush *brush = BKE_paint_brush(&vp->paint);
- unsigned char col[4];
+ uchar col[4];
rgb_float_to_uchar(col, BKE_brush_color_get(scene, brush));
col[3] = 255; /* alpha isn't used, could even be removed to speedup paint a little */
- return *(unsigned int *)col;
+ return *(uint *)col;
}
static void do_shared_vertexcol(Mesh *me, bool *mlooptag)
@@ -307,7 +307,7 @@ static void copy_wpaint_prev(VPaint *wp, MDeformVert *dverts, int dcount)
}
}
-bool ED_vpaint_fill(Object *ob, unsigned int paintcol)
+bool ED_vpaint_fill(Object *ob, uint paintcol)
{
Mesh *me;
const MPoly *mp;
@@ -349,7 +349,7 @@ bool ED_wpaint_fill(VPaint *wp, Object *ob, float paintweight)
const MPoly *mp;
MDeformWeight *dw, *dw_prev;
int vgroup_active, vgroup_mirror = -1;
- unsigned int index;
+ uint index;
const bool topology = (me->editflag & ME_EDIT_MIRROR_TOPO) != 0;
/* mutually exclusive, could be made into a */
@@ -369,14 +369,14 @@ bool ED_wpaint_fill(VPaint *wp, Object *ob, float paintweight)
copy_wpaint_prev(wp, me->dvert, me->totvert);
for (index = 0, mp = me->mpoly; index < me->totpoly; index++, mp++) {
- unsigned int fidx = mp->totloop - 1;
+ uint fidx = mp->totloop - 1;
if ((paint_selmode == SCE_SELECT_FACE) && !(mp->flag & ME_FACE_SEL)) {
continue;
}
do {
- unsigned int vidx = me->mloop[mp->loopstart + fidx].v;
+ uint vidx = me->mloop[mp->loopstart + fidx].v;
if (!me->dvert[vidx].flag) {
if ((paint_selmode == SCE_SELECT_VERTEX) && !(me->mvert[vidx].flag & SELECT)) {
@@ -525,7 +525,7 @@ void vpaint_dogamma(Scene *scene)
Object *ob;
float igam, fac;
int a, temp;
- unsigned char *cp, gamtab[256];
+ uchar *cp, gamtab[256];
ob = OBACT;
me = BKE_mesh_from_object(ob);
@@ -547,7 +547,7 @@ void vpaint_dogamma(Scene *scene)
}
a = 4 * me->totface;
- cp = (unsigned char *)me->mcol;
+ cp = (uchar *)me->mcol;
while (a--) {
cp[1] = gamtab[cp[1]];
@@ -559,11 +559,11 @@ void vpaint_dogamma(Scene *scene)
}
#endif
-BLI_INLINE unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE uint mcol_blend(uint col1, uint col2, int fac)
{
- unsigned char *cp1, *cp2, *cp;
+ uchar *cp1, *cp2, *cp;
int mfac;
- unsigned int col = 0;
+ uint col = 0;
if (fac == 0) {
return col1;
@@ -575,9 +575,9 @@ BLI_INLINE unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac
mfac = 255 - fac;
- cp1 = (unsigned char *)&col1;
- cp2 = (unsigned char *)&col2;
- cp = (unsigned char *)&col;
+ cp1 = (uchar *)&col1;
+ cp2 = (uchar *)&col2;
+ cp = (uchar *)&col;
/* Updated to use the rgb squared color model which blends nicer. */
int r1 = cp1[0] * cp1[0];
@@ -596,19 +596,19 @@ BLI_INLINE unsigned int mcol_blend(unsigned int col1, unsigned int col2, int fac
return col;
}
-BLI_INLINE unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE uint mcol_add(uint col1, uint col2, int fac)
{
- unsigned char *cp1, *cp2, *cp;
+ uchar *cp1, *cp2, *cp;
int temp;
- unsigned int col = 0;
+ uint col = 0;
if (fac == 0) {
return col1;
}
- cp1 = (unsigned char *)&col1;
- cp2 = (unsigned char *)&col2;
- cp = (unsigned char *)&col;
+ cp1 = (uchar *)&col1;
+ cp2 = (uchar *)&col2;
+ cp = (uchar *)&col;
temp = cp1[0] + divide_round_i((fac * cp2[0]), 255);
cp[0] = (temp > 254) ? 255 : temp;
@@ -621,19 +621,19 @@ BLI_INLINE unsigned int mcol_add(unsigned int col1, unsigned int col2, int fac)
return col;
}
-BLI_INLINE unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE uint mcol_sub(uint col1, uint col2, int fac)
{
- unsigned char *cp1, *cp2, *cp;
+ uchar *cp1, *cp2, *cp;
int temp;
- unsigned int col = 0;
+ uint col = 0;
if (fac == 0) {
return col1;
}
- cp1 = (unsigned char *)&col1;
- cp2 = (unsigned char *)&col2;
- cp = (unsigned char *)&col;
+ cp1 = (uchar *)&col1;
+ cp2 = (uchar *)&col2;
+ cp = (uchar *)&col;
temp = cp1[0] - divide_round_i((fac * cp2[0]), 255);
cp[0] = (temp < 0) ? 0 : temp;
@@ -646,11 +646,11 @@ BLI_INLINE unsigned int mcol_sub(unsigned int col1, unsigned int col2, int fac)
return col;
}
-BLI_INLINE unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE uint mcol_mul(uint col1, uint col2, int fac)
{
- unsigned char *cp1, *cp2, *cp;
+ uchar *cp1, *cp2, *cp;
int mfac;
- unsigned int col = 0;
+ uint col = 0;
if (fac == 0) {
return col1;
@@ -658,9 +658,9 @@ BLI_INLINE unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
mfac = 255 - fac;
- cp1 = (unsigned char *)&col1;
- cp2 = (unsigned char *)&col2;
- cp = (unsigned char *)&col;
+ cp1 = (uchar *)&col1;
+ cp2 = (uchar *)&col2;
+ cp = (uchar *)&col;
/* first mul, then blend the fac */
cp[0] = divide_round_i(mfac * cp1[0] * 255 + fac * cp2[0] * cp1[0], 255 * 255);
@@ -671,11 +671,11 @@ BLI_INLINE unsigned int mcol_mul(unsigned int col1, unsigned int col2, int fac)
return col;
}
-BLI_INLINE unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE uint mcol_lighten(uint col1, uint col2, int fac)
{
- unsigned char *cp1, *cp2, *cp;
+ uchar *cp1, *cp2, *cp;
int mfac;
- unsigned int col = 0;
+ uint col = 0;
if (fac == 0) {
return col1;
@@ -686,9 +686,9 @@ BLI_INLINE unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int f
mfac = 255 - fac;
- cp1 = (unsigned char *)&col1;
- cp2 = (unsigned char *)&col2;
- cp = (unsigned char *)&col;
+ cp1 = (uchar *)&col1;
+ cp2 = (uchar *)&col2;
+ cp = (uchar *)&col;
/* See if are lighter, if so mix, else don't do anything.
* if the paint col is darker then the original, then ignore */
@@ -704,11 +704,11 @@ BLI_INLINE unsigned int mcol_lighten(unsigned int col1, unsigned int col2, int f
return col;
}
-BLI_INLINE unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fac)
+BLI_INLINE uint mcol_darken(uint col1, uint col2, int fac)
{
- unsigned char *cp1, *cp2, *cp;
+ uchar *cp1, *cp2, *cp;
int mfac;
- unsigned int col = 0;
+ uint col = 0;
if (fac == 0) {
return col1;
@@ -719,9 +719,9 @@ BLI_INLINE unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fa
mfac = 255 - fac;
- cp1 = (unsigned char *)&col1;
- cp2 = (unsigned char *)&col2;
- cp = (unsigned char *)&col;
+ cp1 = (uchar *)&col1;
+ cp2 = (uchar *)&col2;
+ cp = (uchar *)&col;
/* See if were darker, if so mix, else don't do anything.
* if the paint col is brighter then the original, then ignore */
@@ -737,8 +737,8 @@ BLI_INLINE unsigned int mcol_darken(unsigned int col1, unsigned int col2, int fa
}
/* wpaint has 'wpaint_blend_tool' */
-static unsigned int vpaint_blend_tool(const int tool, const unsigned int col,
- const unsigned int paintcol, const int alpha_i)
+static uint vpaint_blend_tool(const int tool, const uint col,
+ const uint paintcol, const int alpha_i)
{
switch (tool) {
case PAINT_BLEND_MIX:
@@ -757,9 +757,9 @@ static unsigned int vpaint_blend_tool(const int tool, const unsigned int col,
}
/* wpaint has 'wpaint_blend' */
-static unsigned int vpaint_blend(
- VPaint *vp, unsigned int col, unsigned int colorig,
- const unsigned int paintcol, const int alpha_i,
+static uint vpaint_blend(
+ VPaint *vp, uint col, uint colorig,
+ const uint paintcol, const int alpha_i,
/* pre scaled from [0-1] --> [0-255] */
const int brush_alpha_value_i)
{
@@ -770,7 +770,7 @@ static unsigned int vpaint_blend(
/* if no spray, clip color adding with colorig & orig alpha */
if ((vp->flag & VP_SPRAY) == 0) {
- unsigned int testcol, a;
+ uint testcol, a;
char *cp, *ct, *co;
testcol = vpaint_blend_tool(tool, colorig, paintcol, brush_alpha_value_i);
@@ -966,7 +966,7 @@ static int weight_sample_invoke(bContext *C, wmOperator *op, const wmEvent *even
if (me && me->dvert && vc.v3d && vc.rv3d && (vc.obact->actdef != 0)) {
const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
int v_idx_best = -1;
- unsigned int index;
+ uint index;
view3d_operator_needs_opengl(C);
ED_view3d_init_mats_rv3d(vc.obact, vc.rv3d);
@@ -1077,7 +1077,7 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(
const bool use_vert_sel = (me->editflag & ME_EDIT_PAINT_VERT_SEL) != 0;
int *groups = MEM_callocN(defbase_tot * sizeof(int), "groups");
bool found = false;
- unsigned int index;
+ uint index;
const int mval[2] = {
win->eventstate->x - vc.ar->winrct.xmin,
@@ -1096,7 +1096,7 @@ static EnumPropertyItem *weight_paint_sample_enum_itemf(
else {
if (ED_mesh_pick_face(C, vc.obact, mval, &index, ED_MESH_PICK_DEFAULT_FACE_SIZE)) {
const MPoly *mp = &me->mpoly[index];
- unsigned int fidx = mp->totloop - 1;
+ uint fidx = mp->totloop - 1;
do {
MDeformVert *dvert = &me->dvert[me->mloop[mp->loopstart + fidx].v];
@@ -1176,7 +1176,7 @@ void PAINT_OT_weight_sample_group(wmOperatorType *ot)
static void do_weight_paint_normalize_all(MDeformVert *dvert, const int defbase_tot, const bool *vgroup_validmap)
{
float sum = 0.0f, fac;
- unsigned int i, tot = 0;
+ uint i, tot = 0;
MDeformWeight *dw;
for (i = dvert->totweight, dw = dvert->dw; i != 0; i--, dw++) {
@@ -1222,7 +1222,7 @@ static bool do_weight_paint_normalize_all_locked(
float sum = 0.0f, fac;
float sum_unlock = 0.0f;
float lock_weight = 0.0f;
- unsigned int i, tot = 0;
+ uint i, tot = 0;
MDeformWeight *dw;
if (lock_flags == NULL) {
@@ -1455,7 +1455,7 @@ static void do_weight_paint_vertex_single(
/* vars which remain the same for every vert */
VPaint *wp, Object *ob, const WeightPaint
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list