summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBignaux Ronan <ronan@aimao.org>2018-10-25 21:24:39 +0200
committerPierre GRANDIN <pgrandin@users.noreply.github.com>2018-10-25 12:24:39 -0700
commitbf35b9fbd5a35706ca89627d8b313d1dc77b862e (patch)
tree354224977784e0e3bf9fa4c02a0747f0e2de92ef
parent7901afc052c3e182993f580090a8974e894b5c1c (diff)
downloadnavit-bf35b9fbd5a35706ca89627d8b313d1dc77b862e.tar.gz
Fix:SDL:fix headers according to SDL convention. (#704)
-rwxr-xr-xCMakeLists.txt10
-rw-r--r--navit/graphics/egl/graphics_egl.c27
-rw-r--r--navit/graphics/sdl/event_sdl.c2
-rw-r--r--navit/graphics/sdl/event_sdl.h2
-rw-r--r--navit/graphics/sdl/graphics_sdl.c22
-rw-r--r--navit/graphics/sdl/raster.h3
-rw-r--r--navit/vehicle/webos/bluetooth.c3
-rw-r--r--navit/vehicle/webos/vehicle_webos.c3
8 files changed, 42 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f7fee7cfa..d7fd1bcd8 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -150,12 +150,13 @@ find_package(Glib)
find_package(Gmodule)
find_package(ZLIB)
find_package(Freetype)
-find_library(SDL2MAIN SDL2)
-find_library(SDL2IMAGE SDL2_image)
-find_library(GLES2 GLESv2)
+#find_library(SDL2MAIN SDL2)
+#find_library(SDL2IMAGE SDL2_image)
find_package(SDL)
-find_package(SDL_ttf)
+#find_package(SDL_ttf)
find_package(SDL_image)
+
+find_library(GLES2 GLESv2)
find_package(OpenGL)
find_package(GLUT)
find_package(GTK2 2.6 COMPONENTS gtk)
@@ -405,6 +406,7 @@ else()
endif(FREETYPE_FOUND)
if(SDL_FOUND AND SDLIMAGE_FOUND AND FREETYPE_FOUND)
+ include_directories( ${SDL_INCLUDE_DIRS} ${SDL_IMAGE_INCLUDE_DIRS})
set(SDL_IMAGE 1)
if(SDLTTF_FOUND)
set(SDL_TTF 1)
diff --git a/navit/graphics/egl/graphics_egl.c b/navit/graphics/egl/graphics_egl.c
index f9c33c775..2da56047c 100644
--- a/navit/graphics/egl/graphics_egl.c
+++ b/navit/graphics/egl/graphics_egl.c
@@ -38,7 +38,7 @@
#include "window.h"
#include "navit/font/freetype/font_freetype.h"
-#include <SDL2/SDL_image.h>
+#include "SDL_image.h"
#include <GLES2/gl2.h>
#include <EGL/egl.h>
@@ -88,7 +88,8 @@ struct graphics_priv {
struct graphics_gc_priv *background_gc;
enum draw_mode_num mode;
GLuint program;
- GLint mvp_location, position_location, color_location, texture_position_location, use_texture_location, texture_location;
+ GLint mvp_location, position_location, color_location, texture_position_location, use_texture_location,
+ texture_location;
struct callback_list *cbl;
struct font_freetype_methods freetype_methods;
struct navit *nav;
@@ -430,7 +431,8 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics
static struct graphics_image_priv image_error;
-static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, 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 *name,
+ int *w, int *h, struct point *hot, int rotation) {
struct graphics_image_priv *gi;
/* FIXME: meth is not used yet.. so gi leaks. at least xpm is small */
@@ -640,7 +642,8 @@ static void draw_rectangle(struct graphics_priv *gr, struct graphics_gc_priv *gc
graphics_priv_root->dirty = 1;
}
-static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, int color, struct point *p) {
+static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg,
+ struct graphics_gc_priv *bg, int color, struct point *p) {
int i, x, y, stride;
struct font_freetype_glyph *g, **gp;
unsigned char *shadow, *glyph;
@@ -745,7 +748,8 @@ static void display_text_draw(struct font_freetype_text *text, struct graphics_p
}
}
-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) {
if ((gr->parent && !gr->parent->overlay_enabled)
|| (gr->parent && gr->parent->overlay_enabled
&& !gr->overlay_enabled)) {
@@ -772,7 +776,8 @@ static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, str
}
-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) {
draw_image_es(gr, p, img->img->w, img->img->h, img->img->pixels);
}
@@ -908,7 +913,8 @@ static void *get_data(struct graphics_priv *this, const char *type) {
glClearColor ( 0, 0, 0, 1);
glClear ( GL_COLOR_BUFFER_BIT );
- callback_list_call_attr_2(graphics_priv_root->cbl, attr_resize, GINT_TO_POINTER(this->width), GINT_TO_POINTER(this->height));
+ callback_list_call_attr_2(graphics_priv_root->cbl, attr_resize, GINT_TO_POINTER(this->width),
+ GINT_TO_POINTER(this->height));
this->program = glCreateProgram();
vertexShader = load_shader(vertex_src, GL_VERTEX_SHADER);
@@ -1073,7 +1079,8 @@ static void create_framebuffer_texture(struct graphics_priv *gr) {
}
}
-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) {
struct graphics_priv *this = graphics_opengl_new_helper(meth);
this->p.x = p->x;
@@ -1228,7 +1235,8 @@ static gboolean graphics_sdl_idle(void *data) {
}
-static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) {
+static struct graphics_priv *graphics_opengl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs,
+ struct callback_list *cbl) {
struct attr *attr;
if (!event_request_system("glib", "graphics_opengl_new"))
return NULL;
@@ -1319,4 +1327,3 @@ error:
void plugin_init(void) {
plugin_register_category_graphics("egl", graphics_opengl_new);
}
-
diff --git a/navit/graphics/sdl/event_sdl.c b/navit/graphics/sdl/event_sdl.c
index 5e258c643..454e9eb06 100644
--- a/navit/graphics/sdl/event_sdl.c
+++ b/navit/graphics/sdl/event_sdl.c
@@ -19,7 +19,7 @@
#include <glib.h>
#include <poll.h>
-#include <SDL/SDL.h>
+#include "SDL.h"
#include <pthread.h>
#include <signal.h>
#include "config.h"
diff --git a/navit/graphics/sdl/event_sdl.h b/navit/graphics/sdl/event_sdl.h
index 7dceedec5..ee47f60d9 100644
--- a/navit/graphics/sdl/event_sdl.h
+++ b/navit/graphics/sdl/event_sdl.h
@@ -2,7 +2,7 @@
#ifndef __EVENT_SDL_H
#define __EVENT_SDL_H
-#include <SDL/SDL.h>
+#include "SDL.h"
#include "config.h"
#include "callback.h"
#include "event.h"
diff --git a/navit/graphics/sdl/graphics_sdl.c b/navit/graphics/sdl/graphics_sdl.c
index d9d31df8e..efd0faad5 100644
--- a/navit/graphics/sdl/graphics_sdl.c
+++ b/navit/graphics/sdl/graphics_sdl.c
@@ -34,7 +34,7 @@
#include "callback.h"
#include "font/freetype/font_freetype.h"
-#include <SDL/SDL.h>
+#include "SDL.h"
#include <math.h>
#ifdef USE_WEBOS
@@ -56,7 +56,7 @@
#include "raster.h"
#include <event.h>
-#include <SDL/SDL_image.h>
+#include "SDL_image.h"
#include <alloca.h>
/* TODO: union overlay + non-overlay to reduce size */
@@ -252,7 +252,8 @@ static struct graphics_gc_priv *gc_new(struct graphics_priv *gr, struct graphics
}
-static struct graphics_image_priv *image_new(struct graphics_priv *gr, struct graphics_image_methods *meth, char *name, 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 *name,
+ int *w, int *h, struct point *hot, int rotation) {
struct graphics_image_priv *gi;
/* FIXME: meth is not used yet.. so gi leaks. at least xpm is small */
@@ -526,7 +527,8 @@ static void resize_ft_buffer (unsigned int new_size) {
}
}
-static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg, struct graphics_gc_priv *bg, int color, struct point *p) {
+static void display_text_draw(struct font_freetype_text *text, struct graphics_priv *gr, struct graphics_gc_priv *fg,
+ struct graphics_gc_priv *bg, int color, struct point *p) {
int i, x, y, stride;
struct font_freetype_glyph *g, **gp;
struct color transparent = { 0x0000, 0x0000, 0x0000, 0x0000 };
@@ -661,7 +663,8 @@ static void display_text_draw(struct font_freetype_text *text, struct graphics_p
}
}
-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) {
if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable)
|| (gr->overlay_parent && gr->overlay_parent->overlay_enable
&& !gr->overlay_enable)) {
@@ -685,7 +688,8 @@ static void draw_text(struct graphics_priv *gr, struct graphics_gc_priv *fg, str
gr->freetype_methods.text_destroy(t);
}
-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) {
if ((gr->overlay_parent && !gr->overlay_parent->overlay_enable) || (gr->overlay_parent
&& gr->overlay_parent->overlay_enable && !gr->overlay_enable) ) {
return;
@@ -817,7 +821,8 @@ 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) {
struct graphics_priv *ov;
Uint32 rmask, gmask, bmask, amask;
int i;
@@ -1275,7 +1280,8 @@ static gboolean graphics_sdl_idle(void *data) {
}
-static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs, struct callback_list *cbl) {
+static struct graphics_priv *graphics_sdl_new(struct navit *nav, struct graphics_methods *meth, struct attr **attrs,
+ struct callback_list *cbl) {
struct graphics_priv *this=g_new0(struct graphics_priv, 1);
struct font_priv *(*font_freetype_new) (void *meth);
struct attr *attr;
diff --git a/navit/graphics/sdl/raster.h b/navit/graphics/sdl/raster.h
index 8f50b2715..2e68ea05f 100644
--- a/navit/graphics/sdl/raster.h
+++ b/navit/graphics/sdl/raster.h
@@ -9,7 +9,7 @@
#define __RASTER_H
#include <stdint.h>
-#include <SDL/SDL.h>
+#include "SDL.h"
void raster_rect(SDL_Surface *s, int16_t x, int16_t y, int16_t w, int16_t h, uint32_t col);
@@ -22,4 +22,3 @@ void raster_aacircle(SDL_Surface *s, int16_t x, int16_t y, int16_t r, uint32_t c
void raster_aapolygon(SDL_Surface *s, int16_t n, int16_t *vx, int16_t *vy, uint32_t col);
#endif /* __RASTER_H */
-
diff --git a/navit/vehicle/webos/bluetooth.c b/navit/vehicle/webos/bluetooth.c
index 9bb94364c..d51ec450b 100644
--- a/navit/vehicle/webos/bluetooth.c
+++ b/navit/vehicle/webos/bluetooth.c
@@ -8,7 +8,7 @@
#include <errno.h>
#include <sys/time.h>
#include <PDL.h>
-#include <SDL.h>
+#include "SDL.h"
#include "debug.h"
#include "callback.h"
#include "event.h"
@@ -583,4 +583,3 @@ void vehicle_webos_bt_close(struct vehicle_priv *priv) {
// g_free(priv->nmea_data_buf);
// priv->nmea_data_buf = NULL;
}
-
diff --git a/navit/vehicle/webos/vehicle_webos.c b/navit/vehicle/webos/vehicle_webos.c
index 04dc90ae2..c81b6342b 100644
--- a/navit/vehicle/webos/vehicle_webos.c
+++ b/navit/vehicle/webos/vehicle_webos.c
@@ -26,7 +26,7 @@
#include <errno.h>
#include <sys/time.h>
#include <PDL.h>
-#include <SDL.h>
+#include "SDL.h"
#include "debug.h"
#include "callback.h"
#include "plugin.h"
@@ -366,4 +366,3 @@ void plugin_init(void) {
dbg(lvl_debug, "enter");
plugin_register_category_vehicle("webos", vehicle_webos_new);
}
-