From 81d8f17843f92c6d6abbacb652ca22917910f4bc Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 24 Mar 2012 07:36:32 +0000 Subject: style cleanup: pep8, indentation --- source/blender/blenkernel/intern/customdata.c | 10 ++--- source/blender/blenkernel/intern/node.c | 2 +- source/blender/blenlib/intern/freetypefont.c | 3 +- source/blender/blenlib/intern/math_matrix.c | 40 ++++++++--------- source/blender/blenlib/intern/string_utf8.c | 16 +++---- source/blender/bmesh/intern/bmesh_marking.c | 12 +++--- source/blender/bmesh/intern/bmesh_walkers_impl.c | 18 ++++---- source/blender/bmesh/operators/bmo_mirror.c | 2 +- source/blender/collada/ArmatureImporter.cpp | 2 +- .../blender/editors/interface/interface_regions.c | 2 +- source/blender/editors/sculpt_paint/sculpt.c | 2 +- source/blender/editors/space_clip/clip_ops.c | 12 +++--- source/blender/editors/space_node/node_edit.c | 4 +- source/blender/gpu/intern/gpu_buffers.c | 50 +++++++++++----------- source/blender/ikplugin/intern/itasc_plugin.cpp | 38 ++++++++-------- source/blender/imbuf/intern/dds/BlockDXT.cpp | 20 ++++----- source/blender/imbuf/intern/dds/ColorBlock.cpp | 46 ++++++++++---------- source/blender/makesrna/intern/rna_scene.c | 2 +- source/blender/makesrna/intern/rna_tracking.c | 8 ++-- source/blender/python/generic/py_capi_utils.c | 2 +- 20 files changed, 145 insertions(+), 146 deletions(-) (limited to 'source/blender') diff --git a/source/blender/blenkernel/intern/customdata.c b/source/blender/blenkernel/intern/customdata.c index a48f2550b48..301ba282cbd 100644 --- a/source/blender/blenkernel/intern/customdata.c +++ b/source/blender/blenkernel/intern/customdata.c @@ -1828,11 +1828,11 @@ void CustomData_copy_data(const CustomData *source, CustomData *dest, dest_offset = dest_index * typeInfo->size; if (!src_data || !dest_data) { - if (src_data != NULL && dest_data != NULL) { - printf("%s: warning null data for %s type (%p --> %p), skipping\n", - __func__, layerType_getName(source->layers[src_i].type), - (void *)src_data, (void *)dest_data); - } + if (src_data != NULL && dest_data != NULL) { + printf("%s: warning null data for %s type (%p --> %p), skipping\n", + __func__, layerType_getName(source->layers[src_i].type), + (void *)src_data, (void *)dest_data); + } continue; } diff --git a/source/blender/blenkernel/intern/node.c b/source/blender/blenkernel/intern/node.c index a1ea201bd7a..cbdbf0317b4 100644 --- a/source/blender/blenkernel/intern/node.c +++ b/source/blender/blenkernel/intern/node.c @@ -1913,7 +1913,7 @@ static void registerCompositNodes(bNodeTreeType *ttype) register_node_type_cmp_channel_matte(ttype); register_node_type_cmp_color_spill(ttype); register_node_type_cmp_luma_matte(ttype); - register_node_type_cmp_doubleedgemask(ttype); + register_node_type_cmp_doubleedgemask(ttype); register_node_type_cmp_translate(ttype); register_node_type_cmp_rotate(ttype); diff --git a/source/blender/blenlib/intern/freetypefont.c b/source/blender/blenlib/intern/freetypefont.c index 019915b3128..a9a1f2bc57e 100644 --- a/source/blender/blenlib/intern/freetypefont.c +++ b/source/blender/blenlib/intern/freetypefont.c @@ -538,8 +538,7 @@ typedef struct FT_Outline_ short* contours; /* the contour end points */ int flags; /* outline masks */ - - } FT_Outline; +} FT_Outline; #endif diff --git a/source/blender/blenlib/intern/math_matrix.c b/source/blender/blenlib/intern/math_matrix.c index b32c5b833ae..fd49012491e 100644 --- a/source/blender/blenlib/intern/math_matrix.c +++ b/source/blender/blenlib/intern/math_matrix.c @@ -811,36 +811,36 @@ void orthogonalize_m4(float mat[][4], int axis) int is_orthogonal_m3(float m[][3]) { - int i, j; + int i, j; - for (i = 0; i < 3; i++) { - for (j = 0; j < i; j++) { - if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON) - return 0; - } + for (i = 0; i < 3; i++) { + for (j = 0; j < i; j++) { + if (fabsf(dot_v3v3(m[i], m[j])) > 1.5f * FLT_EPSILON) + return 0; + } - if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON) - return 0; - } + if (fabsf(dot_v3v3(m[i], m[i]) - 1) > 1.5f * FLT_EPSILON) + return 0; + } - return 1; + return 1; } int is_orthogonal_m4(float m[][4]) { - int i, j; + int i, j; - for (i = 0; i < 4; i++) { - for (j = 0; j < i; j++) { - if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON) - return 0; - } + for (i = 0; i < 4; i++) { + for (j = 0; j < i; j++) { + if (fabsf(dot_vn_vn(m[i], m[j], 4)) > 1.5f * FLT_EPSILON) + return 0; + } - if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON) - return 0; - } + if (fabsf(dot_vn_vn(m[i], m[i], 4) - 1) > 1.5f * FLT_EPSILON) + return 0; + } - return 1; + return 1; } void normalize_m3(float mat[][3]) diff --git a/source/blender/blenlib/intern/string_utf8.c b/source/blender/blenlib/intern/string_utf8.c index 6f181c1ee6e..aede08be7f9 100644 --- a/source/blender/blenlib/intern/string_utf8.c +++ b/source/blender/blenlib/intern/string_utf8.c @@ -359,16 +359,16 @@ int BLI_str_utf8_size(const char *p) **/ unsigned int BLI_str_utf8_as_unicode(const char *p) { - int i, mask = 0, len; - unsigned int result; - unsigned char c = (unsigned char) *p; + int i, mask = 0, len; + unsigned int result; + unsigned char c = (unsigned char) *p; - UTF8_COMPUTE (c, mask, len); - if (len == -1) - return BLI_UTF8_ERR; - UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); + UTF8_COMPUTE (c, mask, len); + if (len == -1) + return BLI_UTF8_ERR; + UTF8_GET (result, p, i, mask, len, BLI_UTF8_ERR); - return result; + return result; } /* variant that increments the length */ diff --git a/source/blender/bmesh/intern/bmesh_marking.c b/source/blender/bmesh/intern/bmesh_marking.c index b5e8b42c30c..0318fd94b92 100644 --- a/source/blender/bmesh/intern/bmesh_marking.c +++ b/source/blender/bmesh/intern/bmesh_marking.c @@ -288,9 +288,9 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select) if (BM_elem_flag_test(e, BM_ELEM_SELECT)) bm->totedgesel -= 1; BM_elem_flag_disable(e, BM_ELEM_SELECT); - if ( bm->selectmode == SCE_SELECT_EDGE || - bm->selectmode == SCE_SELECT_FACE || - bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE)) + if (bm->selectmode == SCE_SELECT_EDGE || + bm->selectmode == SCE_SELECT_FACE || + bm->selectmode == (SCE_SELECT_EDGE | SCE_SELECT_FACE)) { BMIter iter; @@ -312,9 +312,9 @@ void BM_edge_select_set(BMesh *bm, BMEdge *e, int select) } } - if (deselect) { - BM_vert_select_set(bm, verts[i], FALSE); - } + if (deselect) { + BM_vert_select_set(bm, verts[i], FALSE); + } } } else { diff --git a/source/blender/bmesh/intern/bmesh_walkers_impl.c b/source/blender/bmesh/intern/bmesh_walkers_impl.c index d996d756bdc..493be46c976 100644 --- a/source/blender/bmesh/intern/bmesh_walkers_impl.c +++ b/source/blender/bmesh/intern/bmesh_walkers_impl.c @@ -475,17 +475,17 @@ static void *bmw_LoopWalker_step(BMWalker *walker) l = BM_face_other_vert_loop(owalk.f_hub, lwalk->lastv, v); nexte = BM_edge_exists(v, l->v); - if (!BLI_ghash_haskey(walker->visithash, nexte)) { - lwalk = BMW_state_add(walker); - lwalk->cur = nexte; - lwalk->lastv = v; + if (!BLI_ghash_haskey(walker->visithash, nexte)) { + lwalk = BMW_state_add(walker); + lwalk->cur = nexte; + lwalk->lastv = v; - lwalk->is_boundary = owalk.is_boundary; - lwalk->is_single = owalk.is_single; - lwalk->f_hub = owalk.f_hub; + lwalk->is_boundary = owalk.is_boundary; + lwalk->is_single = owalk.is_single; + lwalk->f_hub = owalk.f_hub; - BLI_ghash_insert(walker->visithash, nexte, NULL); - } + BLI_ghash_insert(walker->visithash, nexte, NULL); + } } } else if (l) { /* NORMAL EDGE WITH FACES */ diff --git a/source/blender/bmesh/operators/bmo_mirror.c b/source/blender/bmesh/operators/bmo_mirror.c index e36a8636b9b..268009dc9af 100644 --- a/source/blender/bmesh/operators/bmo_mirror.c +++ b/source/blender/bmesh/operators/bmo_mirror.c @@ -48,7 +48,7 @@ void bmo_mirror_exec(BMesh *bm, BMOperator *op) float scale[3] = {1.0f, 1.0f, 1.0f}; float dist = BMO_slot_float_get(op, "mergedist"); int i, ototvert /*, ototedge */; - int axis = BMO_slot_int_get(op, "axis"); + int axis = BMO_slot_int_get(op, "axis"); int mirroru = BMO_slot_bool_get(op, "mirror_u"); int mirrorv = BMO_slot_bool_get(op, "mirror_v"); diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index 11a48fd3cfd..8a5461710f6 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -574,7 +574,7 @@ void ArmatureImporter::set_pose ( Object * ob_arm , COLLADAFW::Node * root_node { char * bone_name = (char *) bc_get_joint_name ( root_node); float mat[4][4]; - float obmat[4][4]; + float obmat[4][4]; float ax[3]; float angle = 0.0f; diff --git a/source/blender/editors/interface/interface_regions.c b/source/blender/editors/interface/interface_regions.c index ef6cbc9ae48..ff72c13aa34 100644 --- a/source/blender/editors/interface/interface_regions.c +++ b/source/blender/editors/interface/interface_regions.c @@ -449,7 +449,7 @@ ARegion *ui_tooltip_create(bContext *C, ARegion *butregion, uiBut *but) if (item[i].identifier[0] && item[i].value == value) { if (item[i].description && item[i].description[0]) { BLI_snprintf(data->lines[data->totline], sizeof(data->lines[0]), "%s: %s", item[i].name, item[i].description); - data->color_id[data->totline] = UI_TIP_LC_SUBMENU; + data->color_id[data->totline] = UI_TIP_LC_SUBMENU; data->totline++; } break; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 319570cf65e..e91f26fc9ba 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2960,7 +2960,7 @@ static void sculpt_update_brush_delta(Sculpt *sd, Object *ob, Brush *brush) /* compute 3d coordinate at same z from original location + mouse */ mul_v3_m4v3(loc, ob->obmat, cache->orig_grab_location); - initgrabz(cache->vc->rv3d, loc[0], loc[1], loc[2]); + initgrabz(cache->vc->rv3d, loc[0], loc[1], loc[2]); ED_view3d_win_to_3d(cache->vc->ar, loc, mouse, grab_location); diff --git a/source/blender/editors/space_clip/clip_ops.c b/source/blender/editors/space_clip/clip_ops.c index 2fa7f447f38..ff8feb69bd9 100644 --- a/source/blender/editors/space_clip/clip_ops.c +++ b/source/blender/editors/space_clip/clip_ops.c @@ -877,12 +877,12 @@ static int proxy_bitflag_to_array(int size_flag, int build_sizes[4], int undisto int build_count = 0; int size_flags[2][4] = {{MCLIP_PROXY_SIZE_25, MCLIP_PROXY_SIZE_50, - MCLIP_PROXY_SIZE_75, - MCLIP_PROXY_SIZE_100}, - {MCLIP_PROXY_UNDISTORTED_SIZE_25, - MCLIP_PROXY_UNDISTORTED_SIZE_50, - MCLIP_PROXY_UNDISTORTED_SIZE_75, - MCLIP_PROXY_UNDISTORTED_SIZE_100}}; + MCLIP_PROXY_SIZE_75, + MCLIP_PROXY_SIZE_100}, + {MCLIP_PROXY_UNDISTORTED_SIZE_25, + MCLIP_PROXY_UNDISTORTED_SIZE_50, + MCLIP_PROXY_UNDISTORTED_SIZE_75, + MCLIP_PROXY_UNDISTORTED_SIZE_100}}; int size_nr = undistort ? 1 : 0; if (size_flag & size_flags[size_nr][0]) build_sizes[build_count++]= MCLIP_PROXY_RENDER_SIZE_25; diff --git a/source/blender/editors/space_node/node_edit.c b/source/blender/editors/space_node/node_edit.c index 189d2307a7e..d95947142f9 100644 --- a/source/blender/editors/space_node/node_edit.c +++ b/source/blender/editors/space_node/node_edit.c @@ -3511,9 +3511,9 @@ void NODE_OT_add_file(wmOperatorType *ot) ot->idname = "NODE_OT_add_file"; /* callbacks */ - ot->exec = node_add_file_exec; + ot->exec = node_add_file_exec; ot->invoke = node_add_file_invoke; - ot->poll = ED_operator_node_active; + ot->poll = ED_operator_node_active; /* flags */ ot->flag = OPTYPE_REGISTER|OPTYPE_UNDO; diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c index bf4df2e9b0a..61d563a54e0 100644 --- a/source/blender/gpu/intern/gpu_buffers.c +++ b/source/blender/gpu/intern/gpu_buffers.c @@ -73,15 +73,15 @@ static GPUBufferState GLStates = 0; static GPUAttrib attribData[MAX_GPU_ATTRIB_DATA] = { { -1, 0, 0 } }; /* stores recently-deleted buffers so that new buffers won't have to - be recreated as often - - only one instance of this pool is created, stored in - gpu_buffer_pool - - note that the number of buffers in the pool is usually limited to - MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily - when a GPUBuffer is released outside the main thread; due to OpenGL - restrictions it cannot be immediately released + * be recreated as often + * + * only one instance of this pool is created, stored in + * gpu_buffer_pool + * + * note that the number of buffers in the pool is usually limited to + * MAX_FREE_GPU_BUFFERS, but this limit may be exceeded temporarily + * when a GPUBuffer is released outside the main thread; due to OpenGL + * restrictions it cannot be immediately released */ typedef struct GPUBufferPool { /* number of allocated buffers stored */ @@ -160,7 +160,7 @@ static void gpu_buffer_pool_free(GPUBufferPool *pool) if (!pool) return; - while(pool->totbuf) + while (pool->totbuf) gpu_buffer_pool_delete_last(pool); MEM_freeN(pool->buffers); @@ -248,7 +248,7 @@ GPUBuffer *GPU_buffer_alloc(int size) out-of-memory errors? looks a bit iffy to me though, at least on Linux I expect malloc() would just overcommit. --nicholas */ - while(!buf->pointer && pool->totbuf > 0) { + while (!buf->pointer && pool->totbuf > 0) { gpu_buffer_pool_delete_last(pool); buf->pointer = MEM_mallocN(size, "GPUBuffer.pointer"); } @@ -279,7 +279,7 @@ void GPU_buffer_free(GPUBuffer *buffer) if (BLI_thread_is_main()) { /* in main thread, safe to decrease size of pool back down to MAX_FREE_GPU_BUFFERS */ - while(pool->totbuf >= MAX_FREE_GPU_BUFFERS) + while (pool->totbuf >= MAX_FREE_GPU_BUFFERS) gpu_buffer_pool_delete_last(pool); } else { @@ -507,7 +507,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, if (useVBOs) { success = 0; - while(!success) { + while (!success) { /* bind the buffer and discard previous data, avoids stalling gpu */ glBindBufferARB(target, buffer->id); @@ -543,7 +543,7 @@ static GPUBuffer *gpu_buffer_setup(DerivedMesh *dm, GPUDrawObject *object, if (dm->drawObject->legacy == 0) { uploaded = GL_FALSE; /* attempt to upload the data to the VBO */ - while(uploaded == GL_FALSE) { + while (uploaded == GL_FALSE) { (*copy_f)(dm, varray, cur_index_per_mat, mat_orig_to_new, user); /* glUnmapBuffer returns GL_FALSE if * the data store is corrupted; retry @@ -1161,8 +1161,8 @@ void GPU_buffer_unbind(void) } /* confusion: code in cdderivedmesh calls both GPU_color_setup and - GPU_color3_upload; both of these set the `colors' buffer, so seems - like it will just needlessly overwrite? --nicholas */ + * GPU_color3_upload; both of these set the `colors' buffer, so seems + * like it will just needlessly overwrite? --nicholas */ void GPU_color3_upload(DerivedMesh *dm, unsigned char *data) { if (dm->drawObject == 0) @@ -1494,27 +1494,27 @@ static int gpu_count_grid_quads(BLI_bitmap *grid_hidden, /* Build the element array buffer of grid indices using either unsigned shorts or unsigned ints. */ -#define FILL_QUAD_BUFFER(type_, tot_quad_, buffer_) \ +#define FILL_QUAD_BUFFER(type_, tot_quad_, buffer_) \ { \ type_ *quad_data; \ int offset = 0; \ - int i, j, k; \ - \ + int i, j, k; \ + \ glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \ - sizeof(type_) * (tot_quad_) * 4, NULL, \ + sizeof(type_) * (tot_quad_) * 4, NULL, \ GL_STATIC_DRAW_ARB); \ - \ + \ /* Fill the quad buffer */ \ quad_data = glMapBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, \ GL_WRITE_ONLY_ARB); \ - if (quad_data) { \ + if (quad_data) { \ for (i = 0; i < totgrid; ++i) { \ BLI_bitmap gh = NULL; \ - if (grid_hidden) \ + if (grid_hidden) \ gh = grid_hidden[(grid_indices)[i]]; \ \ - for (j = 0; j < gridsize-1; ++j) { \ - for (k = 0; k < gridsize-1; ++k) { \ + for (j = 0; j < gridsize-1; ++j) { \ + for (k = 0; k < gridsize-1; ++k) { \ /* Skip hidden grid face */ \ if (gh && \ paint_is_grid_face_hidden(gh, \ diff --git a/source/blender/ikplugin/intern/itasc_plugin.cpp b/source/blender/ikplugin/intern/itasc_plugin.cpp index 72370158723..0f178366b39 100644 --- a/source/blender/ikplugin/intern/itasc_plugin.cpp +++ b/source/blender/ikplugin/intern/itasc_plugin.cpp @@ -428,14 +428,14 @@ static double EulerAngleFromMatrix(const KDL::Rotation& R, int axis) if (t > 16.0*KDL::epsilon) { if (axis == 0) return -KDL::atan2(R(1,2), R(2,2)); - else if(axis == 1) return KDL::atan2(-R(0,2), t); - else return -KDL::atan2(R(0,1), R(0,0)); + else if(axis == 1) return KDL::atan2(-R(0,2), t); + else return -KDL::atan2(R(0,1), R(0,0)); } else { if (axis == 0) return -KDL::atan2(-R(2,1), R(1,1)); - else if(axis == 1) return KDL::atan2(-R(0,2), t); - else return 0.0f; - } + else if(axis == 1) return KDL::atan2(-R(0,2), t); + else return 0.0f; + } } static double ComputeTwist(const KDL::Rotation& R) @@ -474,29 +474,29 @@ static void RemoveEulerAngleFromMatrix(KDL::Rotation& R, double angle, int axis) static void GetEulerXZY(const KDL::Rotation& R, double& X,double& Z,double& Y) { if (fabs(R(0,1)) > 1.0 - KDL::epsilon ) { - X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0)); - Z = -KDL::sign(R(0,1)) * KDL::PI / 2; - Y = 0.0; + X = -KDL::sign(R(0,1)) * KDL::atan2(R(1,2), R(1,0)); + Z = -KDL::sign(R(0,1)) * KDL::PI / 2; + Y = 0.0; } else { - X = KDL::atan2(R(2,1), R(1,1)); - Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2)))); - Y = KDL::atan2(R(0,2), R(0,0)); - } + X = KDL::atan2(R(2,1), R(1,1)); + Z = KDL::atan2(-R(0,1), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,2)))); + Y = KDL::atan2(R(0,2), R(0,0)); + } } static void GetEulerXYZ(const KDL::Rotation& R, double& X,double& Y,double& Z) { if (fabs(R(0,2)) > 1.0 - KDL::epsilon ) { - X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1)); - Y = KDL::sign(R(0,2)) * KDL::PI / 2; - Z = 0.0; + X = KDL::sign(R(0,2)) * KDL::atan2(-R(1,0), R(1,1)); + Y = KDL::sign(R(0,2)) * KDL::PI / 2; + Z = 0.0; } else { - X = KDL::atan2(-R(1,2), R(2,2)); - Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1)))); - Z = KDL::atan2(-R(0,1), R(0,0)); - } + X = KDL::atan2(-R(1,2), R(2,2)); + Y = KDL::atan2(R(0,2), KDL::sqrt( KDL::sqr(R(0,0)) + KDL::sqr(R(0,1)))); + Z = KDL::atan2(-R(0,1), R(0,0)); + } } #endif diff --git a/source/blender/imbuf/intern/dds/BlockDXT.cpp b/source/blender/imbuf/intern/dds/BlockDXT.cpp index 2ea255234e5..49ba566b6e8 100644 --- a/source/blender/imbuf/intern/dds/BlockDXT.cpp +++ b/source/blender/imbuf/intern/dds/BlockDXT.cpp @@ -135,27 +135,27 @@ uint BlockDXT1::evaluatePaletteNV5x(Color32 color_array[4]) const color_array[1].b = (3 * col1.b * 22) / 8; color_array[1].a = 0xFF; - int gdiff = color_array[1].g - color_array[0].g; + int gdiff = color_array[1].g - color_array[0].g; if( col0.u > col1.u ) { // Four-color block: derive the other two colors. - color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8; - color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256; - color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8; + color_array[2].r = ((2 * col0.r + col1.r) * 22) / 8; + color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 80) / 256; + color_array[2].b = ((2 * col0.b + col1.b) * 22) / 8; color_array[2].a = 0xFF; - color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8; - color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256; - color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8; + color_array[3].r = ((2 * col1.r + col0.r) * 22) / 8; + color_array[3].g = (256 * color_array[1].g - gdiff / 4 + 128 - gdiff * 80) / 256; + color_array[3].b = ((2 * col1.b + col0.b) * 22) / 8; color_array[3].a = 0xFF; return 4; } else { // Three-color block: derive the other color. - color_array[2].r = ((col0.r + col1.r) * 33) / 8; - color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256; - color_array[2].b = ((col0.b + col1.b) * 33) / 8; + color_array[2].r = ((col0.r + col1.r) * 33) / 8; + color_array[2].g = (256 * color_array[0].g + gdiff / 4 + 128 + gdiff * 128) / 256; + color_array[2].b = ((col0.b + col1.b) * 33) / 8; color_array[2].a = 0xFF; // Set all components to 0 to match DXT specs. diff --git a/source/blender/imbuf/intern/dds/ColorBlock.cpp b/source/blender/imbuf/intern/dds/ColorBlock.cpp index b0c4d0a396e..0b4a7cabf92 100644 --- a/source/blender/imbuf/intern/dds/ColorBlock.cpp +++ b/source/blender/imbuf/intern/dds/ColorBlock.cpp @@ -81,7 +81,7 @@ ColorBlock::ColorBlock(const Image * img, uint x, uint y) void ColorBlock::init(const Image * img, uint x, uint y) { - init(img->width(), img->height(), (const uint *)img->pixels(), x, y); + init(img->width(), img->height(), (const uint *)img->pixels(), x, y); } void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y) @@ -89,34 +89,34 @@ void ColorBlock::init(uint w, uint h, const uint * data, uint x, uint y) const uint bw = min(w - x, 4U); const uint bh = min(h - y, 4U); - // Blocks that are smaller than 4x4 are handled by repeating the pixels. - // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( - // @@ Ideally we should zero the weights of the pixels out of range. + // Blocks that are smaller than 4x4 are handled by repeating the pixels. + // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( + // @@ Ideally we should zero the weights of the pixels out of range. - for (uint i = 0; i < 4; i++) - { - const int by = i % bh; + for (uint i = 0; i < 4; i++) + { + const int by = i % bh; - for (uint e = 0; e < 4; e++) - { - const int bx = e % bw; - const uint idx = (y + by) * w + x + bx; + for (uint e = 0; e < 4; e++) + { + const int bx = e % bw; + const uint idx = (y + by) * w + x + bx; - color(e, i).u = data[idx]; - } - } + color(e, i).u = data[idx]; + } + } } void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y) { - const uint bw = min(w - x, 4U); - const uint bh = min(h - y, 4U); + const uint bw = min(w - x, 4U); + const uint bh = min(h - y, 4U); // Blocks that are smaller than 4x4 are handled by repeating the pixels. // @@ Thats only correct when block size is 1, 2 or 4, but not with 3. :( - // @@ Ideally we should zero the weights of the pixels out of range. + // @@ Ideally we should zero the weights of the pixels out of range. - uint srcPlane = w * h; + uint srcPlane = w * h; for (uint i = 0; i < 4; i++) { @@ -125,13 +125,13 @@ void ColorBlock::init(uint w, uint h, const float * data, uint x, uint y) for (uint e = 0; e < 4; e++) { const uint bx = e % bw; - const uint idx = ((y + by) * w + x + bx); + const uint idx = ((y + by) * w + x + bx); Color32 & c = color(e, i); - c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes? - c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f)); - c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f)); - c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f)); + c.r = uint8(255 * clamp(data[idx + 0 * srcPlane], 0.0f, 1.0f)); // @@ Is this the right way to quantize floats to bytes? + c.g = uint8(255 * clamp(data[idx + 1 * srcPlane], 0.0f, 1.0f)); + c.b = uint8(255 * clamp(data[idx + 2 * srcPlane], 0.0f, 1.0f)); + c.a = uint8(255 * clamp(data[idx + 3 * srcPlane], 0.0f, 1.0f)); } } } diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c index 270c665f809..a8c0bb97137 100644 --- a/source/blender/makesrna/intern/rna_scene.c +++ b/source/blender/makesrna/intern/rna_scene.c @@ -201,7 +201,7 @@ EnumPropertyItem image_only_type_items[] = { IMAGE_TYPE_ITEMS_IMAGE_ONLY - {0, NULL, 0, NULL, NULL}}; + {0, NULL, 0, NULL, NULL}}; EnumPropertyItem image_type_items[] = { {0, "", 0, "Image", NULL}, diff --git a/source/blender/makesrna/intern/rna_tracking.c b/source/blender/makesrna/intern/rna_tracking.c index dae163e4cc8..70af5599a15 100644 --- a/source/blender/makesrna/intern/rna_tracking.c +++ b/source/blender/makesrna/intern/rna_tracking.c @@ -227,10 +227,10 @@ static void rna_tracking_trackerAlgorithm_update(Main *UNUSED(bmain), Scene *UNU { MovieTrackingTrack *track = (MovieTrackingTrack *)ptr->data; - if (track->tracker == TRACKER_KLT) - BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS); - else - BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM); + if (track->tracker == TRACKER_KLT) + BKE_tracking_clamp_track(track, CLAMP_PYRAMID_LEVELS); + else + BKE_tracking_clamp_track(track, CLAMP_SEARCH_DIM); } static void rna_tracking_trackerPyramid_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *ptr) diff --git a/source/blender/python/generic/py_capi_utils.c b/source/blender/python/generic/py_capi_utils.c index eca2888dcff..11607ad78b8 100644 --- a/source/blender/python/generic/py_capi_utils.c +++ b/source/blender/python/generic/py_capi_utils.c @@ -399,7 +399,7 @@ const char *PyC_UnicodeAsByte(PyObject *py_str, PyObject **coerce) PyObject *PyC_UnicodeFromByteAndSize(const char *str, Py_ssize_t size) { - PyObject *result = PyUnicode_FromStringAndSize(str, size); + PyObject *result = PyUnicode_FromStringAndSize(str, size); if (result) { /* 99% of the time this is enough but we better support non unicode * chars since blender doesnt limit this */ -- cgit v1.2.3