early-access version 1667
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -48,6 +48,16 @@ static void openslES_ResumeDevices(void) {}
|
||||
static void openslES_PauseDevices(void) {}
|
||||
#endif
|
||||
|
||||
#if !SDL_AUDIO_DISABLED && SDL_AUDIO_DRIVER_AAUDIO
|
||||
extern void aaudio_ResumeDevices(void);
|
||||
extern void aaudio_PauseDevices(void);
|
||||
#else
|
||||
static void aaudio_ResumeDevices(void) {}
|
||||
static void aaudio_PauseDevices(void) {}
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
/* Number of 'type' events in the event queue */
|
||||
static int
|
||||
SDL_NumberOfEvents(Uint32 type)
|
||||
@@ -110,6 +120,7 @@ Android_PumpEvents_Blocking(_THIS)
|
||||
|
||||
ANDROIDAUDIO_PauseDevices();
|
||||
openslES_PauseDevices();
|
||||
aaudio_PauseDevices();
|
||||
|
||||
if (SDL_SemWait(Android_ResumeSem) == 0) {
|
||||
|
||||
@@ -122,6 +133,7 @@ Android_PumpEvents_Blocking(_THIS)
|
||||
|
||||
ANDROIDAUDIO_ResumeDevices();
|
||||
openslES_ResumeDevices();
|
||||
aaudio_ResumeDevices();
|
||||
|
||||
/* Restore the GL Context from here, as this operation is thread dependent */
|
||||
if (!isContextExternal && !SDL_HasEvent(SDL_QUIT)) {
|
||||
@@ -178,6 +190,7 @@ Android_PumpEvents_NonBlocking(_THIS)
|
||||
if (videodata->pauseAudio) {
|
||||
ANDROIDAUDIO_PauseDevices();
|
||||
openslES_PauseDevices();
|
||||
aaudio_PauseDevices();
|
||||
}
|
||||
|
||||
backup_context = 0;
|
||||
@@ -196,6 +209,7 @@ Android_PumpEvents_NonBlocking(_THIS)
|
||||
if (videodata->pauseAudio) {
|
||||
ANDROIDAUDIO_ResumeDevices();
|
||||
openslES_ResumeDevices();
|
||||
aaudio_ResumeDevices();
|
||||
}
|
||||
|
||||
/* Restore the GL Context from here, as this operation is thread dependent */
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -69,7 +69,7 @@ Android_GLES_SwapWindow(_THIS, SDL_Window * window)
|
||||
|
||||
/* The following two calls existed in the original Java code
|
||||
* If you happen to have a device that's affected by their removal,
|
||||
* please report to Bugzilla. -- Gabriel
|
||||
* please report to our bug tracker. -- Gabriel
|
||||
*/
|
||||
|
||||
/*_this->egl_data->eglWaitNative(EGL_CORE_NATIVE_ENGINE);
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -64,7 +64,7 @@ int Android_SurfaceWidth = 0;
|
||||
int Android_SurfaceHeight = 0;
|
||||
static int Android_DeviceWidth = 0;
|
||||
static int Android_DeviceHeight = 0;
|
||||
static Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_UNKNOWN;
|
||||
static Uint32 Android_ScreenFormat = SDL_PIXELFORMAT_RGB565; /* Default SurfaceView format, in case this is queried before being filled */
|
||||
static int Android_ScreenRate = 0;
|
||||
SDL_sem *Android_PauseSem = NULL;
|
||||
SDL_sem *Android_ResumeSem = NULL;
|
||||
@@ -194,7 +194,7 @@ Android_VideoInit(_THIS)
|
||||
return -1;
|
||||
}
|
||||
display = SDL_GetDisplay(display_index);
|
||||
display->orientation = Android_JNI_GetDisplayOrientation();
|
||||
display->orientation = Android_JNI_GetDisplayOrientation();
|
||||
|
||||
SDL_AddDisplayMode(&_this->displays[0], &mode);
|
||||
|
||||
@@ -222,16 +222,54 @@ Android_GetDisplayDPI(_THIS, SDL_VideoDisplay *display, float *ddpi, float *hdpi
|
||||
}
|
||||
|
||||
void
|
||||
Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate)
|
||||
Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, float rate)
|
||||
{
|
||||
Android_SurfaceWidth = surfaceWidth;
|
||||
Android_SurfaceHeight = surfaceHeight;
|
||||
Android_DeviceWidth = deviceWidth;
|
||||
Android_DeviceHeight = deviceHeight;
|
||||
Android_ScreenFormat = format;
|
||||
Android_ScreenRate = (int)rate;
|
||||
}
|
||||
|
||||
static
|
||||
Uint32 format_to_pixelFormat(int format) {
|
||||
Uint32 pf;
|
||||
if (format == AHARDWAREBUFFER_FORMAT_R8G8B8A8_UNORM) { /* 1 */
|
||||
pf = SDL_PIXELFORMAT_RGBA8888;
|
||||
} else if (format == AHARDWAREBUFFER_FORMAT_R8G8B8X8_UNORM) { /* 2 */
|
||||
pf = SDL_PIXELFORMAT_RGBX8888;
|
||||
} else if (format == AHARDWAREBUFFER_FORMAT_R8G8B8_UNORM) { /* 3 */
|
||||
pf = SDL_PIXELFORMAT_RGB24;
|
||||
} else if (format == AHARDWAREBUFFER_FORMAT_R5G6B5_UNORM) { /* 4*/
|
||||
pf = SDL_PIXELFORMAT_RGB565;
|
||||
} else if (format == 5) {
|
||||
pf = SDL_PIXELFORMAT_BGRA8888;
|
||||
} else if (format == 6) {
|
||||
pf = SDL_PIXELFORMAT_RGBA5551;
|
||||
} else if (format == 7) {
|
||||
pf = SDL_PIXELFORMAT_RGBA4444;
|
||||
} else {
|
||||
pf = SDL_PIXELFORMAT_UNKNOWN;
|
||||
}
|
||||
return pf;
|
||||
}
|
||||
|
||||
void
|
||||
Android_SetFormat(int format_wanted, int format_got)
|
||||
{
|
||||
Uint32 pf_wanted;
|
||||
Uint32 pf_got;
|
||||
|
||||
pf_wanted = format_to_pixelFormat(format_wanted);
|
||||
pf_got = format_to_pixelFormat(format_got);
|
||||
|
||||
Android_ScreenFormat = pf_got;
|
||||
|
||||
SDL_Log("pixel format wanted %s (%d), got %s (%d)",
|
||||
SDL_GetPixelFormatName(pf_wanted), format_wanted,
|
||||
SDL_GetPixelFormatName(pf_got), format_got);
|
||||
}
|
||||
|
||||
void Android_SendResize(SDL_Window *window)
|
||||
{
|
||||
/*
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
@@ -28,7 +28,8 @@
|
||||
#include "../SDL_sysvideo.h"
|
||||
|
||||
/* Called by the JNI layer when the screen changes size or format */
|
||||
extern void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, Uint32 format, float rate);
|
||||
extern void Android_SetScreenResolution(int surfaceWidth, int surfaceHeight, int deviceWidth, int deviceHeight, float rate);
|
||||
extern void Android_SetFormat(int format_wanted, int format_got);
|
||||
extern void Android_SendResize(SDL_Window *window);
|
||||
|
||||
/* Private display data */
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
Simple DirectMedia Layer
|
||||
Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
|
||||
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
|
||||
|
||||
This software is provided 'as-is', without any express or implied
|
||||
warranty. In no event will the authors be held liable for any damages
|
||||
|
Reference in New Issue
Block a user