diff options
| author | Wildemann Stefan <stefan.wildemann@corpuls.com> | 2019-07-17 10:39:30 +0200 |
|---|---|---|
| committer | Wildemann Stefan <stefan.wildemann@corpuls.com> | 2019-07-17 10:39:30 +0200 |
| commit | df965474d2c750d1516b6847d25f816ad6b73c3e (patch) | |
| tree | 4d29acb14ec928eba55317a4ef3330b8c00c3327 | |
| parent | 8e8f9c5efcafd683201515e625b0831c3f393575 (diff) | |
| download | navit-df965474d2c750d1516b6847d25f816ad6b73c3e.tar.gz | |
Convert to navit_float instead of double.
Navit uses it's own float type definition. Obey that as much as
possible.
| -rw-r--r-- | navit/font/freetype/font_freetype.c | 13 | ||||
| -rw-r--r-- | navit/graphics.c | 2 | ||||
| -rw-r--r-- | navit/graphics.h | 2 | ||||
| -rw-r--r-- | navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c | 5 | ||||
| -rw-r--r-- | navit/graphics/null/graphics_null.c | 25 | ||||
| -rw-r--r-- | navit/graphics/opengl/graphics_opengl.c | 1 | ||||
| -rw-r--r-- | navit/graphics/qt5/QNavitQuick.cpp | 1 | ||||
| -rw-r--r-- | navit/graphics/qt5/QNavitWidget.cpp | 1 | ||||
| -rw-r--r-- | navit/graphics/qt5/event_qt5.cpp | 1 | ||||
| -rw-r--r-- | navit/graphics/qt5/graphics_qt5.cpp | 5 | ||||
| -rw-r--r-- | navit/graphics/sdl/graphics_sdl.c | 1 | ||||
| -rw-r--r-- | navit/layout.h | 1 | ||||
| -rw-r--r-- | navit/osd.c | 6 | ||||
| -rw-r--r-- | navit/osd.h | 2 | ||||
| -rw-r--r-- | navit/route.c | 2 |
15 files changed, 47 insertions, 21 deletions
diff --git a/navit/font/freetype/font_freetype.c b/navit/font/freetype/font_freetype.c index bb3a88d21..8b1aa45a7 100644 --- a/navit/font/freetype/font_freetype.c +++ b/navit/font/freetype/font_freetype.c @@ -38,6 +38,7 @@ #endif #include FT_GLYPH_H #include "point.h" +#include "coord.h" #include "graphics.h" #include "debug.h" #include "plugin.h" @@ -86,7 +87,8 @@ static int library_init = 0; static int library_deinit = 0; -static void font_freetype_get_text_bbox(struct graphics_priv *gr, struct font_freetype_font *font, char *text, int dx, int dy, struct point *ret, int estimate) { +static void font_freetype_get_text_bbox(struct graphics_priv *gr, struct font_freetype_font *font, char *text, int dx, + int dy, struct point *ret, int estimate) { char *p = text; FT_BBox bbox; FT_UInt glyph_index; @@ -362,7 +364,8 @@ static FT_Error face_requester( FTC_FaceID face_id, FT_Library library, FT_Point #endif /** Implementation of font_freetype_methods.font_new */ -static struct font_freetype_font *font_freetype_font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *fontfamily, int size, int flags) { +static struct font_freetype_font *font_freetype_font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, + char *fontfamily, int size, int flags) { struct font_freetype_font *font = g_new(struct font_freetype_font, 1); int exact, found=0; @@ -503,7 +506,8 @@ static struct font_freetype_font *font_freetype_font_new(struct graphics_priv *g } /** Implementation of font_freetype_methods.get_shadow. */ -static int font_freetype_glyph_get_shadow(struct font_freetype_glyph *g, unsigned char *data, int stride, struct color *foreground, struct color *background) { +static int font_freetype_glyph_get_shadow(struct font_freetype_glyph *g, unsigned char *data, int stride, + struct color *foreground, struct color *background) { int x, y, w = g->w, h = g->h; unsigned int bg, fg; unsigned char *pm, *psp,*ps,*psn; @@ -555,7 +559,8 @@ static int font_freetype_glyph_get_shadow(struct font_freetype_glyph *g, unsigne } /** Implementation of font_freetype_methods.get_glyph. */ -static int font_freetype_glyph_get_glyph(struct font_freetype_glyph *g, unsigned char *data, int stride, struct color *fg, struct color *bg, struct color *transparent) { +static int font_freetype_glyph_get_glyph(struct font_freetype_glyph *g, unsigned char *data, int stride, + struct color *fg, struct color *bg, struct color *transparent) { int x, y, w = g->w, h = g->h; unsigned int tr; unsigned char v,vi,*pm, *ps; diff --git a/navit/graphics.c b/navit/graphics.c index 75cd08a06..7a3c2800d 100644 --- a/navit/graphics.c +++ b/navit/graphics.c @@ -35,6 +35,8 @@ #include "string.h" #include "draw_info.h" #include "point.h" +#include "coord.h" + #include "graphics.h" #include "projection.h" #include "item.h" diff --git a/navit/graphics.h b/navit/graphics.h index 7bbf796f3..9271fd6ef 100644 --- a/navit/graphics.h +++ b/navit/graphics.h @@ -158,7 +158,7 @@ struct graphics_methods { int (*set_attr)(struct graphics_priv *gr, struct attr *attr); int (*show_native_keyboard)(struct graphics_keyboard *kbd); void (*hide_native_keyboard)(struct graphics_keyboard *kbd); - double (*get_dpi)(struct graphics_priv * gr); + navit_float (*get_dpi)(struct graphics_priv * gr); }; diff --git a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c index 7df96f5c2..2cd7ccd32 100644 --- a/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c +++ b/navit/graphics/gtk_drawing_area/graphics_gtk_drawing_area.c @@ -40,6 +40,7 @@ #include "event.h" #include "debug.h" #include "point.h" +#include "coord.h" #include "graphics.h" #include "color.h" #include "item.h" @@ -980,13 +981,13 @@ static void *get_data(struct graphics_priv *this, char const *type) { * @param gr self handle * @return dpi value */ -static double get_dpi(struct graphics_priv * gr) { +static navit_float get_dpi(struct graphics_priv * gr) { gdouble dpi = 96; GdkScreen *screen = gtk_widget_get_screen(gr->widget); if(screen != NULL) { dpi = gdk_screen_get_resolution (screen); } - return (double) dpi; + return (navit_float) dpi; } diff --git a/navit/graphics/null/graphics_null.c b/navit/graphics/null/graphics_null.c index c3a21185b..e7020a0be 100644 --- a/navit/graphics/null/graphics_null.c +++ b/navit/graphics/null/graphics_null.c @@ -24,6 +24,7 @@ #endif #include "item.h" #include "point.h" +#include "coord.h" #include "graphics.h" #include "color.h" #include "plugin.h" @@ -65,7 +66,8 @@ static struct graphics_font_methods font_methods = { font_destroy }; -static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, int size, int flags) { +static struct graphics_font_priv *font_new(struct graphics_priv *gr, struct graphics_font_methods *meth, char *font, + int size, int flags) { *meth=font_methods; return &graphics_font_priv; } @@ -98,7 +100,8 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics return &graphics_gc_priv; } -static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, int *w, int *h, struct point *hot, int rotation) { +static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *path, + int *w, int *h, struct point *hot, int rotation) { return &graphics_image_priv; } @@ -115,10 +118,12 @@ static void draw_circle(struct graphics_priv *gr, struct graphics_gc_priv *gc, s } -static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { +static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, + struct graphics_font_priv *font, char *text, struct point *p, int dx, int dy) { } -static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, struct graphics_image_priv *img) { +static void draw_image(struct graphics_priv *gr, struct graphics_gc_priv *fg, struct point *p, + struct graphics_image_priv *img) { } static void draw_drag(struct graphics_priv *gr, struct point *p) { @@ -130,7 +135,8 @@ static void background_gc(struct graphics_priv *gr, struct graphics_gc_priv *gc) static void draw_mode(struct graphics_priv *gr, enum draw_mode_num mode) { } -static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound); +static struct graphics_priv * overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, + int w, int h, int wraparound); static void resize_callback(int w, int h) { callback_list_call_attr_2(callbacks, attr_resize, GINT_TO_POINTER(1), GINT_TO_POINTER(1)); @@ -159,7 +165,8 @@ static void *get_data(struct graphics_priv *this, char const *type) { static void image_free(struct graphics_priv *gr, struct graphics_image_priv *priv) { } -static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, struct point *ret, int estimate) { +static void get_text_bbox(struct graphics_priv *gr, struct graphics_font_priv *font, char *text, int dx, int dy, + struct point *ret, int estimate) { } static void overlay_disable(struct graphics_priv *gr, int disable) { @@ -193,13 +200,15 @@ static struct graphics_methods graphics_methods = { NULL, /* hide_native_keyboard */ }; -static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, int w, int h, int wraparound) { +static struct graphics_priv *overlay_new(struct graphics_priv *gr, struct graphics_methods *meth, struct point *p, + int w, int h, int wraparound) { *meth=graphics_methods; return &graphics_priv; } -static struct graphics_priv *graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) { +static struct graphics_priv *graphics_null_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, + struct callback_list *cbl) { struct attr *event_loop_system = NULL; *meth=graphics_methods; diff --git a/navit/graphics/opengl/graphics_opengl.c b/navit/graphics/opengl/graphics_opengl.c index e001f9d81..a90788380 100644 --- a/navit/graphics/opengl/graphics_opengl.c +++ b/navit/graphics/opengl/graphics_opengl.c @@ -31,6 +31,7 @@ #include "attr.h" #include "config.h" #include "point.h" +#include "coord.h" #include "graphics.h" #include "color.h" #include "plugin.h" diff --git a/navit/graphics/qt5/QNavitQuick.cpp b/navit/graphics/qt5/QNavitQuick.cpp index dcd0d2aa5..aa827049b 100644 --- a/navit/graphics/qt5/QNavitQuick.cpp +++ b/navit/graphics/qt5/QNavitQuick.cpp @@ -31,6 +31,7 @@ extern "C" { #include "event.h" #include "point.h" /* needs to be before graphics.h */ +#include "coord.h" #include "graphics.h" #include "keys.h" diff --git a/navit/graphics/qt5/QNavitWidget.cpp b/navit/graphics/qt5/QNavitWidget.cpp index 869d5f2ec..e5ef4f174 100644 --- a/navit/graphics/qt5/QNavitWidget.cpp +++ b/navit/graphics/qt5/QNavitWidget.cpp @@ -31,6 +31,7 @@ extern "C" { #include "event.h" #include "point.h" /* needs to be before graphics.h */ +#include "coord.h" #include "graphics.h" #include "keys.h" diff --git a/navit/graphics/qt5/event_qt5.cpp b/navit/graphics/qt5/event_qt5.cpp index 99361011c..81aebc88d 100644 --- a/navit/graphics/qt5/event_qt5.cpp +++ b/navit/graphics/qt5/event_qt5.cpp @@ -30,6 +30,7 @@ extern "C" { #include "navit/event.h" #include "navit/point.h" /* needs to be before graphics.h */ +#include "navit/coord.h" #include "navit/graphics.h" #include "navit/item.h" diff --git a/navit/graphics/qt5/graphics_qt5.cpp b/navit/graphics/qt5/graphics_qt5.cpp index 9b808dd67..343d28a95 100644 --- a/navit/graphics/qt5/graphics_qt5.cpp +++ b/navit/graphics/qt5/graphics_qt5.cpp @@ -31,6 +31,7 @@ extern "C" { #include "event.h" #include "point.h" /* needs to be before graphics.h */ +#include "coord.h" /* needs to be before graphics.h */ #include "graphics.h" #include "plugin.h" @@ -815,13 +816,13 @@ static void overlay_resize(struct graphics_priv* gr, struct point* p, int w, int * @param gr self handle * @return dpi value */ -double get_dpi(struct graphics_priv * gr) { +navit_float get_dpi(struct graphics_priv * gr) { qreal dpi = 96; QScreen* primary = navit_app->primaryScreen(); if (primary != NULL) { dpi = primary->logicalDotsPerInch(); } - return (double)dpi; + return (navit_float)dpi; } static struct graphics_methods graphics_methods = { diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c index 874fca7d4..d28cdbc1f 100644 --- a/navit/graphics/sdl/graphics_sdl.c +++ b/navit/graphics/sdl/graphics_sdl.c @@ -23,6 +23,7 @@ #include "config.h" #include "debug.h" #include "point.h" +#include "coord.h" #include "graphics.h" #include "color.h" #include "plugin.h" diff --git a/navit/layout.h b/navit/layout.h index 7e5ba137e..be7a2b527 100644 --- a/navit/layout.h +++ b/navit/layout.h @@ -23,6 +23,7 @@ #include "item.h" #include "color.h" #include "point.h" +#include "coord.h" #include "osd.h" #ifdef __cplusplus diff --git a/navit/osd.c b/navit/osd.c index 31c457189..7b1144cf6 100644 --- a/navit/osd.c +++ b/navit/osd.c @@ -25,6 +25,8 @@ #include "color.h" #include "point.h" #include "navit.h" +#include "coord.h" + #include "graphics.h" #include "command.h" #include "callback.h" @@ -501,7 +503,7 @@ static inline double osd_mm_to_in(double mm) { */ int osd_rel2real(struct graphics *gra, const struct osd_display_coordinate * attrval, int whole, int treat_neg_as_rel) { int result; - double dpi = 75; + navit_float dpi = 75; if(gra != NULL) { /* get screen dpi value */ @@ -512,7 +514,7 @@ int osd_rel2real(struct graphics *gra, const struct osd_display_coordinate * att } if (attrval->type == OSD_RELATIVE) - result = (((double)whole) * attrval->num)/ ((double)100); + result = (((navit_float)whole) * attrval->num)/ ((navit_float)100); else if (attrval->type == OSD_MILLIMETERS) { result = osd_mm_to_in(attrval->num) * dpi; } else if (attrval->type == OSD_INCHES) { diff --git a/navit/osd.h b/navit/osd.h index 24188113e..cb78d3a55 100644 --- a/navit/osd.h +++ b/navit/osd.h @@ -49,7 +49,7 @@ typedef enum { } osd_display_coordinate_type; struct osd_display_coordinate { - double num; + navit_float num; osd_display_coordinate_type type; }; diff --git a/navit/route.c b/navit/route.c index 3633abc6a..56974035d 100644 --- a/navit/route.c +++ b/navit/route.c @@ -89,9 +89,9 @@ #include "glib_slice.h" #include "config.h" #include "point.h" +#include "coord.h" #include "graphics.h" #include "profile.h" -#include "coord.h" #include "projection.h" #include "item.h" #include "xmlconfig.h" |
