gipy: jit is back

pull/2994/head
frederic wagner 2023-08-21 15:09:34 +02:00
parent 88a4f98ce8
commit 6b51925109
4 changed files with 34 additions and 17 deletions

View File

@ -98,3 +98,6 @@
* New setting : power screen off between points to save battery
* Color change for lost direction (now purple)
* Adaptive screen powersaving
0.21:
* Jit is back for display functions (10% speed increase)

View File

@ -36,10 +36,20 @@ my conclusion is that:
**************************
JIT: array declaration in jit is buggy
(especially several declarations)
**************************
+ there is still a bug with negative remaining distances (when lost and nearest point is endpoint ?)
+ when lost we still get powersaving
+ try disabling gps for more powersaving
+ add heights
+ when you walk the direction still has a tendency to shift
+ put back foot only ways
+ try fiddling with jit
+ put back street names
+ put back shortest paths but with points cache this time and jit
+ how to display paths from shortest path ?

View File

@ -139,6 +139,19 @@ class TilesOffsets {
}
}
// this function is not inlined to avoid array declaration in jit
function center_points(points, scaled_current_x, scaled_current_y) {
return g.transformVertices(points, [1, 0, 0, 1, -scaled_current_x, -scaled_current_y]);
}
// this function is not inlined to avoid array declaration in jit
function rotate_points(points, c, s) {
let center_x = g.getWidth() / 2;
let center_y = g.getHeight() / 2 + Y_OFFSET;
return g.transformVertices(points, [-c, s, s, c, center_x, center_y]);
}
class Map {
constructor(buffer, offset, filename) {
this.points_cache = []; // don't refetch points all the time
@ -393,17 +406,12 @@ class Map {
cos_direction,
sin_direction
) {
// "jit";
let center_x = g.getWidth() / 2;
let center_y = g.getHeight() / 2 + Y_OFFSET;
"jit";
let points = this.fetch_points(tile_x, tile_y, this.side * scale_factor);
let scaled_current_x = current_x * scale_factor;
let scaled_current_y = current_y * scale_factor;
let recentered_points = g.transformVertices(points, [1, 0, 0, 1, -scaled_current_x, -scaled_current_y]);
let c = cos_direction;
let s = sin_direction;
let screen_points = g.transformVertices(recentered_points, [-c, s, s, c, center_x, center_y]);
let recentered_points = center_points(points, scaled_current_x, scaled_current_y);
let screen_points = rotate_points(recentered_points, cos_direction, sin_direction);
for (let i = 0; i < screen_points.length; i += 4) {
g.drawLine(screen_points[i], screen_points[i + 1], screen_points[i + 2], screen_points[i + 3]);
@ -419,17 +427,13 @@ class Map {
cos_direction,
sin_direction
) {
// "jit";
let center_x = g.getWidth() / 2;
let center_y = g.getHeight() / 2 + Y_OFFSET;
"jit";
let points = this.fetch_points(tile_x, tile_y, this.side * scale_factor);
let scaled_current_x = current_x * scale_factor;
let scaled_current_y = current_y * scale_factor;
let recentered_points = g.transformVertices(points, [1, 0, 0, 1, -scaled_current_x, -scaled_current_y]);
let c = cos_direction;
let s = sin_direction;
let screen_points = g.transformVertices(recentered_points, [-c, s, s, c, center_x, center_y]);
let recentered_points = center_points(points, scaled_current_x, scaled_current_y);
let screen_points = rotate_points(recentered_points, cos_direction, sin_direction);
for (let i = 0; i < screen_points.length; i += 4) {
let final_x = screen_points[i];

View File

@ -2,7 +2,7 @@
"id": "gipy",
"name": "Gipy",
"shortName": "Gipy",
"version": "0.20",
"version": "0.21",
"description": "Follow gpx files using the gps. Don't get lost in your bike trips and hikes.",
"allow_emulator":false,
"icon": "gipy.png",