From 7bb79dab8e48bd0558c0d291d8463201543e19f1 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Tue, 23 Sep 2014 10:37:18 -0700 Subject: [PATCH] Optimize away deltas of 0 --- tile.cc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/tile.cc b/tile.cc index a2a390e..e004d71 100644 --- a/tile.cc +++ b/tile.cc @@ -130,12 +130,14 @@ void write_tile(struct index *start, struct index *end, char *metabase, unsigned int dx = wwx - px; int dy = wwy - py; - feature->add_geometry((dx << 1) ^ (dx >> 31)); - feature->add_geometry((dy << 1) ^ (dy >> 31)); + if (dx != 0 || dy != 0 || length == 0) { + feature->add_geometry((dx << 1) ^ (dx >> 31)); + feature->add_geometry((dy << 1) ^ (dy >> 31)); - px = wwx; - py = wwy; - length++; + px = wwx; + py = wwy; + length++; + } //printf("%lld,%lld ", wwx, wwy); } else if (op == VT_CLOSEPATH) {