summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohan FitiƩ <jfitie@gmail.com>2017-07-27 11:48:51 +0200
committerJohan FitiƩ <jfitie@gmail.com>2017-07-27 11:48:51 +0200
commit949e110a18875112f6b055ce57181088947dcb2e (patch)
tree14fa54ba82f40a2a18d4fcc6ae730e64ff72e5af
parent506a678c60d4455adf61ef26b44ecdb634685272 (diff)
downloadnavit-949e110a18875112f6b055ce57181088947dcb2e.tar.gz
Move logic
-rw-r--r--navit/navit.c1
-rw-r--r--navit/transform.c10
2 files changed, 4 insertions, 7 deletions
diff --git a/navit/navit.c b/navit/navit.c
index 42fb74dab..40622d49b 100644
--- a/navit/navit.c
+++ b/navit/navit.c
@@ -345,6 +345,7 @@ navit_handle_resize(struct navit *this_, int w, int h)
memset(&sel, 0, sizeof(sel));
this_->w=w;
this_->h=h;
+ this_->pitch=20*sqrt(240*320)/sqrt(w*h); // Pitch corrected for window resolution
sel.u.p_rect.rl.x=w;
sel.u.p_rect.rl.y=h;
transform_set_screen_selection(this_->trans, &sel);
diff --git a/navit/transform.c b/navit/transform.c
index 6edd17915..99d42c511 100644
--- a/navit/transform.c
+++ b/navit/transform.c
@@ -35,8 +35,6 @@
#include "point.h"
#define POST_SHIFT 8
-#define DEFRESX 240
-#define DEFRESY 320
/**
* @brief The parameters needed to transform a map for display.
@@ -94,8 +92,8 @@ transform_setup_matrix(struct transformation *t)
navit_float fac;
navit_float yawc=navit_cos(-M_PI*t->yaw/180);
navit_float yaws=navit_sin(-M_PI*t->yaw/180);
- navit_float pitchc=navit_cos(-M_PI*t->pitch*sqrt(DEFRESX*DEFRESY)/sqrt(t->w*t->h)/180); // Pitch corrected for window resolution
- navit_float pitchs=navit_sin(-M_PI*t->pitch*sqrt(DEFRESX*DEFRESY)/sqrt(t->w*t->h)/180);
+ navit_float pitchc=navit_cos(-M_PI*t->pitch/180);
+ navit_float pitchs=navit_sin(-M_PI*t->pitch/180);
#ifdef ENABLE_ROLL
navit_float rollc=navit_cos(M_PI*t->roll/180);
navit_float rolls=navit_sin(M_PI*t->roll/180);
@@ -107,7 +105,7 @@ transform_setup_matrix(struct transformation *t)
int scale=t->scale;
int order_dir=-1;
- dbg(lvl_debug,"yaw=%d pitch=%d center=0x%x,0x%x w=%d h=%d\n", t->yaw, t->pitch, t->map_center.x, t->map_center.y, t->w, t->h);
+ dbg(lvl_debug,"yaw=%d pitch=%d center=0x%x,0x%x\n", t->yaw, t->pitch, t->map_center.x, t->map_center.y);
t->znear=1 << POST_SHIFT;
t->zfar=300*t->znear;
t->scale_shift=0;
@@ -183,8 +181,6 @@ transform_new(struct pcoord *center, int scale, int yaw)
this_->map_center.x=center->x;
this_->map_center.y=center->y;
this_->scale=scale/16.0;
- this_->w=DEFRESX;
- this_->h=DEFRESY;
transform_set_yaw(this_, yaw);
return this_;
}