Commit f22214ce authored by Mike Gorchak's avatar Mike Gorchak

Working on fullscreen video modes support

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%404087
parent 78ffba1f
...@@ -427,7 +427,7 @@ photon_videoinit(_THIS) ...@@ -427,7 +427,7 @@ photon_videoinit(_THIS)
return -1; return -1;
} }
/* Get current video mode 2D capabilities */ /* Get current video mode 2D capabilities for the renderer */
didata->mode_2dcaps=0; didata->mode_2dcaps=0;
if ((modeinfo.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND)==PgVM_MODE_CAP2_ALPHA_BLEND) if ((modeinfo.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND)==PgVM_MODE_CAP2_ALPHA_BLEND)
{ {
...@@ -469,6 +469,7 @@ photon_videoinit(_THIS) ...@@ -469,6 +469,7 @@ photon_videoinit(_THIS)
SDL_zero(display); SDL_zero(display);
display.desktop_mode = current_mode; display.desktop_mode = current_mode;
display.current_mode = current_mode; display.current_mode = current_mode;
display.fullscreen_mode = current_mode;
display.driverdata = didata; display.driverdata = didata;
didata->current_mode = current_mode; didata->current_mode = current_mode;
SDL_AddVideoDisplay(&display); SDL_AddVideoDisplay(&display);
...@@ -615,7 +616,7 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode) ...@@ -615,7 +616,7 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode)
status = PdSetTargetDevice(NULL, phdata->rid[didata->device_id]); status = PdSetTargetDevice(NULL, phdata->rid[didata->device_id]);
if (status != 0) { if (status != 0) {
SDL_SetError("Photon: Can't set default target device\n"); SDL_SetError("Photon: Can't set default target device\n");
return; return -1;
} }
phdata->current_device_id = didata->device_id; phdata->current_device_id = didata->device_id;
} }
...@@ -624,7 +625,7 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode) ...@@ -624,7 +625,7 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode)
status = PgGetVideoModeList(&modes); status = PgGetVideoModeList(&modes);
if (status != 0) { if (status != 0) {
SDL_SetError("Photon: Can't get video mode list"); SDL_SetError("Photon: Can't get video mode list");
return; return -1;
} }
/* Current display dimension and bpp are no more valid */ /* Current display dimension and bpp are no more valid */
...@@ -761,7 +762,7 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode) ...@@ -761,7 +762,7 @@ photon_setdisplaymode(_THIS, SDL_DisplayMode * mode)
didata->current_mode = *mode; didata->current_mode = *mode;
didata->current_mode.refresh_rate = refresh_rate; didata->current_mode.refresh_rate = refresh_rate;
/* Get current video mode 2D capabilities */ /* Get current video mode 2D capabilities for the renderer */
didata->mode_2dcaps=0; didata->mode_2dcaps=0;
if ((modeinfo.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND)==PgVM_MODE_CAP2_ALPHA_BLEND) if ((modeinfo.mode_capabilities2 & PgVM_MODE_CAP2_ALPHA_BLEND)==PgVM_MODE_CAP2_ALPHA_BLEND)
{ {
...@@ -1039,6 +1040,9 @@ photon_createwindow(_THIS, SDL_Window * window) ...@@ -1039,6 +1040,9 @@ photon_createwindow(_THIS, SDL_Window * window)
/* By default last created window got a input focus */ /* By default last created window got a input focus */
SDL_SetKeyboardFocus(0, window->id); SDL_SetKeyboardFocus(0, window->id);
/* Emit focus gained event, because photon is not sending it */
SDL_OnWindowFocusGained(window);
/* Window has been successfully created */ /* Window has been successfully created */
return 0; return 0;
} }
...@@ -1287,6 +1291,7 @@ photon_destroywindow(_THIS, SDL_Window * window) ...@@ -1287,6 +1291,7 @@ photon_destroywindow(_THIS, SDL_Window * window)
/* Free OpenGL ES target surface */ /* Free OpenGL ES target surface */
if (wdata->gfsurface != NULL) { if (wdata->gfsurface != NULL) {
gf_surface_free(wdata->gfsurface); gf_surface_free(wdata->gfsurface);
wdata->gfsurface=NULL;
} }
phdata->egl_refcount--; phdata->egl_refcount--;
...@@ -1700,6 +1705,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window) ...@@ -1700,6 +1705,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window)
wdata->gfsurface, NULL); wdata->gfsurface, NULL);
if (wdata->gles_surface == EGL_NO_SURFACE) { if (wdata->gles_surface == EGL_NO_SURFACE) {
gf_surface_free(wdata->gfsurface); gf_surface_free(wdata->gfsurface);
wdata->gfsurface=NULL;
eglDestroyContext(phdata->egldisplay, wdata->gles_context); eglDestroyContext(phdata->egldisplay, wdata->gles_context);
wdata->gles_context = EGL_NO_CONTEXT; wdata->gles_context = EGL_NO_CONTEXT;
SDL_SetError("Photon: Can't create EGL pixmap surface"); SDL_SetError("Photon: Can't create EGL pixmap surface");
...@@ -1723,6 +1729,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window) ...@@ -1723,6 +1729,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window)
eglDestroySurface(phdata->egldisplay, wdata->gles_surface); eglDestroySurface(phdata->egldisplay, wdata->gles_surface);
wdata->gles_surface=EGL_NO_SURFACE; wdata->gles_surface=EGL_NO_SURFACE;
gf_surface_free(wdata->gfsurface); gf_surface_free(wdata->gfsurface);
wdata->gfsurface=NULL;
eglDestroyContext(phdata->egldisplay, wdata->gles_context); eglDestroyContext(phdata->egldisplay, wdata->gles_context);
wdata->gles_context = EGL_NO_CONTEXT; wdata->gles_context = EGL_NO_CONTEXT;
SDL_SetError("Photon: Can't set OpenGL ES context on creation"); SDL_SetError("Photon: Can't set OpenGL ES context on creation");
...@@ -1786,6 +1793,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window) ...@@ -1786,6 +1793,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window)
eglDestroySurface(phdata->egldisplay, wdata->gles_surface); eglDestroySurface(phdata->egldisplay, wdata->gles_surface);
wdata->gles_surface=EGL_NO_SURFACE; wdata->gles_surface=EGL_NO_SURFACE;
gf_surface_free(wdata->gfsurface); gf_surface_free(wdata->gfsurface);
wdata->gfsurface=NULL;
eglDestroyContext(phdata->egldisplay, wdata->gles_context); eglDestroyContext(phdata->egldisplay, wdata->gles_context);
wdata->gles_context = EGL_NO_CONTEXT; wdata->gles_context = EGL_NO_CONTEXT;
SDL_SetError("Photon: Can't set default target device\n"); SDL_SetError("Photon: Can't set default target device\n");
...@@ -1800,6 +1808,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window) ...@@ -1800,6 +1808,7 @@ photon_gl_createcontext(_THIS, SDL_Window * window)
eglDestroySurface(phdata->egldisplay, wdata->gles_surface); eglDestroySurface(phdata->egldisplay, wdata->gles_surface);
wdata->gles_surface=EGL_NO_SURFACE; wdata->gles_surface=EGL_NO_SURFACE;
gf_surface_free(wdata->gfsurface); gf_surface_free(wdata->gfsurface);
wdata->gfsurface=NULL;
eglDestroyContext(phdata->egldisplay, wdata->gles_context); eglDestroyContext(phdata->egldisplay, wdata->gles_context);
wdata->gles_context = EGL_NO_CONTEXT; wdata->gles_context = EGL_NO_CONTEXT;
SDL_SetError("Photon: Can't bind GF surface to Photon\n"); SDL_SetError("Photon: Can't bind GF surface to Photon\n");
......
...@@ -185,6 +185,11 @@ photon_sdl_to_image_pixelformat(uint32_t pixelfmt) ...@@ -185,6 +185,11 @@ photon_sdl_to_image_pixelformat(uint32_t pixelfmt)
return Pg_IMAGE_DIRECT_8888; return Pg_IMAGE_DIRECT_8888;
} }
break; break;
case SDL_PIXELFORMAT_RGB888:
{
return Pg_IMAGE_DIRECT_8888;
}
break;
case SDL_PIXELFORMAT_RGB24: case SDL_PIXELFORMAT_RGB24:
{ {
return Pg_IMAGE_DIRECT_888; return Pg_IMAGE_DIRECT_888;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment