From 3935ada407de4b84ef511b1206467cd23c711f29 Mon Sep 17 00:00:00 2001 From: Wildemann Stefan Date: Tue, 3 Sep 2019 09:31:36 +0200 Subject: Fix:graphics/sdl Always use new polygon with holes primitive Always use polygon with holes primitive for drawing polygons, as this should be faster than older SDL_gfx like drawing primitives because we do not copy the coordinates into different style buffer before raycasting. --- navit/graphics/sdl/graphics_sdl.c | 40 ++++----------------------------------- 1 file changed, 4 insertions(+), 36 deletions(-) diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c index bffe65a18..d92699307 100644 --- a/navit/graphics/sdl/graphics_sdl.c +++ b/navit/graphics/sdl/graphics_sdl.c @@ -319,42 +319,10 @@ static void draw_polygon_with_holes (struct graphics_priv *gr, struct graphics_g } static void draw_polygon(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int count) { - if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent - && gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) { - return; - } - - Sint16 *vx, *vy; - Sint16 x, y; - int i; - - vx = alloca(count * sizeof(Sint16)); - vy = alloca(count * sizeof(Sint16)); - - for(i = 0; i < count; i++) { - x = (Sint16)p[i].x; - y = (Sint16)p[i].y; - vx[i] = x; - vy[i] = y; - - dbg(lvl_debug, "draw_polygon: %p %i %d,%d", gc, i, p[i].x, p[i].y); - } - - if(gr->aa) { - raster_aapolygon(gr->screen, count, vx, vy, - SDL_MapRGBA(gr->screen->format, - gc->fore_r, - gc->fore_g, - gc->fore_b, - gc->fore_a)); - } else { - raster_polygon(gr->screen, count, vx, vy, - SDL_MapRGBA(gr->screen->format, - gc->fore_r, - gc->fore_g, - gc->fore_b, - gc->fore_a)); - } + dbg(lvl_debug, "draw_polygon: %p ", gc); + /* Use polygon with holes primitive as this seems to be better performing than the + * traditional SDL_gfx like ones */ + draw_polygon_with_holes(gr, gc, p, count, 0, NULL, NULL); } static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc, struct point *p, int w, int h) { -- cgit v1.2.1