From a3a6253291a11d201286b45adc595f449c92f837 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Kol=C3=A5s?= Date: Fri, 24 Aug 2007 15:58:49 +0000 Subject: [PATCH] removed a temporary variable, simplified logic slightly. * app/display/gimpdisplayshell-render.c: (compute_sample): removed a temporary variable, simplified logic slightly. (render_image_tile_fault, render_image_tile_fault_one_row): moved sum computation out of loop. svn path=/trunk/; revision=23362 --- ChangeLog | 7 +++++ app/display/gimpdisplayshell-render.c | 40 ++++++--------------------- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/ChangeLog b/ChangeLog index c91fbd6903..7aa21540bb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-08-24 Øyvind Kolås + + * app/display/gimpdisplayshell-render.c: (compute_sample): removed + a temporary variable, simplified logic slightly. + (render_image_tile_fault, render_image_tile_fault_one_row): moved + sum computation out of loop. + 2007-08-24 Øyvind Kolås * app/display/gimpdisplayshell-render.c: Replaced signed integres with diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c index c8b44952b3..8c4046c6a3 100644 --- a/app/display/gimpdisplayshell-render.c +++ b/app/display/gimpdisplayshell-render.c @@ -951,10 +951,9 @@ compute_sample (guint left_weight, for (i=0; i<=ALPHA; i++) { - guint res; if (a) { - res = ((middle_weight * ( + dest[i] = ((middle_weight * ( factors[0] * src[1][i] + factors[1] * src[4][i] + factors[2] * src[7][i]) + @@ -969,18 +968,8 @@ compute_sample (guint left_weight, factors[7] * src[3][i] + factors[8] * src[6][i]) - ) / a); + ) / a) & 0xff; } - else - { - res = 0; - } - if (res < 0) - dest[i] = 0; - else if (res>255) - dest[i] = 255; - else - dest[i] = res; } } #undef ALPHA @@ -1011,10 +1000,9 @@ compute_sample (guint left_weight, for (i=0; i<=ALPHA; i++) { - guint res; if (a) { - res = ((middle_weight * ( + dest[i] = ((middle_weight * ( factors[0] * src[1][i] + factors[1] * src[4][i] + factors[2] * src[7][i]) + @@ -1029,18 +1017,8 @@ compute_sample (guint left_weight, factors[7] * src[3][i] + factors[8] * src[6][i]) - ) / a); + ) / a) & 0xff; } - else - { - res = 0; - } - if (res < 0) - dest[i] = 0; - else if (res>255) - dest[i] = 255; - else - dest[i] = res; } } #undef ALPHA @@ -1083,6 +1061,7 @@ render_image_tile_fault (RenderInfo *info) gint footprint_x; gint footprint_y; + guint foosum; guint left_weight; guint middle_weight; @@ -1125,6 +1104,7 @@ render_image_tile_fault (RenderInfo *info) footprint_y = (1.0/info->scaley) * 256; footprint_x = (1.0/info->scalex) * 256; + foosum = footprint_x * footprint_y; { gint dy = info->yfraction; @@ -1277,7 +1257,6 @@ render_image_tile_fault (RenderInfo *info) { gint dx = (x >> 8) & 0xff; - guint foosum; if (dx > footprint_x/2) left_weight = 0; else @@ -1290,8 +1269,6 @@ render_image_tile_fault (RenderInfo *info) middle_weight = footprint_x - left_weight - right_weight; - foosum = footprint_x * footprint_y; - compute_sample (left_weight, middle_weight, right_weight, top_weight, center_weight, bottom_weight, foosum, src, dest, bpp); @@ -1624,6 +1601,7 @@ render_image_tile_fault_one_row (RenderInfo *info) guint footprint_x; guint footprint_y; + guint foosum; guint left_weight; guint middle_weight; @@ -1635,6 +1613,7 @@ render_image_tile_fault_one_row (RenderInfo *info) footprint_y = (1.0/info->scaley) * 256; footprint_x = (1.0/info->scalex) * 256; + foosum = footprint_x * footprint_y; { gint dy = info->yfraction; @@ -1751,7 +1730,6 @@ render_image_tile_fault_one_row (RenderInfo *info) { gint dx = (x >> 8) & 0xff; - guint foosum; if (dx > footprint_x/2) left_weight = 0; else @@ -1764,8 +1742,6 @@ render_image_tile_fault_one_row (RenderInfo *info) middle_weight = footprint_x - left_weight - right_weight; - foosum = footprint_x * footprint_y; - compute_sample (left_weight, middle_weight, right_weight, top_weight, center_weight, bottom_weight, foosum, src, dest, bpp);