[Bf-blender-cvs] [2ecc33d84b7] master: Cleanup: move repeated assignment out of nested for loop

Campbell Barton noreply at git.blender.org
Mon Jul 5 14:13:35 CEST 2021


Commit: 2ecc33d84b7c4cd1a235bd6afb4dd306a8b3dfc8
Author: Campbell Barton
Date:   Mon Jul 5 22:00:46 2021 +1000
Branches: master
https://developer.blender.org/rB2ecc33d84b7c4cd1a235bd6afb4dd306a8b3dfc8

Cleanup: move repeated assignment out of nested for loop

===================================================================

M	source/blender/editors/space_image/image_ops.c

===================================================================

diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c
index 3e8ac060862..6b9821745c7 100644
--- a/source/blender/editors/space_image/image_ops.c
+++ b/source/blender/editors/space_image/image_ops.c
@@ -2734,8 +2734,8 @@ static int image_flip_exec(bContext *C, wmOperator *op)
 
     float *orig_float_pixels = MEM_dupallocN(float_pixels);
     for (int x = 0; x < size_x; x++) {
+      const int source_pixel_x = use_flip_x ? size_x - x - 1 : x;
       for (int y = 0; y < size_y; y++) {
-        const int source_pixel_x = use_flip_x ? size_x - x - 1 : x;
         const int source_pixel_y = use_flip_y ? size_y - y - 1 : y;
 
         const float *source_pixel =
@@ -2755,8 +2755,8 @@ static int image_flip_exec(bContext *C, wmOperator *op)
     char *char_pixels = (char *)ibuf->rect;
     char *orig_char_pixels = MEM_dupallocN(char_pixels);
     for (int x = 0; x < size_x; x++) {
+      const int source_pixel_x = use_flip_x ? size_x - x - 1 : x;
       for (int y = 0; y < size_y; y++) {
-        const int source_pixel_x = use_flip_x ? size_x - x - 1 : x;
         const int source_pixel_y = use_flip_y ? size_y - y - 1 : y;
 
         const char *source_pixel =



More information about the Bf-blender-cvs mailing list