trunk/src/osd/sdl/drawbgfx.c
| r243491 | r243492 | |
| 73 | 73 | class sdl_info_bgfx : public osd_renderer |
| 74 | 74 | { |
| 75 | 75 | public: |
| 76 | | sdl_info_bgfx(sdl_window_info *w) |
| 76 | sdl_info_bgfx(osd_window *w) |
| 77 | 77 | : osd_renderer(w, FLAG_NONE), m_blittimer(0), m_renderer(NULL), |
| 78 | 78 | m_blitwidth(0), m_blitheight(0), |
| 79 | 79 | m_last_hofs(0), m_last_vofs(0), |
| r243491 | r243492 | |
| 128 | 128 | // drawbgfx_init |
| 129 | 129 | //============================================================ |
| 130 | 130 | |
| 131 | | static osd_renderer *drawbgfx_create(sdl_window_info *window) |
| 131 | static osd_renderer *drawbgfx_create(osd_window *window) |
| 132 | 132 | { |
| 133 | 133 | return global_alloc(sdl_info_bgfx(window)); |
| 134 | 134 | } |
trunk/src/osd/sdl/video.c
| r243491 | r243492 | |
| 151 | 151 | SDL_GetCurrentDisplayMode(m_handle, &dmode); |
| 152 | 152 | #endif |
| 153 | 153 | SDL_GetDisplayBounds(m_handle, &m_dimensions); |
| 154 | | m_center_width = m_dimensions.w; |
| 155 | | m_center_height = m_dimensions.h; |
| 156 | 154 | |
| 157 | 155 | // FIXME: Use SDL_GetDisplayBounds(monitor->handle, &tt) to update monitor_x |
| 158 | 156 | // SDL_Rect tt; |
| r243491 | r243492 | |
| 195 | 193 | m_dimensions.w = DisplayWidth(info.info.x11.display, screen); |
| 196 | 194 | m_dimensions.h = DisplayHeight(info.info.x11.display, screen); |
| 197 | 195 | |
| 196 | /* FIXME: If Xinerame is used we should compile a list of monitors |
| 197 | * like we do for other targets and ignore SDL. |
| 198 | */ |
| 198 | 199 | if ((XineramaIsActive(info.info.x11.display)) && video_config.restrictonemonitor) |
| 199 | 200 | { |
| 200 | 201 | XineramaScreenInfo *xineinfo; |
| 201 | 202 | int numscreens; |
| 202 | 203 | |
| 203 | | xineinfo = XineramaQueryScreens(info.info.x11.display, &numscreens); |
| 204 | xineinfo = XineramaQueryScreens(info.info.x11.display, &numscreens); |
| 204 | 205 | |
| 205 | | m_center_width = xineinfo[0].width; |
| 206 | | m_center_height = xineinfo[0].height; |
| 206 | m_dimensions.w = xineinfo[0].width; |
| 207 | m_dimensions.h = xineinfo[0].height; |
| 207 | 208 | |
| 208 | 209 | XFree(xineinfo); |
| 210 | printf("XineneraActive\n"); |
| 209 | 211 | } |
| 210 | | else |
| 211 | | { |
| 212 | | m_center_width = m_dimensions.w; |
| 213 | | m_center_height = m_dimensions.h; |
| 214 | | } |
| 215 | 212 | } |
| 216 | 213 | else |
| 217 | 214 | #endif // defined(SDLMAME_X11) |
| r243491 | r243492 | |
| 250 | 247 | } |
| 251 | 248 | m_dimensions.w = cw; |
| 252 | 249 | m_dimensions.h = ch; |
| 253 | | m_center_width = cw; |
| 254 | | m_center_height = ch; |
| 255 | 250 | } |
| 256 | 251 | } |
| 257 | 252 | #elif defined(SDLMAME_OS2) // OS2 version |
| r243491 | r243492 | |
| 428 | 423 | |
| 429 | 424 | SDL_GetDesktopDisplayMode(i, &dmode); |
| 430 | 425 | SDL_GetDisplayBounds(i, &monitor->m_dimensions); |
| 431 | | monitor->m_center_width = monitor->m_dimensions.w; |
| 432 | | monitor->m_center_height = monitor->m_dimensions.h; |
| 433 | 426 | |
| 434 | 427 | // guess the aspect ratio assuming square pixels |
| 435 | 428 | monitor->m_aspect = (float)(dmode.w) / (float)(dmode.h); |
trunk/src/osd/sdl/video.h
| r243491 | r243492 | |
| 65 | 65 | public: |
| 66 | 66 | |
| 67 | 67 | sdl_monitor_info() |
| 68 | | : m_next(NULL), m_handle(0), m_aspect(0.0f), |
| 69 | | m_center_width(0), m_center_height(0) |
| 68 | : m_next(NULL), m_handle(0), m_aspect(0.0f) |
| 70 | 69 | {} |
| 71 | 70 | sdl_monitor_info(const UINT64 handle, const char *monitor_device, float aspect) |
| 72 | | : m_next(NULL), m_handle(handle), m_aspect(aspect), |
| 73 | | m_center_width(0), m_center_height(0) |
| 71 | : m_next(NULL), m_handle(handle), m_aspect(aspect) |
| 74 | 72 | { |
| 75 | 73 | strncpy(m_monitor_device, monitor_device, 64); |
| 76 | 74 | refresh(); |
| r243491 | r243492 | |
| 83 | 81 | |
| 84 | 82 | float aspect(); |
| 85 | 83 | |
| 86 | | int center_width() { refresh(); return m_center_width; } |
| 87 | | int center_height() { refresh(); return m_center_height; } |
| 88 | | |
| 89 | 84 | void set_aspect(const float aspect) { m_aspect = aspect; } |
| 90 | 85 | |
| 91 | 86 | // STATIC |
| r243491 | r243492 | |
| 111 | 106 | SDL_Rect m_dimensions; |
| 112 | 107 | char m_monitor_device[64]; |
| 113 | 108 | float m_aspect; // computed/configured aspect ratio of the physical device |
| 114 | | int m_center_width; // width of first physical screen for centering |
| 115 | | int m_center_height; // height of first physical screen for centering |
| 116 | | |
| 117 | | |
| 118 | 109 | }; |
| 119 | 110 | |
| 120 | 111 | |
trunk/src/osd/sdl/window.c
| r243491 | r243492 | |
| 385 | 385 | void sdl_window_info::blit_surface_size(int &blitwidth, int &blitheight) |
| 386 | 386 | { |
| 387 | 387 | int window_width, window_height; |
| 388 | | if ((!fullscreen()) || (video_config.switchres)) |
| 389 | | { |
| 390 | | get_size(window_width, window_height); |
| 391 | | } |
| 392 | | else |
| 393 | | { |
| 394 | | window_width = monitor()->center_width(); |
| 395 | | window_height = monitor()->center_height(); |
| 396 | | } |
| 388 | get_size(window_width, window_height); |
| 397 | 389 | |
| 398 | | |
| 399 | 390 | INT32 newwidth, newheight; |
| 400 | 391 | int xscale = 1, yscale = 1; |
| 401 | 392 | float desired_aspect = 1.0f; |
| r243491 | r243492 | |
| 1433 | 1424 | propheight = MAX(propheight, minheight); |
| 1434 | 1425 | |
| 1435 | 1426 | // clamp against the maximum (fit on one screen for full screen mode) |
| 1427 | maxwidth = m_monitor->position_size().w - extrawidth; |
| 1428 | maxheight = m_monitor->position_size().h - extraheight; |
| 1436 | 1429 | if (this->m_fullscreen) |
| 1437 | 1430 | { |
| 1438 | | maxwidth = m_monitor->center_width() - extrawidth; |
| 1439 | | maxheight = m_monitor->center_height() - extraheight; |
| 1431 | // nothing |
| 1440 | 1432 | } |
| 1441 | 1433 | else |
| 1442 | 1434 | { |
| 1443 | | maxwidth = m_monitor->center_width() - extrawidth; |
| 1444 | | maxheight = m_monitor->center_height() - extraheight; |
| 1445 | | |
| 1446 | 1435 | // further clamp to the maximum width/height in the window |
| 1447 | 1436 | if (this->m_maxwidth != 0) |
| 1448 | 1437 | maxwidth = MIN(maxwidth, this->m_maxwidth + extrawidth); |
| r243491 | r243492 | |
| 1522 | 1511 | INT32 maxwidth, maxheight; |
| 1523 | 1512 | |
| 1524 | 1513 | // compute the maximum client area |
| 1525 | | maxwidth = m_monitor->center_width(); |
| 1526 | | maxheight = m_monitor->center_height(); |
| 1514 | maxwidth = m_monitor->position_size().w; |
| 1515 | maxheight = m_monitor->position_size().h; |
| 1527 | 1516 | |
| 1528 | 1517 | // clamp to the window's max |
| 1529 | 1518 | if (this->m_maxwidth != 0) |