src/video/android/SDL_androidgl.c
author Gabriel Jacobo <gabomdq@gmail.com>
Thu, 29 Aug 2013 14:03:44 -0300
changeset 7722 ea5565d856a8
parent 7659 ac4ce59c40e7
child 8021 f96e12e0ade9
permissions -rw-r--r--
Fixes bug #2074 - Thanks Sylvain!

SDL_syssem.c:159 comparison of unsigned expression >= 0 is always true
Solved by comparing unsigneds directly

SDL_systimer.c:164: warning: control may reach end of Compile
Solved by returning the default value if all else fails.

SDL_androidgl.c:41:1: warning: type specifier missing, defaults to 'int'
SDL_androidgl.c:47:1: warning: control reaches end of non-void function
Solved by adding void return type to the function implementation
paul@4701
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6885
     3
  Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
paul@4701
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
paul@4701
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
paul@4701
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
paul@4701
    20
*/
paul@4701
    21
#include "SDL_config.h"
paul@4701
    22
slouken@6044
    23
#if SDL_VIDEO_DRIVER_ANDROID
slouken@6044
    24
slouken@4980
    25
/* Android SDL video driver implementation */
paul@4701
    26
paul@4701
    27
#include "SDL_video.h"
gabomdq@7659
    28
#include "../SDL_egl.h"
gabomdq@7659
    29
#include "SDL_androidwindow.h"
paul@4701
    30
paul@4701
    31
#include "SDL_androidvideo.h"
slouken@5090
    32
#include "../../core/android/SDL_android.h"
paul@4701
    33
paul@4707
    34
#include <android/log.h>
paul@4701
    35
icculus@5992
    36
#include <dlfcn.h>
icculus@5992
    37
gabomdq@7659
    38
SDL_EGL_CreateContext_impl(Android)
gabomdq@7659
    39
SDL_EGL_MakeCurrent_impl(Android)
paul@4701
    40
gabomdq@7722
    41
void
gabomdq@7659
    42
Android_GLES_SwapWindow(_THIS, SDL_Window * window)
slouken@4989
    43
{
gabomdq@7659
    44
    /* FIXME: These two functions were in the Java code, do we really need them? */
gabomdq@7659
    45
    _this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE);
gabomdq@7659
    46
    _this->egl_data->eglWaitGL();
gabomdq@7659
    47
    SDL_EGL_SwapBuffers(_this, ((SDL_WindowData *) window->driverdata)->egl_surface);
paul@4701
    48
}
paul@4701
    49
slouken@4989
    50
int
gabomdq@7659
    51
Android_GLES_LoadLibrary(_THIS, const char *path) {
gabomdq@7659
    52
    return SDL_EGL_LoadLibrary(_this, path, (NativeDisplayType) 0);
paul@4701
    53
}
slouken@5222
    54
slouken@6044
    55
#endif /* SDL_VIDEO_DRIVER_ANDROID */
slouken@6044
    56
slouken@5222
    57
/* vi: set ts=4 sw=4 expandtab: */