Resolve bugs in linestring rasterization.

Fixes #397.