summaryrefslogtreecommitdiff
path: root/navit/osd
diff options
context:
space:
mode:
authorStefan Wildemann <metalstrolch@metalstrolche.de>2015-11-21 17:18:45 +0100
committerStefan Wildemann <metalstrolch@metalstrolche.de>2016-01-06 11:09:59 +0100
commitb7d8ec97f64c3b5423649788023d45dcebd2cd81 (patch)
tree0ed03cff44c41159713c99a20e21290af1a6b7a0 /navit/osd
parentdd6bf1368ca94cbd8fc0d7693c0aea44d365bf7a (diff)
downloadnavit-b7d8ec97f64c3b5423649788023d45dcebd2cd81.tar.gz
fix:osd: Make osd "Button" accept h and w props
Diffstat (limited to 'navit/osd')
-rw-r--r--navit/osd/core/osd_core.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/navit/osd/core/osd_core.c b/navit/osd/core/osd_core.c
index cd19aeb55..4c90cf7ea 100644
--- a/navit/osd/core/osd_core.c
+++ b/navit/osd/core/osd_core.c
@@ -1457,7 +1457,7 @@ osd_button_draw(struct osd_priv_common *opc, struct navit *nav)
if (this->use_overlay) {
struct graphics_image *img;
- img=graphics_image_new(opc->osd_item.gr, this->src);
+ img=graphics_image_new_scaled(opc->osd_item.gr, this->src, opc->osd_item.w, opc->osd_item.h);
osd_button_adjust_sizes(opc, img);
p.x=(opc->osd_item.w-img->width)/2;
p.y=(opc->osd_item.h-img->height)/2;
@@ -1467,7 +1467,7 @@ osd_button_draw(struct osd_priv_common *opc, struct navit *nav)
} else {
struct graphics *gra;
gra = navit_get_graphics(nav);
- this->img = graphics_image_new(gra, this->src);
+ this->img = graphics_image_new_scaled(gra, this->src, opc->osd_item.w, opc->osd_item.h);
if (!this->img) {
dbg(lvl_warning, "failed to load '%s'\n", this->src);
@@ -1494,18 +1494,27 @@ osd_button_init(struct osd_priv_common *opc, struct navit *nav)
struct osd_button *this = (struct osd_button *)opc->data;
struct graphics *gra = navit_get_graphics(nav);
+
+ /* translate properties to real size */
+ osd_std_calculate_sizes(&opc->osd_item, navit_get_width(nav), navit_get_height(nav));
+
dbg(lvl_debug, "enter\n");
- this->img = graphics_image_new(gra, this->src);
+ dbg(lvl_debug, "Get: %s, %d, %d, %d, %d\n", this->src, opc->osd_item.rel_w, opc->osd_item.rel_h, opc->osd_item.w, opc->osd_item.h);
+ this->img = graphics_image_new_scaled(gra, this->src, opc->osd_item.w, opc->osd_item.h);
if (!this->img) {
dbg(lvl_warning, "failed to load '%s'\n", this->src);
return;
}
+ else
+ {
+ dbg(lvl_debug,"Got %s: %d, %d\n", this->src, this->img->width, this->img->height);
+ }
osd_button_adjust_sizes(opc, this->img);
if (this->use_overlay) {
struct graphics_image *img;
struct point p;
osd_set_std_graphic(nav, &opc->osd_item, (struct osd_priv *)opc);
- img=graphics_image_new(opc->osd_item.gr, this->src);
+ img=graphics_image_new_scaled(opc->osd_item.gr, this->src, opc->osd_item.w, opc->osd_item.h);
p.x=(opc->osd_item.w-this->img->width)/2;
p.y=(opc->osd_item.h-this->img->height)/2;
osd_fill_with_bgcolor(&opc->osd_item);
@@ -1550,7 +1559,7 @@ osd_button_set_attr(struct osd_priv_common *opc, struct attr* attr)
}
nav = opc->osd_item.navit;
gra = navit_get_graphics(nav);
- this_->img = graphics_image_new(gra, this_->src);
+ this_->img = graphics_image_new_scaled(gra, this_->src, opc->osd_item.w, opc->osd_item.h);
if (!this_->img) {
dbg(lvl_warning, "failed to load '%s'\n", this_->src);
return 0;