summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Pohlink <pohlinkzei@gmx-topmail.de>2017-05-06 04:39:32 +0200
committerPierre GRANDIN <pgrandin@users.noreply.github.com>2017-05-05 19:39:32 -0700
commit1715e677fd4a459c88491952af8dab7fe6262afa (patch)
tree4df7a9afd316d5ec98a0f401ec0bfb6df5fabc9d
parent8c48382a411a0c16f1d1cf7d015ea921f1adb2d0 (diff)
downloadnavit-1715e677fd4a459c88491952af8dab7fe6262afa.tar.gz
Trac-1246: Draw background color even if text label is empty. (#234)R7473
-rw-r--r--navit/osd/core/osd_core.c124
1 files changed, 61 insertions, 63 deletions
diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c
index ece6bc378..45a7fb7c6 100644
--- a/navit/osd/core/osd_core.c
+++ b/navit/osd/core/osd_core.c
@@ -3203,81 +3203,79 @@ osd_text_draw(struct osd_priv_common *opc, struct navit *navit, struct vehicle *
}
absbegin=str;
+
if (do_draw) {
- //osd_fill_with_bgcolor(&opc->osd_item);
- }
- if (do_draw && str) {
osd_fill_with_bgcolor(&opc->osd_item);
- lines=0;
- next=str;
- last=str;
- while ((next=strstr(next, "\\n"))) {
- last = next;
- lines++;
- next++;
- }
-
- while (*last) {
- if (! g_ascii_isspace(*last)) {
+ if (str) {
+ lines=0;
+ next=str;
+ last=str;
+ while ((next=strstr(next, "\\n"))) {
+ last = next;
lines++;
- break;
+ next++;
}
- last++;
- }
- dbg(lvl_debug,"this->align=%d\n", this->align);
- switch (this->align & 51) {
- case 1:
- p.y=0;
- break;
- case 2:
- p.y=(opc->osd_item.h-lines*(height+yspacing)-yspacing);
- break;
- case 16: // Grow from top to bottom
- p.y = 0;
- if (lines != 0) {
- opc->osd_item.h = (lines-1) * (height+yspacing) + height;
- } else {
- opc->osd_item.h = 0;
- }
-
- if (do_draw) {
- osd_std_resize(&opc->osd_item);
+ while (*last) {
+ if (! g_ascii_isspace(*last)) {
+ lines++;
+ break;
+ }
+ last++;
}
- default:
- p.y=(opc->osd_item.h-lines*(height+yspacing)-yspacing)/2;
- }
- while (str) {
- next=strstr(str, "\\n");
- if (next) {
- *next='\0';
- next+=2;
- }
- graphics_get_text_bbox(opc->osd_item.gr,
- opc->osd_item.font,
- str, 0x10000,
- 0x0, p2, 0);
- switch (this->align & 12) {
- case 4:
- p.x=xspacing;
+ dbg(lvl_debug,"this->align=%d\n", this->align);
+ switch (this->align & 51) {
+ case 1:
+ p.y=0;
break;
- case 8:
- p.x=opc->osd_item.w-(p2[2].x-p2[0].x)-xspacing;
+ case 2:
+ p.y=(opc->osd_item.h-lines*(height+yspacing)-yspacing);
break;
+ case 16: // Grow from top to bottom
+ p.y = 0;
+ if (lines != 0) {
+ opc->osd_item.h = (lines-1) * (height+yspacing) + height;
+ } else {
+ opc->osd_item.h = 0;
+ }
+
+ if (do_draw) {
+ osd_std_resize(&opc->osd_item);
+ }
default:
- p.x = ((p2[0].x - p2[2].x) / 2) + (opc->osd_item.w / 2);
+ p.y=(opc->osd_item.h-lines*(height+yspacing)-yspacing)/2;
+ }
+
+ while (str) {
+ next=strstr(str, "\\n");
+ if (next) {
+ *next='\0';
+ next+=2;
+ }
+ graphics_get_text_bbox(opc->osd_item.gr,
+ opc->osd_item.font,
+ str, 0x10000,
+ 0x0, p2, 0);
+ switch (this->align & 12) {
+ case 4:
+ p.x=xspacing;
+ break;
+ case 8:
+ p.x=opc->osd_item.w-(p2[2].x-p2[0].x)-xspacing;
+ break;
+ default:
+ p.x = ((p2[0].x - p2[2].x) / 2) + (opc->osd_item.w / 2);
+ }
+ p.y += height+yspacing;
+ graphics_draw_text(opc->osd_item.gr,
+ opc->osd_item.graphic_fg_text,
+ NULL, opc->osd_item.font,
+ str, &p, 0x10000,
+ 0);
+ str=next;
}
- p.y += height+yspacing;
- graphics_draw_text(opc->osd_item.gr,
- opc->osd_item.graphic_fg_text,
- NULL, opc->osd_item.font,
- str, &p, 0x10000,
- 0);
- str=next;
}
- }
- if(do_draw) {
graphics_draw_mode(opc->osd_item.gr, draw_mode_end);
}
g_free(absbegin);