summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2012-01-18 00:56:07 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2012-01-19 09:54:44 +0000
commitff2eb116ef85182eea9ed06daaa1e9a4f7bdbad3 (patch)
treeb9148c80947f3bb189b825800afdfcf099a60558
parent3c010745076204ed3b66e947c9eab6de84f670fe (diff)
sna: Micro-optimise line extents for zero line width
Handling zero line widths is the common case, so avoid the extra work. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r--src/sna/sna_accel.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/src/sna/sna_accel.c b/src/sna/sna_accel.c
index 79555e57..08889f89 100644
--- a/src/sna/sna_accel.c
+++ b/src/sna/sna_accel.c
@@ -5192,19 +5192,11 @@ sna_poly_line_extents(DrawablePtr drawable, GCPtr gc,
BoxPtr out)
{
BoxRec box;
- int extra = gc->lineWidth >> 1;
bool clip, blt = true;
if (n == 0)
return 0;
- if (n > 1) {
- if (gc->joinStyle == JoinMiter)
- extra = 6 * gc->lineWidth;
- else if (gc->capStyle == CapProjecting)
- extra = gc->lineWidth;
- }
-
box.x2 = box.x1 = pt->x;
box.y2 = box.y1 = pt->y;
if (mode == CoordModePrevious) {
@@ -5234,11 +5226,20 @@ sna_poly_line_extents(DrawablePtr drawable, GCPtr gc,
box.x2++;
box.y2++;
- if (extra) {
- box.x1 -= extra;
- box.x2 += extra;
- box.y1 -= extra;
- box.y2 += extra;
+ if (gc->lineWidth) {
+ int extra = gc->lineWidth >> 1;
+ if (n > 1) {
+ if (gc->joinStyle == JoinMiter)
+ extra = 6 * gc->lineWidth;
+ else if (gc->capStyle == CapProjecting)
+ extra = gc->lineWidth;
+ }
+ if (extra) {
+ box.x1 -= extra;
+ box.x2 += extra;
+ box.y1 -= extra;
+ box.y2 += extra;
+ }
}
clip = trim_and_translate_box(&box, drawable, gc);