[hackers] [libdraw] simpler drawrect || Connor Lane Smith

From: <hg_AT_suckless.org>
Date: Wed, 11 Aug 2010 14:24:43 +0000 (UTC)

changeset: 15:9810903f8a7e
tag: tip
user: Connor Lane Smith <cls_AT_lubutu.com>
date: Wed Aug 11 15:24:38 2010 +0100
files: drawrect.c
description:
simpler drawrect

diff -r dda4630df932 -r 9810903f8a7e drawrect.c
--- a/drawrect.c Wed Aug 11 14:24:03 2010 +0100
+++ b/drawrect.c Wed Aug 11 15:24:38 2010 +0100
@@ -4,11 +4,12 @@
 
 void
 drawrect(DC *dc, int x, int y, unsigned int w, unsigned int h, Bool fill, unsigned long color) {
- XRectangle r = { dc->x + x, dc->y + y, w - (fill ? 0 : 1), h - (fill ? 0 : 1) };
+ XRectangle r = { dc->x + x, dc->y + y, w, h };
 
+ if(!fill) {
+ r.w -= 1;
+ r.h -= 1;
+ }
         XSetForeground(dc->dpy, dc->gc, color);
- if(fill)
- XFillRectangles(dc->dpy, dc->canvas, dc->gc, &r, 1);
- else
- XDrawRectangles(dc->dpy, dc->canvas, dc->gc, &r, 1);
+ (fill ? XFillRectangles : XDrawRectangles)(dc->dpy, dc->canvas, dc->gc, &r, 1);
 }
Received on Wed Aug 11 2010 - 16:24:43 CEST

This archive was generated by hypermail 2.2.0 : Wed Aug 11 2010 - 16:36:03 CEST