Fixed low brightness in SDL 1.3, caused by on-screen keyboard
This commit is contained in:
@@ -599,7 +599,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
|
||||
SDL_VideoViewport.w = width;
|
||||
SDL_VideoViewport.h = height;
|
||||
|
||||
SDL_VideoSurface = SDL_CreateRGBSurfaceFrom(NULL, 0, 0, 32, 0, 0, 0, 0, 0);
|
||||
SDL_VideoSurface = SDL_CreateRGBSurfaceFrom(NULL, 0, 0, bpp, 0, 0, 0, 0, 0);
|
||||
SDL_VideoSurface->flags |= surface_flags;
|
||||
SDL_VideoSurface->flags |= SDL_DONTFREE;
|
||||
SDL_FreeFormat(SDL_VideoSurface->format);
|
||||
@@ -610,7 +610,7 @@ SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags)
|
||||
SDL_VideoSurface->pitch = SDL_WindowSurface->pitch;
|
||||
SDL_VideoSurface->pixels = (void *)((Uint8 *)SDL_WindowSurface->pixels +
|
||||
SDL_VideoViewport.y * SDL_VideoSurface->pitch +
|
||||
SDL_VideoViewport.x * SDL_VideoSurface->format->BytesPerPixel);
|
||||
SDL_VideoViewport.x * SDL_VideoSurface->format->BytesPerPixel);
|
||||
SDL_SetClipRect(SDL_VideoSurface, NULL);
|
||||
|
||||
/* Create a shadow surface if necessary */
|
||||
@@ -798,9 +798,6 @@ SDL_UpdateRects(SDL_Surface * screen, int numrects, SDL_Rect * rects)
|
||||
SDL_UpdateWindowSurfaceRects(SDL_VideoWindow, rects, numrects);
|
||||
}
|
||||
}
|
||||
#ifdef ANDROID
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -286,45 +286,3 @@ TODO: merge this
|
||||
return renderer->RenderCopy(renderer, texture, &real_srcrect,
|
||||
&real_dstrect);
|
||||
}
|
||||
@@ -3458,4 +3631,41 @@
|
||||
}
|
||||
}
|
||||
|
||||
+#ifdef ANDROID
|
||||
+void SDL_ANDROID_VideoContextLost()
|
||||
+{
|
||||
+ SDL_Texture * tex;
|
||||
+ if( ! SDL_CurrentDisplay || ! SDL_CurrentRenderer || ! SDL_CurrentRenderer->window || ! SDL_CurrentRenderer->textures || SDL_GetWindowFlags(SDL_CurrentRenderer->window) & SDL_WINDOW_OPENGL )
|
||||
+ return;
|
||||
+
|
||||
+ tex = SDL_CurrentRenderer->textures;
|
||||
+ while( tex )
|
||||
+ {
|
||||
+ SDL_CurrentRenderer->DestroyTexture( SDL_CurrentRenderer, tex );
|
||||
+ tex = tex->next;
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void SDL_ANDROID_VideoContextRecreated()
|
||||
+{
|
||||
+ int numTextures = 0;
|
||||
+ SDL_Texture * tex;
|
||||
+ __android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_ANDROID_VideoContextRecreated(): SDL_CurrentRenderer %p", SDL_CurrentRenderer);
|
||||
+ if( ! SDL_CurrentRenderer )
|
||||
+ return;
|
||||
+
|
||||
+ if( SDL_CurrentRenderer->ActivateRenderer ) /* Re-apply glOrtho() and blend modes */
|
||||
+ SDL_CurrentRenderer->ActivateRenderer(SDL_CurrentRenderer);
|
||||
+
|
||||
+ tex = SDL_CurrentRenderer->textures;
|
||||
+ while( tex )
|
||||
+ {
|
||||
+ SDL_CurrentRenderer->CreateTexture( SDL_CurrentRenderer, tex );
|
||||
+ tex = tex->next;
|
||||
+ numTextures++;
|
||||
+ }
|
||||
+ __android_log_print(ANDROID_LOG_INFO, "libSDL", "SDL_ANDROID_VideoContextRecreated(): re-created %d textures", numTextures);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
/* vi: set ts=4 sw=4 expandtab: */
|
||||
|
||||
@@ -106,12 +106,12 @@ SDL_RendererEventWatch(void *userdata, SDL_Event *event)
|
||||
int w, h;
|
||||
SDL_Rect viewport;
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_RendererEventWatch(): window %p", window);
|
||||
SDL_GetWindowSize(window, &w, &h);
|
||||
viewport.x = (w - renderer->viewport.w) / 2;
|
||||
viewport.y = (h - renderer->viewport.h) / 2;
|
||||
viewport.w = renderer->viewport.w;
|
||||
viewport.h = renderer->viewport.h;
|
||||
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_RendererEventWatch(): window %p size %dx%d", window, w, h);
|
||||
SDL_RenderSetViewport(renderer, &viewport);
|
||||
} else if (event->window.event == SDL_WINDOWEVENT_MINIMIZED) {
|
||||
renderer->minimized = SDL_TRUE;
|
||||
@@ -808,7 +808,6 @@ SDL_RenderSetViewport(SDL_Renderer * renderer, const SDL_Rect * rect)
|
||||
} else {
|
||||
renderer->viewport.x = 0;
|
||||
renderer->viewport.y = 0;
|
||||
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_RenderSetViewport(): window %p", renderer->window);
|
||||
if (renderer->window) {
|
||||
SDL_GetWindowSize(renderer->window,
|
||||
&renderer->viewport.w, &renderer->viewport.h);
|
||||
|
||||
@@ -705,7 +705,7 @@ static int
|
||||
GLES_RenderCopy(SDL_Renderer * renderer, SDL_Texture * texture,
|
||||
const SDL_Rect * srcrect, const SDL_Rect * dstrect)
|
||||
{
|
||||
|
||||
//__android_log_print(ANDROID_LOG_INFO, "SDL", "GLES_RenderCopy %dx%d+%d+%d -> %dx%d+%d+%d", srcrect->x, srcrect->y, srcrect->w, srcrect->h, dstrect->x, dstrect->y, dstrect->w, dstrect->h);
|
||||
GLES_RenderData *data = (GLES_RenderData *) renderer->driverdata;
|
||||
GLES_TextureData *texturedata = (GLES_TextureData *) texture->driverdata;
|
||||
int minx, miny, maxx, maxy;
|
||||
|
||||
@@ -210,6 +210,8 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix
|
||||
SDL_RendererInfo info;
|
||||
Uint32 i;
|
||||
|
||||
__android_log_print(ANDROID_LOG_INFO, "SDL", "SDL_CreateWindowTexture %dx%d", window->w, window->h);
|
||||
|
||||
data = SDL_GetWindowData(window, SDL_WINDOWTEXTUREDATA);
|
||||
if (!data) {
|
||||
SDL_Renderer *renderer = NULL;
|
||||
@@ -290,6 +292,10 @@ SDL_CreateWindowTexture(_THIS, SDL_Window * window, Uint32 * format, void ** pix
|
||||
/* Create framebuffer data */
|
||||
data->bytes_per_pixel = SDL_BYTESPERPIXEL(*format);
|
||||
data->pitch = (((window->w * data->bytes_per_pixel) + 3) & ~3);
|
||||
#ifdef __ANDROID__
|
||||
if( data->bytes_per_pixel == 2 ) /* Avoid extra memcpy() when calling SDL_UpdateTexture() */
|
||||
data->pitch = window->w * data->bytes_per_pixel;
|
||||
#endif
|
||||
data->pixels = SDL_malloc(window->h * data->pitch);
|
||||
if (!data->pixels) {
|
||||
SDL_OutOfMemory();
|
||||
|
||||
@@ -175,9 +175,9 @@ void ANDROID_GetDisplayModes(_THIS, SDL_VideoDisplay * display)
|
||||
mode.format = SDL_ANDROID_BITSPERPIXEL == 16 ? SDL_PIXELFORMAT_RGB565 : SDL_ANDROID_BITSPERPIXEL == 32 ? SDL_PIXELFORMAT_ABGR8888 : SDL_PIXELFORMAT_RGB24;
|
||||
mode.driverdata = NULL;
|
||||
SDL_AddDisplayMode(display, &mode);
|
||||
mode.w = 640;
|
||||
mode.h = 480;
|
||||
SDL_AddDisplayMode(display, &mode);
|
||||
//mode.w = 640;
|
||||
//mode.h = 480;
|
||||
//SDL_AddDisplayMode(display, &mode);
|
||||
}
|
||||
|
||||
int ANDROID_GetDisplayBounds(_THIS, SDL_VideoDisplay * display, SDL_Rect * rect)
|
||||
|
||||
@@ -142,6 +142,8 @@ static inline void endDrawingTex()
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, oldGlState.texFilter1);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, oldGlState.texFilter2);
|
||||
*/
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
static inline void drawCharTex(GLTexture_t * tex, SDL_Rect * src, SDL_Rect * dest, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
|
||||
|
||||
Reference in New Issue
Block a user