diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-04-26 18:22:49 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-04-26 18:25:15 +0400 |
commit | c67bd49e5607cc3db7446d4b12e1346fc9b2c83a (patch) | |
tree | bffbca1613b3ce8a5e356110c0d35b38dd6537cf /source/blender/editors/sculpt_paint | |
parent | f2d25975b5e90f89744be733b81462493dc57977 (diff) |
Code cleanup: use 'const' for arrays (editors)
Diffstat (limited to 'source/blender/editors/sculpt_paint')
6 files changed, 21 insertions, 21 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c index fb3fd10a5f1..484bafb4d83 100644 --- a/source/blender/editors/sculpt_paint/paint_hide.c +++ b/source/blender/editors/sculpt_paint/paint_hide.c @@ -98,7 +98,7 @@ static void partialvis_update_mesh(Object *ob, { Mesh *me = ob->data; MVert *mvert; - float *paint_mask; + const float *paint_mask; int *vert_indices; int totvert, i; bool any_changed = false, any_visible = false; diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index cf2655bae7f..7007d9b119c 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -126,8 +126,8 @@ typedef struct ImagePaintState { Image *image; ImBuf *canvas; ImBuf *clonecanvas; - char *warnpackedfile; - char *warnmultifile; + const char *warnpackedfile; + const char *warnmultifile; bool do_masking; @@ -399,7 +399,7 @@ static void brush_painter_imbuf_update(BrushPainter *painter, ImBuf *oldtexibuf, /* read from old texture buffer */ if (use_texture_old) { - float *otf = oldtexibuf->rect_float + ((y - origy + yt) * oldtexibuf->x + (x - origx + xt)) * 4; + const float *otf = oldtexibuf->rect_float + ((y - origy + yt) * oldtexibuf->x + (x - origx + xt)) * 4; copy_v4_v4(rgba, otf); } @@ -671,7 +671,7 @@ static void paint_2d_ibuf_rgb_get(ImBuf *ibuf, int x, int y, const bool is_torus } if (ibuf->rect_float) { - float *rrgbf = ibuf->rect_float + (ibuf->x * y + x) * 4; + const float *rrgbf = ibuf->rect_float + (ibuf->x * y + x) * 4; copy_v4_v4(r_rgb, rrgbf); } else { @@ -867,7 +867,7 @@ static int paint_2d_op(void *state, ImBuf *ibufb, unsigned short *maskb, const f ImagePaintRegion region[4]; short torus = s->brush->flag & BRUSH_TORUS; short blend = s->blend; - float *offset = s->brush->clone.offset; + const float *offset = s->brush->clone.offset; float liftpos[2]; float brush_alpha = BKE_brush_alpha_get(s->scene, s->brush); unsigned short mask_max = (unsigned short)(brush_alpha * 65535.0f); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index af88ff11dac..aa1bcf542ff 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -423,7 +423,7 @@ static int project_paint_PickFace(const ProjPaintState *ps, const float pt[2], f { LinkNode *node; float w_tmp[3]; - float *v1, *v2, *v3, *v4; + const float *v1, *v2, *v3, *v4; int bucket_index; int face_index; int best_side = -1; @@ -560,7 +560,7 @@ static bool project_paint_PickColor(const ProjPaintState *ps, const float pt[2], if (rgba) { if (ibuf->rect_float) { - float *rgba_tmp_fp = ibuf->rect_float + (xi + yi * ibuf->x * 4); + const float *rgba_tmp_fp = ibuf->rect_float + (xi + yi * ibuf->x * 4); premul_float_to_straight_uchar(rgba, rgba_tmp_fp); } else { @@ -1138,7 +1138,7 @@ static void screen_px_from_persp_ortho_weights( static void project_face_pixel(const MTFace *tf_other, ImBuf *ibuf_other, const float w[3], int side, unsigned char rgba_ub[4], float rgba_f[4]) { - float *uvCo1, *uvCo2, *uvCo3; + const float *uvCo1, *uvCo2, *uvCo3; float uv_other[2], x, y; uvCo1 = (float *)tf_other->uv[0]; @@ -1218,7 +1218,7 @@ static float project_paint_uvpixel_mask( MFace *mf = &ps->dm_mface[face_index]; float no[3], angle; if (mf->flag & ME_SMOOTH) { - short *no1, *no2, *no3; + const short *no1, *no2, *no3; no1 = ps->dm_mvert[mf->v1].no; if (side == 1) { no2 = ps->dm_mvert[mf->v3].no; @@ -1262,7 +1262,7 @@ static float project_paint_uvpixel_mask( else { /* Annoying but for the perspective view we need to get the pixels location in 3D space :/ */ float viewDirPersp[3]; - float *co1, *co2, *co3; + const float *co1, *co2, *co3; co1 = ps->dm_mvert[mf->v1].co; if (side == 1) { co2 = ps->dm_mvert[mf->v3].co; @@ -2652,7 +2652,7 @@ static bool project_bucket_face_isect(ProjPaintState *ps, int bucket_x, int buck /* TODO - replace this with a tricker method that uses sideofline for all screenCoords's edges against the closest bucket corner */ rctf bucket_bounds; float p1[2], p2[2], p3[2], p4[2]; - float *v, *v1, *v2, *v3, *v4 = NULL; + const float *v, *v1, *v2, *v3, *v4 = NULL; int fidx; project_bucket_bounds(ps, bucket_x, bucket_y, &bucket_bounds); @@ -2940,7 +2940,7 @@ static void project_paint_begin(ProjPaintState *ps) IDProperty *idgroup = IDP_GetProperties(&ps->reproject_image->id, 0); IDProperty *view_data = IDP_GetPropertyFromGroup(idgroup, PROJ_VIEW_DATA_ID); - float *array = (float *)IDP_Array(view_data); + const float *array = (float *)IDP_Array(view_data); /* use image array, written when creating image */ memcpy(winmat, array, sizeof(winmat)); array += sizeof(winmat) / sizeof(float); @@ -3166,7 +3166,7 @@ static void project_paint_begin(ProjPaintState *ps) } if (is_face_sel && (tpage = project_paint_face_image(ps, ps->dm_mtface, face_index))) { - float *v1coSS, *v2coSS, *v3coSS, *v4coSS = NULL; + const float *v1coSS, *v2coSS, *v3coSS, *v4coSS = NULL; v1coSS = ps->screenCoords[mf->v1]; v2coSS = ps->screenCoords[mf->v2]; diff --git a/source/blender/editors/sculpt_paint/paint_utils.c b/source/blender/editors/sculpt_paint/paint_utils.c index 7316c58755c..642c1dd9529 100644 --- a/source/blender/editors/sculpt_paint/paint_utils.c +++ b/source/blender/editors/sculpt_paint/paint_utils.c @@ -227,7 +227,7 @@ void paint_sample_color(const bContext *C, ARegion *ar, int x, int y) /* fron { Brush *br = BKE_paint_brush(BKE_paint_get_active_from_context(C)); unsigned int col; - char *cp; + const char *cp; CLAMP(x, 0, ar->winx); CLAMP(y, 0, ar->winy); diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 1d127cd5f4e..108f5a7ee37 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -217,7 +217,7 @@ static void do_shared_vertex_tesscol(Mesh *me, bool *mfacetag) int a; short *scolmain, *scol; char *mcol; - bool *mftag; + const bool *mftag; if (me->mcol == NULL || me->totvert == 0 || me->totface == 0) return; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index fcb2e6ad588..c8c644a546a 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -317,7 +317,7 @@ typedef struct { SculptUndoNode *unode; float (*coords)[3]; short (*normals)[3]; - float *vmasks; + const float *vmasks; /* Original coordinate, normal, and mask */ const float *co; @@ -1613,7 +1613,7 @@ static void do_multires_smooth_brush(Sculpt *sd, SculptSession *ss, PBVHNode *no for (y = 0; y < gridsize; ++y) { for (x = 0; x < gridsize; ++x) { float *co; - float *fno; + const float *fno; float *mask; int index; @@ -4247,14 +4247,14 @@ static void sculpt_stroke_modifiers_check(const bContext *C, Object *ob) typedef struct { SculptSession *ss; - float *ray_start, *ray_normal; + const float *ray_start, *ray_normal; int hit; float dist; int original; } SculptRaycastData; typedef struct { - float *ray_start, *ray_normal; + const float *ray_start, *ray_normal; int hit; float dist; float detail; @@ -5083,7 +5083,7 @@ static void sculpt_init_session(Scene *scene, Object *ob) int ED_sculpt_mask_layers_ensure(Object *ob, MultiresModifierData *mmd) { - float *paint_mask; + const float *paint_mask; Mesh *me = ob->data; int ret = 0; |