Ticket #1260: trac1260_pre1.patch

File trac1260_pre1.patch, 1.9 KB (added by mvglasow (2), 8 years ago)

Crude fix for button redraw (works for use=overlay=1 only)

  • navit/navit/osd/core/osd_core.c

    From d9f9159527d04fadcc09aaddbb49e85b19993da9 Mon Sep 17 00:00:00 2001
    From: mvglasow <michael -at- vonglasow.com>
    Date: Fri, 3 Oct 2014 16:20:37 +0200
    Subject: [PATCH] osd/core: Make button resize correctly with use_overlay
    
    Signed-off-by: mvglasow <michael -at- vonglasow.com>
    ---
     navit/navit/osd/core/osd_core.c |   38 ++++++++++++++++++++++++++++++++------
     1 file changed, 32 insertions(+), 6 deletions(-)
    
    diff --git a/navit/navit/osd/core/osd_core.c b/navit/navit/osd/core/osd_core.c
    index de53e7f..df6c770 100644
    a b static void 
    14341434osd_button_draw(struct osd_priv_common *opc, struct navit *nav)
    14351435{
    14361436        struct osd_button *this = (struct osd_button *)opc->data;
    1437 
    1438         struct point bp = opc->osd_item.p;
    1439         if (!opc->osd_item.configured)
     1437        struct graphics *gra;
     1438        gra = navit_get_graphics(nav);
     1439        this->img = graphics_image_new(gra, this->src);
     1440        if (!this->img) {
     1441                dbg(1, "failed to load '%s'\n", this->src);
    14401442                return;
    1441         osd_wrap_point(&bp, nav);
    1442         if(this->img)
    1443                 graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_bg, &bp, this->img);
     1443        }
     1444        if (!opc->osd_item.w)
     1445                opc->osd_item.w=this->img->width;
     1446        if (!opc->osd_item.h)
     1447                opc->osd_item.h=this->img->height;
     1448
     1449        if(navit_get_blocked(nav)&1)
     1450                return;
     1451
     1452        if (this->use_overlay) {
     1453                struct graphics_image *img;
     1454                struct point p;
     1455                img=graphics_image_new(opc->osd_item.gr, this->src);
     1456                p.x=(opc->osd_item.w-this->img->width)/2;
     1457                p.y=(opc->osd_item.h-this->img->height)/2;
     1458                osd_std_draw(&opc->osd_item);
     1459                graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_bg, &p, img);
     1460                graphics_image_free(opc->osd_item.gr, img);
     1461        } else {
     1462                struct point bp = opc->osd_item.p;
     1463                if (!opc->osd_item.configured)
     1464                        return;
     1465                osd_wrap_point(&bp, nav);
     1466
     1467                if(this->img)
     1468                        graphics_draw_image(opc->osd_item.gr, opc->osd_item.graphic_bg, &bp, this->img);
     1469        }
    14441470}
    14451471
    14461472static void