Mercurial > sdl-ios-xcode
view src/main/android/SDL_android_main.cpp @ 5043:da347bfed240
Florian Forster to sdl
in SDL 1.3 (revision 5508 from SVN), the method used to calculate the
bits per pixel from a “int format” differ between “SDL_ListModes” (which
always uses the “SDL_BITSPERPIXEL” macro) and “SDL_PixelFormatEnumTo-
Masks” (which uses either “SDL_BITSPERPIXEL” or “SDL_BYTESPERPIXEL * 8”,
depending on the value of “SDL_BYTESPERPIXEL”).
Because the values are later compared in “SDL_ListModes” this may lead
to some valid video modes not being returned. In my case the only mode
returned by “SDL_GetNumDisplayModes” was dismissed and NULL was
returned. (This led to the calling application sticking its head in the
sand.)
The attached patch copies the method used within “SDL_PixelFormatEnumTo-
Masks” to “SDL_ListModes”. This solved the problem for me though I don't
fully understand the method used by “SDL_PixelFormatEnumToMasks”.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 19 Jan 2011 16:06:47 -0800 |
parents | 55fccf89b340 |
children |
line wrap: on
line source
/* Include the SDL main definition header */ #include "SDL_main.h" /******************************************************************************* Functions called by JNI *******************************************************************************/ #include <jni.h> // Called before SDL_main() to initialize JNI bindings in SDL library extern "C" void SDL_Android_Init(JNIEnv* env, jclass cls); // Library init extern "C" jint JNI_OnLoad(JavaVM* vm, void* reserved) { return JNI_VERSION_1_4; } // Start up the SDL app extern "C" void Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj) { /* This interface could expand with ABI negotiation, calbacks, etc. */ SDL_Android_Init(env, cls); /* Run the application code! */ int status; char *argv[2]; argv[0] = strdup("SDL_app"); argv[1] = NULL; status = SDL_main(1, argv); /* We exit here for consistency with other platforms. */ exit(status); } /* vi: set ts=4 sw=4 expandtab: */