Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-06-03 17:21:57 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-06-03 17:24:38 +0300
commit1f650c402d3b43eee7cb51c7d4f373ba82ac2116 (patch)
treeba2432fe9424ae545d3758d37ec8ebb0419a2ba5 /source/blender/makesrna/intern/rna_image.c
parente3f2034e7b925bc7e31e65051842cf26d70a20bc (diff)
Cleanup: style, use braces in RNA
Diffstat (limited to 'source/blender/makesrna/intern/rna_image.c')
-rw-r--r--source/blender/makesrna/intern/rna_image.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/source/blender/makesrna/intern/rna_image.c b/source/blender/makesrna/intern/rna_image.c
index d5cefaefbb1..2d8014b60d5 100644
--- a/source/blender/makesrna/intern/rna_image.c
+++ b/source/blender/makesrna/intern/rna_image.c
@@ -314,12 +314,15 @@ static int rna_Image_depth_get(PointerRNA *ptr)
ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (!ibuf)
+ if (!ibuf) {
planes = 0;
- else if (ibuf->rect_float)
+ }
+ else if (ibuf->rect_float) {
planes = ibuf->planes * 4;
- else
+ }
+ else {
planes = ibuf->planes;
+ }
BKE_image_release_ibuf(im, ibuf, lock);
@@ -355,10 +358,12 @@ static int rna_Image_pixels_get_length(PointerRNA *ptr, int length[RNA_MAX_ARRAY
ibuf = BKE_image_acquire_ibuf(ima, NULL, &lock);
- if (ibuf)
+ if (ibuf) {
length[0] = ibuf->x * ibuf->y * ibuf->channels;
- else
+ }
+ else {
length[0] = 0;
+ }
BKE_image_release_ibuf(ima, ibuf, lock);
@@ -381,8 +386,9 @@ static void rna_Image_pixels_get(PointerRNA *ptr, float *values)
memcpy(values, ibuf->rect_float, sizeof(float) * size);
}
else {
- for (i = 0; i < size; i++)
+ for (i = 0; i < size; i++) {
values[i] = ((unsigned char *)ibuf->rect)[i] * (1.0f / 255.0f);
+ }
}
}
@@ -405,8 +411,9 @@ static void rna_Image_pixels_set(PointerRNA *ptr, const float *values)
memcpy(ibuf->rect_float, values, sizeof(float) * size);
}
else {
- for (i = 0; i < size; i++)
+ for (i = 0; i < size; i++) {
((unsigned char *)ibuf->rect)[i] = unit_float_to_uchar_clamp(values[i]);
+ }
}
ibuf->userflags |= IB_DISPLAY_BUFFER_INVALID | IB_MIPMAP_INVALID;
@@ -428,8 +435,9 @@ static int rna_Image_channels_get(PointerRNA *ptr)
int channels = 0;
ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (ibuf)
+ if (ibuf) {
channels = ibuf->channels;
+ }
BKE_image_release_ibuf(im, ibuf, lock);
@@ -444,8 +452,9 @@ static bool rna_Image_is_float_get(PointerRNA *ptr)
bool is_float = false;
ibuf = BKE_image_acquire_ibuf(im, NULL, &lock);
- if (ibuf)
+ if (ibuf) {
is_float = ibuf->rect_float != NULL;
+ }
BKE_image_release_ibuf(im, ibuf, lock);
@@ -490,8 +499,9 @@ static void rna_render_slots_active_set(PointerRNA *ptr,
if (value.id.data == image) {
RenderSlot *slot = (RenderSlot *)value.data;
int index = BLI_findindex(&image->renderslots, slot);
- if (index != -1)
+ if (index != -1) {
image->render_slot = index;
+ }
}
}