From: Christophe CURIS <[email protected]>

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 <[email protected]>
---
 src/switchpanel.c | 44 +++++++++++++++++++-------------------------
 1 file changed, 19 insertions(+), 25 deletions(-)

diff --git a/src/switchpanel.c b/src/switchpanel.c
index 348d8cf..6ced6eb 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);
-- 
2.0.0


-- 
To unsubscribe, send mail to [email protected].

Reply via email to