From 2ecc33d84b7c4cd1a235bd6afb4dd306a8b3dfc8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Mon, 5 Jul 2021 22:00:46 +1000 Subject: Cleanup: move repeated assignment out of nested for loop --- source/blender/editors/space_image/image_ops.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'source/blender/editors') 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 = -- cgit v1.2.3