diff options
author | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-03-18 22:18:53 +0000 |
---|---|---|
committer | sleske <sleske@ffa7fe5e-494d-0410-b361-a75ebd5db220> | 2013-03-18 22:18:53 +0000 |
commit | 245e568a0eeed29d9052b711c6cea941c2232e49 (patch) | |
tree | f2784a712ccab5133380329de1bea8c0843795cc /navit/graphics.c | |
parent | d47c976160a21dab087b13cf85df580dbf1182a5 (diff) | |
download | navit-svn-245e568a0eeed29d9052b711c6cea941c2232e49.tar.gz |
Fix:core:Do not use max. linewidth for clipping rectangle, as linewidth may itself need clipping.|May fix #1062.
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit@5417 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'navit/graphics.c')
-rw-r--r-- | navit/graphics.c | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/navit/graphics.c b/navit/graphics.c index f3a509a2..1cf0ac89 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -1612,20 +1612,22 @@ graphics_draw_polyline_clipped(struct graphics *gra, struct graphics_gc *gc, str struct wpoint segment_start,segment_end; int i,points_to_draw_cnt=0; int clip_result; - int wmax; + int r_width, r_height; struct point_rect r=gra->r; - wmax=width[0]; - for (i = 1 ; i < count ; i++) { - if (width[i] > wmax) - wmax=width[i]; - } - if (wmax <= 0) - return; - r.lu.x-=wmax; - r.lu.y-=wmax; - r.rl.x+=wmax; - r.rl.y+=wmax; + r_width=r.rl.x-r.lu.x; + r_height=r.rl.y-r.lu.y; + + // Expand clipping rect by 1/3 so wide, slanted lines do not + // partially end before screen border. + // Ideally we would expand by the line width here, but in 3D + // mode the width is variable and needs clipping itself, so that + // would get complicated. Anyway, 1/3 of screen size should be + // enough... + r.lu.x-=r_width/3; + r.lu.y-=r_height/3; + r.rl.x+=r_width/3; + r.rl.y+=r_height/3; // Iterate over line segments, push them into points_to_draw // until we reach a completely invisible segment... for (i = 0 ; i < count ; i++) { |