trunk/src/osd/sdl/draw13.c
| r243392 | r243393 | |
| 145 | 145 | sdl_info13(sdl_window_info *w) |
| 146 | 146 | : osd_renderer(w, FLAG_NONE), m_blittimer(0), m_sdl_renderer(NULL), |
| 147 | 147 | m_last_hofs(0), m_last_vofs(0), |
| 148 | | m_resize_pending(0), m_resize_width(0), m_resize_height(0), |
| 148 | m_last_width(0), m_last_height(0), |
| 149 | 149 | m_last_blit_time(0), m_last_blit_pixels(0) |
| 150 | 150 | {} |
| 151 | 151 | |
| 152 | 152 | /* virtual */ int create(const int width, const int height); |
| 153 | | /* virtual */ void resize(const int width, const int height); |
| 154 | 153 | /* virtual */ int draw(const UINT32 dc, const int update); |
| 155 | 154 | /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt); |
| 156 | 155 | /* virtual */ void destroy_all_textures(); |
| r243392 | r243393 | |
| 177 | 176 | float m_last_hofs; |
| 178 | 177 | float m_last_vofs; |
| 179 | 178 | |
| 180 | | // resize information |
| 179 | int m_last_width; |
| 180 | int m_last_height; |
| 181 | 181 | |
| 182 | | UINT8 m_resize_pending; |
| 183 | | UINT32 m_resize_width; |
| 184 | | UINT32 m_resize_height; |
| 185 | | |
| 186 | 182 | // Stats |
| 187 | 183 | INT64 m_last_blit_time; |
| 188 | 184 | INT64 m_last_blit_pixels; |
| r243392 | r243393 | |
| 617 | 613 | return 0; |
| 618 | 614 | } |
| 619 | 615 | |
| 620 | | //============================================================ |
| 621 | | // sdl_info::resize |
| 622 | | //============================================================ |
| 623 | 616 | |
| 624 | | void sdl_info13::resize(int width, int height) |
| 625 | | { |
| 626 | | SDL_RenderSetViewport(m_sdl_renderer, NULL); |
| 627 | | m_blittimer = 3; |
| 628 | | } |
| 629 | | |
| 630 | | |
| 631 | 617 | //============================================================ |
| 632 | 618 | // sdl_info::destroy |
| 633 | 619 | //============================================================ |
| r243392 | r243393 | |
| 695 | 681 | return 0; |
| 696 | 682 | } |
| 697 | 683 | |
| 698 | | #if 0 |
| 699 | | if (m_resize_pending) |
| 684 | if ((window().width() != m_last_width) || (window().height() != m_last_height)) |
| 700 | 685 | { |
| 701 | | SDL_SetWindowSize(window().m_sdl_window, m_resize_width, m_resize_height); |
| 702 | | SDL_GetWindowSize(window().m_sdl_window, &window().width(), &window().height()); |
| 703 | | m_resize_pending = 0; |
| 686 | m_last_width = window().width(); |
| 687 | m_last_height = window().height(); |
| 704 | 688 | SDL_RenderSetViewport(m_sdl_renderer, NULL); |
| 705 | | //sdlvideo_monitor_refresh(window().monitor()); |
| 706 | | |
| 689 | m_blittimer = 3; |
| 707 | 690 | } |
| 708 | | #endif |
| 709 | 691 | //SDL_SelectRenderer(window().sdl_window); |
| 710 | 692 | |
| 711 | 693 | if (m_blittimer > 0) |
trunk/src/osd/sdl/drawbgfx.c
| r243392 | r243393 | |
| 80 | 80 | {} |
| 81 | 81 | |
| 82 | 82 | /* virtual */ int create(const int width, const int height); |
| 83 | | /* virtual */ void resize(const int width, const int height); |
| 84 | 83 | /* virtual */ int draw(const UINT32 dc, const int update); |
| 85 | 84 | /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt); |
| 86 | 85 | /* virtual */ void destroy_all_textures(); |
| r243392 | r243393 | |
| 152 | 151 | } |
| 153 | 152 | |
| 154 | 153 | //============================================================ |
| 155 | | // sdl_info_bgfx::resize |
| 156 | | //============================================================ |
| 157 | | |
| 158 | | void sdl_info_bgfx::resize(int width, int height) |
| 159 | | { |
| 160 | | m_blittimer = 3; |
| 161 | | } |
| 162 | | |
| 163 | | //============================================================ |
| 164 | 154 | // drawsdl_xy_to_render_target |
| 165 | 155 | //============================================================ |
| 166 | 156 | |
trunk/src/osd/sdl/drawogl.c
| r243392 | r243393 | |
| 224 | 224 | sdl_info_ogl(sdl_window_info *window) |
| 225 | 225 | : osd_renderer(window, FLAG_NEEDS_OPENGL), m_blittimer(0), |
| 226 | 226 | m_screen_width(0), m_screen_height(0), |
| 227 | m_last_width(0), m_last_height(0), |
| 227 | 228 | #if (SDLMAME_SDL2) |
| 228 | 229 | m_gl_context_id(0), |
| 229 | 230 | #else |
| r243392 | r243393 | |
| 252 | 253 | } |
| 253 | 254 | |
| 254 | 255 | /* virtual */ int create(const int width, const int height); |
| 255 | | /* virtual */ void resize(const int width, int const height); |
| 256 | 256 | /* virtual */ int draw(const UINT32 dc, const int update); |
| 257 | 257 | /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt); |
| 258 | 258 | /* virtual */ void destroy_all_textures(); |
| r243392 | r243393 | |
| 280 | 280 | INT32 m_blittimer; |
| 281 | 281 | int m_screen_width; |
| 282 | 282 | int m_screen_height; |
| 283 | int m_last_width; |
| 284 | int m_last_height; |
| 283 | 285 | |
| 284 | 286 | #if (SDLMAME_SDL2) |
| 285 | 287 | SDL_GLContext m_gl_context_id; |
| r243392 | r243393 | |
| 754 | 756 | return 0; |
| 755 | 757 | } |
| 756 | 758 | |
| 757 | | //============================================================ |
| 758 | | // sdl_info::resize |
| 759 | | //============================================================ |
| 760 | 759 | |
| 761 | | void sdl_info_ogl::resize(int width, int height) |
| 762 | | { |
| 763 | | #if (SDLMAME_SDL2) |
| 764 | | m_blittimer = 3; |
| 765 | | #endif |
| 766 | | m_init_context = 1; |
| 767 | | } |
| 768 | | |
| 769 | | |
| 770 | 760 | //============================================================ |
| 771 | 761 | // sdl_info::destroy |
| 772 | 762 | //============================================================ |
| r243392 | r243393 | |
| 1221 | 1211 | return 0; |
| 1222 | 1212 | } |
| 1223 | 1213 | |
| 1214 | if ((window().width() != m_last_width) || (window().height() != m_last_height)) |
| 1215 | { |
| 1216 | m_last_width = window().width(); |
| 1217 | m_last_height = window().height(); |
| 1224 | 1218 | #if (SDLMAME_SDL2) |
| 1219 | m_blittimer = 3; |
| 1220 | #endif |
| 1221 | m_init_context = 1; |
| 1222 | } |
| 1223 | |
| 1224 | #if (SDLMAME_SDL2) |
| 1225 | 1225 | SDL_GL_MakeCurrent(window().sdl_window(), m_gl_context_id); |
| 1226 | 1226 | #else |
| 1227 | 1227 | if (!m_init_context) |
trunk/src/osd/sdl/drawsdl.c
| r243392 | r243393 | |
| 65 | 65 | m_last_hofs(0), |
| 66 | 66 | m_last_vofs(0), |
| 67 | 67 | m_old_blitwidth(0), |
| 68 | | m_old_blitheight(0) |
| 68 | m_old_blitheight(0), |
| 69 | m_last_width(0), |
| 70 | m_last_height(0) |
| 69 | 71 | { } |
| 70 | 72 | |
| 71 | 73 | /* virtual */ int create(const int width, const int height); |
| 72 | | /* virtual */ void resize(const int width, const int height); |
| 73 | 74 | /* virtual */ int draw(const UINT32 dc, const int update); |
| 74 | 75 | /* virtual */ int xy_to_render_target(const int x, const int y, int *xt, int *yt); |
| 75 | 76 | /* virtual */ void destroy_all_textures(); |
| r243392 | r243393 | |
| 107 | 108 | int m_last_vofs; |
| 108 | 109 | int m_old_blitwidth; |
| 109 | 110 | int m_old_blitheight; |
| 111 | int m_last_width; |
| 112 | int m_last_height; |
| 110 | 113 | }; |
| 111 | 114 | |
| 112 | 115 | struct sdl_scale_mode |
| r243392 | r243393 | |
| 475 | 478 | } |
| 476 | 479 | |
| 477 | 480 | //============================================================ |
| 478 | | // sdl_info::resize |
| 479 | | //============================================================ |
| 480 | | |
| 481 | | void sdl_info::resize(int width, int height) |
| 482 | | { |
| 483 | | #if (SDLMAME_SDL2) |
| 484 | | SDL_RenderSetViewport(m_sdl_renderer, NULL); |
| 485 | | #else |
| 486 | | const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode]; |
| 487 | | if (sdl_sm->is_yuv) |
| 488 | | { |
| 489 | | yuv_overlay_init(); |
| 490 | | } |
| 491 | | #endif |
| 492 | | } |
| 493 | | |
| 494 | | |
| 495 | | //============================================================ |
| 496 | 481 | // sdl_info::destroy |
| 497 | 482 | //============================================================ |
| 498 | 483 | |
| r243392 | r243393 | |
| 580 | 565 | return 0; |
| 581 | 566 | } |
| 582 | 567 | |
| 568 | if ((window().width() != m_last_width) || (window().height() != m_last_height)) |
| 569 | { |
| 570 | m_last_width = window().width(); |
| 571 | m_last_height = window().height(); |
| 572 | #if (SDLMAME_SDL2) |
| 573 | SDL_RenderSetViewport(m_sdl_renderer, NULL); |
| 574 | #else |
| 575 | const sdl_scale_mode *sdl_sm = &scale_modes[video_config.scale_mode]; |
| 576 | if (sdl_sm->is_yuv) |
| 577 | { |
| 578 | yuv_overlay_init(); |
| 579 | } |
| 580 | #endif |
| 581 | } |
| 582 | |
| 583 | 583 | // lock it if we need it |
| 584 | 584 | #if (!SDLMAME_SDL2) |
| 585 | 585 | |
trunk/src/osd/sdl/window.h
| r243392 | r243393 | |
| 58 | 58 | bool check_flag(const int flag) { return ((m_flags & flag)) == flag; } |
| 59 | 59 | |
| 60 | 60 | virtual int create(const int width, const int height) = 0; |
| 61 | | virtual void resize(const int width, const int height) = 0; |
| 62 | 61 | virtual int draw(const UINT32 dc, const int update) = 0; |
| 63 | 62 | virtual int xy_to_render_target(const int x, const int y, int *xt, int *yt) = 0; |
| 64 | 63 | virtual void destroy_all_textures() = 0; |