From d31472773b97de0e1df8cbf60ae46abd958f5aeb Mon Sep 17 00:00:00 2001 From: Christophe CURIS Date: Fri, 4 Jul 2014 23:28:41 +0200 Subject: [PATCH] wmaker: remove checks on variables that have already been checked In the function that creates the background image for the switch panel there are a number of checks on the size of the image, but this has already been checked at the beginning of the function with an early return in this case. Signed-off-by: Christophe CURIS --- src/switchpanel.c | 44 +++++++++++++++++++------------------------- 1 file changed, 19 insertions(+), 25 deletions(-) diff --git a/src/switchpanel.c b/src/switchpanel.c index 348d8cfc..6ced6eb2 100644 --- a/src/switchpanel.c +++ b/src/switchpanel.c @@ -261,35 +261,29 @@ static RImage *assemblePuzzleImage(RImage **images, int width, int height) RFillImage(img, &color); /* top */ - if (tw > 0) { - tmp = RSmoothScaleImage(images[1], tw, images[1]->height); - RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, images[0]->width, 0); - RReleaseImage(tmp); - } + tmp = RSmoothScaleImage(images[1], tw, images[1]->height); + RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, images[0]->width, 0); + RReleaseImage(tmp); + /* bottom */ - if (tw > 0) { - tmp = RSmoothScaleImage(images[7], tw, images[7]->height); - RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, images[6]->width, height - images[6]->height); - RReleaseImage(tmp); - } + tmp = RSmoothScaleImage(images[7], tw, images[7]->height); + RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, images[6]->width, height - images[6]->height); + RReleaseImage(tmp); + /* left */ - if (th > 0) { - tmp = RSmoothScaleImage(images[3], images[3]->width, th); - RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, 0, images[0]->height); - RReleaseImage(tmp); - } + tmp = RSmoothScaleImage(images[3], images[3]->width, th); + RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, 0, images[0]->height); + RReleaseImage(tmp); + /* right */ - if (th > 0) { - tmp = RSmoothScaleImage(images[5], images[5]->width, th); - RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, width - images[5]->width, images[2]->height); - RReleaseImage(tmp); - } + tmp = RSmoothScaleImage(images[5], images[5]->width, th); + RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, width - images[5]->width, images[2]->height); + RReleaseImage(tmp); + /* center */ - if (tw > 0 && th > 0) { - tmp = RSmoothScaleImage(images[4], tw, th); - RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, images[0]->width, images[0]->height); - RReleaseImage(tmp); - } + tmp = RSmoothScaleImage(images[4], tw, th); + RCopyArea(img, tmp, 0, 0, tmp->width, tmp->height, images[0]->width, images[0]->height); + RReleaseImage(tmp); /* corners */ RCopyArea(img, images[0], 0, 0, images[0]->width, images[0]->height, 0, 0);