[Xfce4-commits] <xfwm4:master> Small optimization in shadow loop.
Nick Schermer
noreply at xfce.org
Tue Dec 4 23:26:02 CET 2012
Updating branch refs/heads/master
to d4f2512d3826f745593a015a1699f9d867c030b8 (commit)
from b42ba05a6b37f0834c1f4e80696ca4d36f9cb322 (commit)
commit d4f2512d3826f745593a015a1699f9d867c030b8
Author: Nick Schermer <nick at xfce.org>
Date: Sat Dec 1 14:00:02 2012 +0100
Small optimization in shadow loop.
Do some caclulations outside the loop or store them,
callgrind showed this loop was called _a lot_ and spend
most of the time in this part of the code.
src/compositor.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/src/compositor.c b/src/compositor.c
index c0ce4ea..428989c 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -421,6 +421,8 @@ make_shadow (ScreenInfo *screen_info, gdouble opacity, gint width, gint height)
gint x, y;
gint x_diff;
gint opacity_int;
+ gint x_swidth;
+ gint y_swidth;
g_return_val_if_fail (screen_info != NULL, NULL);
TRACE ("entering make_shadow");
@@ -537,10 +539,12 @@ make_shadow (ScreenInfo *screen_info, gdouble opacity, gint width, gint height)
{
d = sum_gaussian (screen_info->gaussianMap, opacity, x - center, center, width, height);
}
+ x_swidth = swidth - x - 1;
for (y = gaussianSize; y < sheight - gaussianSize; y++)
{
- data[y * swidth + x] = d;
- data[y * swidth + (swidth - x - 1)] = d;
+ y_swidth = y * swidth;
+ data[y_swidth + x] = d;
+ data[y_swidth + x_swidth] = d;
}
}
More information about the Xfce4-commits
mailing list