mirror of
https://github.com/Relintai/sdl2_frt.git
synced 2024-12-20 22:16:49 +01:00
Fixes for -Wdeclaration-after-statement
This commit is contained in:
parent
1e49b1ed6e
commit
2490166d2d
@ -864,6 +864,8 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
|
||||
GLfloat minx, miny, maxx, maxy;
|
||||
GLfloat minu, maxu, minv, maxv;
|
||||
GLfloat vertices[8];
|
||||
GLfloat texCoords[8];
|
||||
|
||||
GLES_ActivateRenderer(renderer);
|
||||
|
||||
@ -924,9 +926,6 @@ GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
|
||||
maxv *= texturedata->texh;
|
||||
|
||||
GLfloat vertices[8];
|
||||
GLfloat texCoords[8];
|
||||
|
||||
vertices[0] = minx;
|
||||
vertices[1] = miny;
|
||||
vertices[2] = maxx;
|
||||
@ -965,6 +964,9 @@ GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
GLfloat minx, miny, maxx, maxy;
|
||||
GLfloat minu, maxu, minv, maxv;
|
||||
GLfloat centerx, centery;
|
||||
GLfloat vertices[8];
|
||||
GLfloat texCoords[8];
|
||||
|
||||
|
||||
GLES_ActivateRenderer(renderer);
|
||||
|
||||
@ -1015,9 +1017,6 @@ GLES_RenderCopyEx(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
maxv = (GLfloat) (srcrect->y + srcrect->h) / texture->h;
|
||||
maxv *= texturedata->texh;
|
||||
|
||||
GLfloat vertices[8];
|
||||
GLfloat texCoords[8];
|
||||
|
||||
vertices[0] = minx;
|
||||
vertices[1] = miny;
|
||||
vertices[2] = maxx;
|
||||
|
@ -86,11 +86,11 @@ SDL_InitTicks(void)
|
||||
Uint32
|
||||
SDL_GetTicks(void)
|
||||
{
|
||||
Uint32 ticks;
|
||||
if (!ticks_started) {
|
||||
SDL_InitTicks();
|
||||
}
|
||||
|
||||
Uint32 ticks;
|
||||
if (has_monotonic_time) {
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
struct timespec now;
|
||||
@ -115,11 +115,11 @@ SDL_GetTicks(void)
|
||||
Uint64
|
||||
SDL_GetPerformanceCounter(void)
|
||||
{
|
||||
Uint64 ticks;
|
||||
if (!ticks_started) {
|
||||
SDL_InitTicks();
|
||||
}
|
||||
|
||||
Uint64 ticks;
|
||||
if (has_monotonic_time) {
|
||||
#if HAVE_CLOCK_GETTIME
|
||||
struct timespec now;
|
||||
|
@ -305,12 +305,12 @@ SDL_EGL_CreateContext(_THIS, EGLSurface egl_surface)
|
||||
int
|
||||
SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
|
||||
{
|
||||
EGLContext egl_context = (EGLContext) context;
|
||||
|
||||
if (!_this->egl_data) {
|
||||
return SDL_SetError("OpenGL not initialized");
|
||||
}
|
||||
|
||||
EGLContext egl_context = (EGLContext) context;
|
||||
|
||||
/* The android emulator crashes badly if you try to eglMakeCurrent
|
||||
* with a valid context and invalid surface, so we have to check for both here.
|
||||
*/
|
||||
@ -330,11 +330,12 @@ SDL_EGL_MakeCurrent(_THIS, EGLSurface egl_surface, SDL_GLContext context)
|
||||
int
|
||||
SDL_EGL_SetSwapInterval(_THIS, int interval)
|
||||
{
|
||||
EGLBoolean status;
|
||||
|
||||
if (_this->egl_data) {
|
||||
return SDL_SetError("OpenGL ES context not active");
|
||||
}
|
||||
|
||||
EGLBoolean status;
|
||||
status = _this->egl_data->eglSwapInterval(_this->egl_data->egl_display, interval);
|
||||
if (status == EGL_TRUE) {
|
||||
_this->egl_data->egl_swapinterval = interval;
|
||||
@ -363,13 +364,13 @@ SDL_EGL_SwapBuffers(_THIS, EGLSurface egl_surface)
|
||||
void
|
||||
SDL_EGL_DeleteContext(_THIS, SDL_GLContext context)
|
||||
{
|
||||
EGLContext egl_context = (EGLContext) context;
|
||||
|
||||
/* Clean up GLES and EGL */
|
||||
if (!_this->egl_data) {
|
||||
return;
|
||||
}
|
||||
|
||||
EGLContext egl_context = (EGLContext) context;
|
||||
|
||||
if (!egl_context && egl_context != EGL_NO_CONTEXT) {
|
||||
SDL_EGL_MakeCurrent(_this, NULL, NULL);
|
||||
_this->egl_data->eglDestroyContext(_this->egl_data->egl_display, egl_context);
|
||||
|
@ -36,12 +36,13 @@
|
||||
c128.m128_u32[3] = color;
|
||||
#else
|
||||
#define SSE_BEGIN \
|
||||
__m128 c128; \
|
||||
DECLARE_ALIGNED(Uint32, cccc[4], 16); \
|
||||
cccc[0] = color; \
|
||||
cccc[1] = color; \
|
||||
cccc[2] = color; \
|
||||
cccc[3] = color; \
|
||||
__m128 c128 = *(__m128 *)cccc;
|
||||
c128 = *(__m128 *)cccc;
|
||||
#endif
|
||||
|
||||
#define SSE_WORK \
|
||||
@ -59,11 +60,14 @@
|
||||
static void \
|
||||
SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
|
||||
{ \
|
||||
int i, n; \
|
||||
Uint8 *p = NULL; \
|
||||
\
|
||||
SSE_BEGIN; \
|
||||
\
|
||||
while (h--) { \
|
||||
int i, n = w * bpp; \
|
||||
Uint8 *p = pixels; \
|
||||
n = w * bpp; \
|
||||
p = pixels; \
|
||||
\
|
||||
if (n > 63) { \
|
||||
int adjust = 16 - ((uintptr_t)p & 15); \
|
||||
@ -94,11 +98,13 @@ SDL_FillRect##bpp##SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
|
||||
static void
|
||||
SDL_FillRect1SSE(Uint8 *pixels, int pitch, Uint32 color, int w, int h)
|
||||
{
|
||||
int i, n;
|
||||
Uint8 *p = NULL;
|
||||
|
||||
SSE_BEGIN;
|
||||
|
||||
while (h--) {
|
||||
int i, n = w;
|
||||
Uint8 *p = pixels;
|
||||
n = w;
|
||||
p = pixels;
|
||||
|
||||
if (n > 63) {
|
||||
int adjust = 16 - ((uintptr_t)p & 15);
|
||||
@ -152,11 +158,14 @@ DEFINE_SSE_FILLRECT(4, Uint32)
|
||||
static void \
|
||||
SDL_FillRect##bpp##MMX(Uint8 *pixels, int pitch, Uint32 color, int w, int h) \
|
||||
{ \
|
||||
int i, n; \
|
||||
Uint8 *p = NULL; \
|
||||
\
|
||||
MMX_BEGIN; \
|
||||
\
|
||||
while (h--) { \
|
||||
int i, n = w * bpp; \
|
||||
Uint8 *p = pixels; \
|
||||
n = w * bpp; \
|
||||
p = pixels; \
|
||||
\
|
||||
if (n > 63) { \
|
||||
int adjust = 8 - ((uintptr_t)p & 7); \
|
||||
|
@ -173,11 +173,12 @@ static SDL_bool X11_IsWheelEvent(Display * display,XEvent * event,int * ticks)
|
||||
*/
|
||||
static char* X11_URIToLocal(char* uri) {
|
||||
char *file = NULL;
|
||||
SDL_bool local;
|
||||
|
||||
if (memcmp(uri,"file:/",6) == 0) uri += 6; /* local file? */
|
||||
else if (strstr(uri,":/") != NULL) return file; /* wrong scheme */
|
||||
|
||||
SDL_bool local = uri[0] != '/' || ( uri[0] != '\0' && uri[1] == '/' );
|
||||
local = uri[0] != '/' || ( uri[0] != '\0' && uri[1] == '/' );
|
||||
|
||||
/* got a hostname? */
|
||||
if ( !local && uri[0] == '/' && uri[2] != '/' ) {
|
||||
@ -267,6 +268,7 @@ X11_DispatchEvent(_THIS)
|
||||
SDL_WindowData *data;
|
||||
XEvent xevent;
|
||||
int i;
|
||||
XClientMessageEvent m;
|
||||
|
||||
SDL_zero(xevent); /* valgrind fix. --ryan. */
|
||||
XNextEvent(display, &xevent);
|
||||
@ -549,7 +551,6 @@ X11_DispatchEvent(_THIS)
|
||||
else if (xevent.xclient.message_type == videodata->XdndPosition) {
|
||||
|
||||
/* reply with status */
|
||||
XClientMessageEvent m;
|
||||
memset(&m, 0, sizeof(XClientMessageEvent));
|
||||
m.type = ClientMessage;
|
||||
m.display = xevent.xclient.display;
|
||||
@ -568,7 +569,6 @@ X11_DispatchEvent(_THIS)
|
||||
else if(xevent.xclient.message_type == videodata->XdndDrop) {
|
||||
if (data->xdnd_req == None) {
|
||||
/* say again - not interested! */
|
||||
XClientMessageEvent m;
|
||||
memset(&m, 0, sizeof(XClientMessageEvent));
|
||||
m.type = ClientMessage;
|
||||
m.display = xevent.xclient.display;
|
||||
@ -841,7 +841,6 @@ X11_DispatchEvent(_THIS)
|
||||
XFree(p.data);
|
||||
|
||||
/* send reply */
|
||||
XClientMessageEvent m;
|
||||
SDL_memset(&m, 0, sizeof(XClientMessageEvent));
|
||||
m.type = ClientMessage;
|
||||
m.display = display;
|
||||
|
@ -564,6 +564,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
|
||||
XVisualInfo v, *vinfo;
|
||||
int n;
|
||||
GLXContext context = NULL, share_context;
|
||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs = NULL;
|
||||
|
||||
if (_this->gl_config.share_with_current_context) {
|
||||
share_context = (GLXContext)SDL_GL_GetCurrentContext();
|
||||
@ -617,7 +618,7 @@ X11_GL_CreateContext(_THIS, SDL_Window * window)
|
||||
attribs[iattr++] = 0;
|
||||
|
||||
/* Get a pointer to the context creation function for GL 3.0 */
|
||||
PFNGLXCREATECONTEXTATTRIBSARBPROC glXCreateContextAttribs =
|
||||
glXCreateContextAttribs =
|
||||
(PFNGLXCREATECONTEXTATTRIBSARBPROC) _this->gl_data->
|
||||
glXGetProcAddress((GLubyte *)
|
||||
"glXCreateContextAttribsARB");
|
||||
|
@ -36,6 +36,8 @@ X11_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsigned
|
||||
SDL_WindowShaper*
|
||||
X11_CreateShaper(SDL_Window* window) {
|
||||
SDL_WindowShaper* result = NULL;
|
||||
SDL_ShapeData* data = NULL;
|
||||
int resized_properly;
|
||||
|
||||
#if SDL_VIDEO_DRIVER_X11_XSHAPE
|
||||
if (SDL_X11_HAVE_XSHAPE) { /* Make sure X server supports it. */
|
||||
@ -44,12 +46,12 @@ X11_CreateShaper(SDL_Window* window) {
|
||||
result->mode.mode = ShapeModeDefault;
|
||||
result->mode.parameters.binarizationCutoff = 1;
|
||||
result->userx = result->usery = 0;
|
||||
SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData));
|
||||
data = SDL_malloc(sizeof(SDL_ShapeData));
|
||||
result->driverdata = data;
|
||||
data->bitmapsize = 0;
|
||||
data->bitmap = NULL;
|
||||
window->shaper = result;
|
||||
int resized_properly = X11_ResizeWindowShape(window);
|
||||
resized_properly = X11_ResizeWindowShape(window);
|
||||
SDL_assert(resized_properly == 0);
|
||||
}
|
||||
#endif
|
||||
@ -60,9 +62,9 @@ X11_CreateShaper(SDL_Window* window) {
|
||||
int
|
||||
X11_ResizeWindowShape(SDL_Window* window) {
|
||||
SDL_ShapeData* data = window->shaper->driverdata;
|
||||
unsigned int bitmapsize = window->w / 8;
|
||||
SDL_assert(data != NULL);
|
||||
|
||||
unsigned int bitmapsize = window->w / 8;
|
||||
if(window->w % 8 > 0)
|
||||
bitmapsize += 1;
|
||||
bitmapsize *= window->h;
|
||||
@ -86,6 +88,10 @@ X11_ResizeWindowShape(SDL_Window* window) {
|
||||
|
||||
int
|
||||
X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMode *shape_mode) {
|
||||
SDL_ShapeData *data = NULL;
|
||||
SDL_WindowData *windowdata = NULL;
|
||||
Pixmap shapemask = NULL;
|
||||
|
||||
if(shaper == NULL || shape == NULL || shaper->driverdata == NULL)
|
||||
return -1;
|
||||
|
||||
@ -94,13 +100,13 @@ X11_SetWindowShape(SDL_WindowShaper *shaper,SDL_Surface *shape,SDL_WindowShapeMo
|
||||
return -2;
|
||||
if(shape->w != shaper->window->w || shape->h != shaper->window->h)
|
||||
return -3;
|
||||
SDL_ShapeData *data = shaper->driverdata;
|
||||
data = shaper->driverdata;
|
||||
|
||||
/* Assume that shaper->alphacutoff already has a value, because SDL_SetWindowShape() should have given it one. */
|
||||
SDL_CalculateShapeBitmap(shaper->mode,shape,data->bitmap,8);
|
||||
|
||||
SDL_WindowData *windowdata = (SDL_WindowData*)(shaper->window->driverdata);
|
||||
Pixmap shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
|
||||
windowdata = (SDL_WindowData*)(shaper->window->driverdata);
|
||||
shapemask = XCreateBitmapFromData(windowdata->videodata->display,windowdata->xwindow,data->bitmap,shaper->window->w,shaper->window->h);
|
||||
|
||||
XShapeCombineMask(windowdata->videodata->display,windowdata->xwindow, ShapeBounding, 0, 0,shapemask, ShapeSet);
|
||||
XSync(windowdata->videodata->display,False);
|
||||
|
@ -259,10 +259,11 @@ static int (*orig_x11_errhandler) (Display *, XErrorEvent *) = NULL;
|
||||
static int
|
||||
X11_SafetyNetErrHandler(Display * d, XErrorEvent * e)
|
||||
{
|
||||
SDL_VideoDevice *device = NULL;
|
||||
/* if we trigger an error in our error handler, don't try again. */
|
||||
if (!safety_net_triggered) {
|
||||
safety_net_triggered = SDL_TRUE;
|
||||
SDL_VideoDevice *device = SDL_GetVideoDevice();
|
||||
device = SDL_GetVideoDevice();
|
||||
if (device != NULL) {
|
||||
int i;
|
||||
for (i = 0; i < device->num_displays; i++) {
|
||||
|
@ -206,14 +206,17 @@ void
|
||||
X11_Xinput2SelectTouch(_THIS, SDL_Window *window)
|
||||
{
|
||||
#if SDL_VIDEO_DRIVER_X11_XINPUT2_SUPPORTS_MULTITOUCH
|
||||
SDL_VideoData *data = NULL;
|
||||
XIEventMask eventmask;
|
||||
unsigned char mask[3] = { 0,0,0 };
|
||||
SDL_WindowData *window_data = NULL;
|
||||
|
||||
if (!X11_Xinput2IsMultitouchSupported()) {
|
||||
return;
|
||||
}
|
||||
|
||||
SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
|
||||
XIEventMask eventmask;
|
||||
unsigned char mask[3] = { 0,0,0 };
|
||||
SDL_WindowData *window_data = (SDL_WindowData*)window->driverdata;
|
||||
data = (SDL_VideoData *) _this->driverdata;
|
||||
window_data = (SDL_WindowData*)window->driverdata;
|
||||
|
||||
eventmask.deviceid = XIAllMasterDevices;
|
||||
eventmask.mask_len = sizeof(mask);
|
||||
|
Loading…
Reference in New Issue
Block a user