From 950b4f5ec9250edc7e4a3bbb84a616e6cc3027bf Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 1 May 2013 02:53:45 +0000 Subject: style cleanup --- source/blender/blenkernel/intern/brush.c | 4 +- source/blender/editors/sculpt_paint/paint_image.c | 6 ++- .../blender/editors/sculpt_paint/paint_image_2d.c | 52 +++++++++++----------- .../editors/sculpt_paint/paint_image_proj.c | 10 ++--- source/blender/imbuf/intern/rectop.c | 4 +- 5 files changed, 39 insertions(+), 37 deletions(-) (limited to 'source') diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index feb6a961596..f69b11135c5 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -760,8 +760,8 @@ float BKE_brush_sample_masktex(const Scene *scene, Brush *br, static void brush_imbuf_tex_co(rctf *mapping, int x, int y, float texco[3]) { - texco[0] = mapping->xmin + x*mapping->xmax; - texco[1] = mapping->ymin + y*mapping->ymax; + texco[0] = mapping->xmin + x * mapping->xmax; + texco[1] = mapping->ymin + y * mapping->ymax; texco[2] = 0.0f; } diff --git a/source/blender/editors/sculpt_paint/paint_image.c b/source/blender/editors/sculpt_paint/paint_image.c index f059a0b1a0a..92b82d84c38 100644 --- a/source/blender/editors/sculpt_paint/paint_image.c +++ b/source/blender/editors/sculpt_paint/paint_image.c @@ -168,8 +168,10 @@ void *image_undo_find_tile(Image *ima, ImBuf *ibuf, int x_tile, int y_tile, unsi if (strcmp(tile->idname, ima->id.name) == 0 && strcmp(tile->ibufname, ibuf->name) == 0) { if (mask) { /* allocate mask if requested */ - if (!tile->mask) - tile->mask = MEM_callocN(sizeof(unsigned short)*IMAPAINT_TILE_SIZE*IMAPAINT_TILE_SIZE, "UndoImageTile.mask"); + if (!tile->mask) { + tile->mask = MEM_callocN(sizeof(unsigned short) * IMAPAINT_TILE_SIZE * IMAPAINT_TILE_SIZE, + "UndoImageTile.mask"); + } *mask = tile->mask; } diff --git a/source/blender/editors/sculpt_paint/paint_image_2d.c b/source/blender/editors/sculpt_paint/paint_image_2d.c index 5db8c41a059..efb810455b7 100644 --- a/source/blender/editors/sculpt_paint/paint_image_2d.c +++ b/source/blender/editors/sculpt_paint/paint_image_2d.c @@ -233,8 +233,8 @@ static void brush_painter_2d_do_partial(BrushPainter *painter, ImBuf *oldtexibuf otf += 4; } else { - texco[0] = mapping.xmin + x*mapping.xmax; - texco[1] = mapping.ymin + y*mapping.ymax; + texco[0] = mapping.xmin + x * mapping.xmax; + texco[1] = mapping.ymin + y * mapping.ymax; texco[2] = 0.0f; BKE_brush_sample_tex_3D(scene, brush, texco, tf, thread, painter->pool); @@ -266,8 +266,8 @@ static void brush_painter_2d_do_partial(BrushPainter *painter, ImBuf *oldtexibuf ot += 4; } else { - texco[0] = mapping.xmin + x*mapping.xmax; - texco[1] = mapping.ymin + y*mapping.ymax; + texco[0] = mapping.xmin + x * mapping.xmax; + texco[1] = mapping.ymin + y * mapping.ymax; texco[2] = 0.0f; BKE_brush_sample_tex_3D(scene, brush, texco, rgba, thread, painter->pool); @@ -339,8 +339,8 @@ static void brush_painter_2d_tiled_tex_partial_update(BrushPainter *painter, con static void brush_painter_2d_tex_mapping(ImagePaintState *s, int bufsize, const float pos[2], bool do_stencil, bool do_3D, bool do_view, rctf *mapping) { - float invw = 1.0f/(float)s->canvas->x; - float invh = 1.0f/(float)s->canvas->y; + float invw = 1.0f / (float)s->canvas->x; + float invh = 1.0f / (float)s->canvas->y; int xmin, ymin, xmax, ymax; int ipos[2]; @@ -350,21 +350,21 @@ static void brush_painter_2d_tex_mapping(ImagePaintState *s, int bufsize, const if (do_stencil || do_view) { /* map from view coordinates of brush to region coordinates */ - UI_view2d_to_region_no_clip(s->v2d, ipos[0]*invw, ipos[1]*invh, &xmin, &ymin); - UI_view2d_to_region_no_clip(s->v2d, (ipos[0] + bufsize)*invw, (ipos[1] + bufsize)*invh, &xmax, &ymax); + UI_view2d_to_region_no_clip(s->v2d, ipos[0] * invw, ipos[1] * invh, &xmin, &ymin); + UI_view2d_to_region_no_clip(s->v2d, (ipos[0] + bufsize) * invw, (ipos[1] + bufsize) * invh, &xmax, &ymax); /* output mapping from brush ibuf x/y to region coordinates */ mapping->xmin = xmin; mapping->ymin = ymin; - mapping->xmax = (xmax - xmin)/(float)bufsize; - mapping->ymax = (ymax - ymin)/(float)bufsize; + mapping->xmax = (xmax - xmin) / (float)bufsize; + mapping->ymax = (ymax - ymin) / (float)bufsize; } else if (do_3D) { /* 3D mapping, just mapping to canvas 0..1 */ - mapping->xmin = ipos[0]*invw; - mapping->ymin = ipos[1]*invh; - mapping->xmax = bufsize*invw/(float)bufsize; - mapping->ymax = bufsize*invh/(float)bufsize; + mapping->xmin = ipos[0] * invw; + mapping->ymin = ipos[1] * invh; + mapping->xmax = bufsize * invw / (float)bufsize; + mapping->ymax = bufsize * invh / (float)bufsize; } else { /* other mapping */ @@ -705,7 +705,7 @@ static int paint_2d_op(void *state, ImBuf *ibufb, const float lastpos[2], const imapaint_region_tiles(s->canvas, region[a].destx, region[a].desty, region[a].width, region[a].height, - &tilex, &tiley, &tilew, &tileh); + &tilex, &tiley, &tilew, &tileh); for (ty = tiley; ty <= tileh; ty++) { for (tx = tilex; tx <= tilew; tx++) { @@ -720,20 +720,20 @@ static int paint_2d_op(void *state, ImBuf *ibufb, const float lastpos[2], const tmpbuf->rect = image_undo_find_tile(s->image, s->canvas, tx, ty, &mask); IMB_rectblend(s->canvas, tmpbuf, frombuf, mask, mask_max, - region[a].destx, region[a].desty, - origx, origy, - region[a].srcx, region[a].srcy, - region[a].width, region[a].height, blend); + region[a].destx, region[a].desty, + origx, origy, + region[a].srcx, region[a].srcy, + region[a].width, region[a].height, blend); } } } else { /* no masking, composite brush directly onto canvas */ IMB_rectblend(s->canvas, s->canvas, frombuf, NULL, 0, - region[a].destx, region[a].desty, - region[a].destx, region[a].desty, - region[a].srcx, region[a].srcy, - region[a].width, region[a].height, blend); + region[a].destx, region[a].desty, + region[a].destx, region[a].desty, + region[a].srcx, region[a].srcy, + region[a].width, region[a].height, blend); } } @@ -791,7 +791,7 @@ static int paint_2d_canvas_set(ImagePaintState *s, Image *ima) s->do_masking = (s->brush->flag & BRUSH_AIRBRUSH || (s->brush->imagepaint_tool == PAINT_TOOL_SMEAR) || (s->brush->mtex.tex && !ELEM3(s->brush->mtex.brush_map_mode, MTEX_MAP_MODE_TILED, MTEX_MAP_MODE_STENCIL, MTEX_MAP_MODE_3D))) - ? false : true; + ? false : true; return 1; } @@ -836,8 +836,8 @@ int paint_2d_stroke(void *ps, const int prev_mval[2], const int mval[2], int era UI_view2d_region_to_view(s->v2d, 0, 0, &startuv[0], &startuv[1]); /* paint exactly once on first touch */ - painter->startpaintpos[0] = startuv[0]*ibuf->x; - painter->startpaintpos[1] = startuv[1]*ibuf->y; + painter->startpaintpos[0] = startuv[0] * ibuf->x; + painter->startpaintpos[1] = startuv[1] * ibuf->y; painter->firsttouch = 0; copy_v2_v2(painter->lastpaintpos, newuv); diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 79c41a79042..fdb97a3fa0e 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -3912,21 +3912,21 @@ static void *do_projectpaint_thread(void *ph_v) switch (tool) { case PAINT_TOOL_CLONE: if (is_floatbuf) do_projectpaint_clone_f(ps, projPixel, mask); - else do_projectpaint_clone(ps, projPixel, mask); + else do_projectpaint_clone(ps, projPixel, mask); break; case PAINT_TOOL_SMEAR: sub_v2_v2v2(co, projPixel->projCoSS, pos_ofs); if (is_floatbuf) do_projectpaint_smear_f(ps, projPixel, mask, smearArena, &smearPixels_f, co); - else do_projectpaint_smear(ps, projPixel, mask, smearArena, &smearPixels, co); + else do_projectpaint_smear(ps, projPixel, mask, smearArena, &smearPixels, co); break; case PAINT_TOOL_SOFTEN: if (is_floatbuf) do_projectpaint_soften_f(ps, projPixel, mask, softenArena, &softenPixels_f); - else do_projectpaint_soften(ps, projPixel, mask, softenArena, &softenPixels); + else do_projectpaint_soften(ps, projPixel, mask, softenArena, &softenPixels); break; default: - if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, texrgb, mask*mixalpha); - else do_projectpaint_draw(ps, projPixel, texrgb, mask*mixalpha); + if (is_floatbuf) do_projectpaint_draw_f(ps, projPixel, texrgb, mask * mixalpha); + else do_projectpaint_draw(ps, projPixel, texrgb, mask * mixalpha); break; } } diff --git a/source/blender/imbuf/intern/rectop.c b/source/blender/imbuf/intern/rectop.c index d9fc4fe172a..3d80be93ded 100644 --- a/source/blender/imbuf/intern/rectop.c +++ b/source/blender/imbuf/intern/rectop.c @@ -397,7 +397,7 @@ void IMB_rectblend(ImBuf *dbuf, ImBuf *obuf, ImBuf *sbuf, unsigned short *maskre mr = maskrect; for (x = width; x > 0; x--, dr++, or++, sr++, mr++) { - unsigned char *src = (unsigned char*)sr; + unsigned char *src = (unsigned char *)sr; if (src[3]) { unsigned short mask = *mr + divide_round_i((mask_max - *mr) * src[3], 255); @@ -448,7 +448,7 @@ void IMB_rectblend(ImBuf *dbuf, ImBuf *obuf, ImBuf *sbuf, unsigned short *maskre if (mask > *mr) { float mask_srf[4]; - float new_alpha = mask * (1.0f/65535.0f); + float new_alpha = mask * (1.0f / 65535.0f); float map_alpha = new_alpha / srf[3]; *mr = mask; -- cgit v1.2.3