diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-06-15 21:55:37 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-06-15 21:55:37 +0300 |
commit | 0ff87e3a601c7a6db387285582aa1ed34a224b2f (patch) | |
tree | 9d6e9dfe1f28a188c9348c395859c632694d22fb | |
parent | e3d88b021c07dc9e864c55d766b305d7d3b8efb8 (diff) |
Cleanup: code style
-rw-r--r-- | source/blender/blenkernel/intern/image.c | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/studiolight.c | 20 | ||||
-rw-r--r-- | source/blender/blenloader/intern/versioning_280.c | 2 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_cache_impl_particles.c | 10 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 7 |
5 files changed, 25 insertions, 22 deletions
diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 3e7a9de6968..d165c6dddc9 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -4739,10 +4739,12 @@ bool BKE_image_remove_renderslot(Image *ima, ImageUser *iuser, int index) RenderSlot *current_last_slot = BLI_findlink(&ima->renderslots, ima->last_render_slot); RenderSlot *next_slot; - if (current_slot == remove_slot) - next_slot = BLI_findlink(&ima->renderslots, (index == num_slots-1)? index-1 : index+1); - else + if (current_slot == remove_slot) { + next_slot = BLI_findlink(&ima->renderslots, (index == num_slots - 1) ? index - 1 : index + 1); + } + else { next_slot = current_slot; + } /* If the slot to be removed is the slot with the last render, make another slot the last render slot. */ if (remove_slot == current_last_slot) { diff --git a/source/blender/blenkernel/intern/studiolight.c b/source/blender/blenkernel/intern/studiolight.c index cf0bdf8c9e8..e73cd3c37a4 100644 --- a/source/blender/blenkernel/intern/studiolight.c +++ b/source/blender/blenkernel/intern/studiolight.c @@ -194,20 +194,21 @@ static void studiolight_create_equierectangular_radiance_gputexture(StudioLight ImBuf *ibuf = sl->equirectangular_radiance_buffer; if (sl->flag & STUDIOLIGHT_ORIENTATION_VIEWNORMAL) { - sl->gpu_matcap_3components = MEM_callocN(sizeof(float) * ibuf->x * ibuf->y * 3, __func__); - - float* offset4 = ibuf->rect_float; - float* offset3 = sl->gpu_matcap_3components; - for (int i = 0 ; i < ibuf->x * ibuf->y; i ++) - { + sl->gpu_matcap_3components = MEM_callocN(sizeof(float[3]) * ibuf->x * ibuf->y, __func__); + + float *offset4 = ibuf->rect_float; + float *offset3 = sl->gpu_matcap_3components; + for (int i = 0 ; i < ibuf->x * ibuf->y; i++) { copy_v3_v3(offset3, offset4); offset3 += 3; offset4 += 4; } - sl->equirectangular_radiance_gputexture = GPU_texture_create_2D(ibuf->x, ibuf->y, GPU_R11F_G11F_B10F, sl->gpu_matcap_3components, error); + sl->equirectangular_radiance_gputexture = GPU_texture_create_2D( + ibuf->x, ibuf->y, GPU_R11F_G11F_B10F, sl->gpu_matcap_3components, error); } else { - sl->equirectangular_radiance_gputexture = GPU_texture_create_2D(ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, error); + sl->equirectangular_radiance_gputexture = GPU_texture_create_2D( + ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, error); GPUTexture *tex = sl->equirectangular_radiance_gputexture; GPU_texture_bind(tex, 0); GPU_texture_filter_mode(tex, true); @@ -224,7 +225,8 @@ static void studiolight_create_equierectangular_irradiance_gputexture(StudioLigh char error[256]; BKE_studiolight_ensure_flag(sl, STUDIOLIGHT_EQUIRECTANGULAR_IRRADIANCE_IMAGE_CALCULATED); ImBuf *ibuf = sl->equirectangular_irradiance_buffer; - sl->equirectangular_irradiance_gputexture = GPU_texture_create_2D(ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, error); + sl->equirectangular_irradiance_gputexture = GPU_texture_create_2D( + ibuf->x, ibuf->y, GPU_RGBA16F, ibuf->rect_float, error); GPUTexture *tex = sl->equirectangular_irradiance_gputexture; GPU_texture_bind(tex, 0); GPU_texture_filter_mode(tex, true); diff --git a/source/blender/blenloader/intern/versioning_280.c b/source/blender/blenloader/intern/versioning_280.c index 2dda6f00faf..e7d4e4f33ae 100644 --- a/source/blender/blenloader/intern/versioning_280.c +++ b/source/blender/blenloader/intern/versioning_280.c @@ -1592,7 +1592,7 @@ void blo_do_versions_280(FileData *fd, Library *UNUSED(lib), Main *bmain) if (ima->type == IMA_TYPE_R_RESULT) { for (int i = 0; i < 8; i++) { RenderSlot *slot = MEM_callocN(sizeof(RenderSlot), "Image Render Slot Init"); - BLI_snprintf(slot->name, sizeof(slot->name), "Slot %d", i+1); + BLI_snprintf(slot->name, sizeof(slot->name), "Slot %d", i + 1); BLI_addtail(&ima->renderslots, slot); } } diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c index 7024380d9bc..b3006f1bd98 100644 --- a/source/blender/draw/intern/draw_cache_impl_particles.c +++ b/source/blender/draw/intern/draw_cache_impl_particles.c @@ -1318,11 +1318,11 @@ typedef struct ParticleDrawSource { } ParticleDrawSource; static void drw_particle_get_hair_source( - Object *object, - ParticleSystem *psys, - ModifierData *md, - PTCacheEdit *edit, - ParticleDrawSource *r_draw_source) + Object *object, + ParticleSystem *psys, + ModifierData *md, + PTCacheEdit *edit, + ParticleDrawSource *r_draw_source) { r_draw_source->object = object; r_draw_source->psys = psys; diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 6e0c71c2224..be76af34489 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1435,7 +1435,7 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big id = RNA_pointer_get(ptr, "texture").data; } else if (RNA_struct_is_a(ptr->type, &RNA_DynamicPaintSurface)) { - DynamicPaintSurface *surface = (DynamicPaintSurface *)ptr->data; + DynamicPaintSurface *surface = ptr->data; if (surface->format == MOD_DPAINT_SURFACE_F_PTEX) return ICON_TEXTURE_SHADED; @@ -1445,9 +1445,8 @@ int UI_rnaptr_icon_get(bContext *C, PointerRNA *ptr, int rnaicon, const bool big return ICON_FILE_IMAGE; } else if (RNA_struct_is_a(ptr->type, &RNA_StudioLight)) { - StudioLight *sl = (StudioLight *)ptr->data; - switch (sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS) - { + StudioLight *sl = ptr->data; + switch (sl->flag & STUDIOLIGHT_FLAG_ORIENTATIONS) { case STUDIOLIGHT_ORIENTATION_CAMERA: return sl->icon_id_irradiance; case STUDIOLIGHT_ORIENTATION_WORLD: |