mirror of
https://github.com/holub/mame
synced 2025-05-09 15:51:48 +03:00
Renamed draw[sdl2|ogl|sdl]_window_get_primitives and related variables
to set_target_bounds. That's what is really done here. Moved common code back to window.c. (nw)
This commit is contained in:
parent
91005a5e13
commit
836ed8f2a7
@ -200,7 +200,7 @@ static int drawsdl2_window_create(sdl_window_info *window, int width, int height
|
|||||||
static void drawsdl2_window_resize(sdl_window_info *window, int width, int height);
|
static void drawsdl2_window_resize(sdl_window_info *window, int width, int height);
|
||||||
static void drawsdl2_window_destroy(sdl_window_info *window);
|
static void drawsdl2_window_destroy(sdl_window_info *window);
|
||||||
static int drawsdl2_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
static int drawsdl2_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
||||||
static render_primitive_list &drawsdl2_window_get_primitives(sdl_window_info *window);
|
static void drawsdl2_set_target_bounds(sdl_window_info *window);
|
||||||
static void drawsdl2_destroy_all_textures(sdl_window_info *window);
|
static void drawsdl2_destroy_all_textures(sdl_window_info *window);
|
||||||
static void drawsdl2_window_clear(sdl_window_info *window);
|
static void drawsdl2_window_clear(sdl_window_info *window);
|
||||||
static int drawsdl2_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
static int drawsdl2_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
||||||
@ -559,7 +559,7 @@ static void drawsdl2_attach(sdl_draw_info *info, sdl_window_info *window)
|
|||||||
// fill in the callbacks
|
// fill in the callbacks
|
||||||
window->create = drawsdl2_window_create;
|
window->create = drawsdl2_window_create;
|
||||||
window->resize = drawsdl2_window_resize;
|
window->resize = drawsdl2_window_resize;
|
||||||
window->get_primitives = drawsdl2_window_get_primitives;
|
window->set_target_bounds = drawsdl2_set_target_bounds;
|
||||||
window->draw = drawsdl2_window_draw;
|
window->draw = drawsdl2_window_draw;
|
||||||
window->destroy = drawsdl2_window_destroy;
|
window->destroy = drawsdl2_window_destroy;
|
||||||
window->destroy_all_textures = drawsdl2_destroy_all_textures;
|
window->destroy_all_textures = drawsdl2_destroy_all_textures;
|
||||||
@ -687,18 +687,9 @@ static int drawsdl2_xy_to_render_target(sdl_window_info *window, int x, int y, i
|
|||||||
// drawsdl2_window_get_primitives
|
// drawsdl2_window_get_primitives
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
static render_primitive_list &drawsdl2_window_get_primitives(sdl_window_info *window)
|
static void drawsdl2_set_target_bounds(sdl_window_info *window)
|
||||||
{
|
{
|
||||||
if ((!window->fullscreen()) || (video_config.switchres))
|
|
||||||
{
|
|
||||||
window->blit_surface_size(window->width, window->height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
window->blit_surface_size(window->monitor()->center_width, window->monitor()->center_height);
|
|
||||||
}
|
|
||||||
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
|
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
|
||||||
return window->target->get_primitives();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
@ -367,7 +367,7 @@ static int drawogl_window_create(sdl_window_info *window, int width, int height)
|
|||||||
static void drawogl_window_resize(sdl_window_info *window, int width, int height);
|
static void drawogl_window_resize(sdl_window_info *window, int width, int height);
|
||||||
static void drawogl_window_destroy(sdl_window_info *window);
|
static void drawogl_window_destroy(sdl_window_info *window);
|
||||||
static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
||||||
static render_primitive_list &drawogl_window_get_primitives(sdl_window_info *window);
|
static void drawogl_set_target_bounds(sdl_window_info *window);
|
||||||
static void drawogl_destroy_all_textures(sdl_window_info *window);
|
static void drawogl_destroy_all_textures(sdl_window_info *window);
|
||||||
static void drawogl_window_clear(sdl_window_info *window);
|
static void drawogl_window_clear(sdl_window_info *window);
|
||||||
static int drawogl_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
static int drawogl_xy_to_render_target(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
||||||
@ -454,7 +454,7 @@ static void drawogl_attach(sdl_draw_info *info, sdl_window_info *window)
|
|||||||
// fill in the callbacks
|
// fill in the callbacks
|
||||||
window->create = drawogl_window_create;
|
window->create = drawogl_window_create;
|
||||||
window->resize = drawogl_window_resize;
|
window->resize = drawogl_window_resize;
|
||||||
window->get_primitives = drawogl_window_get_primitives;
|
window->set_target_bounds = drawogl_set_target_bounds;
|
||||||
window->draw = drawogl_window_draw;
|
window->draw = drawogl_window_draw;
|
||||||
window->destroy = drawogl_window_destroy;
|
window->destroy = drawogl_window_destroy;
|
||||||
window->destroy_all_textures = drawogl_destroy_all_textures;
|
window->destroy_all_textures = drawogl_destroy_all_textures;
|
||||||
@ -840,18 +840,9 @@ static int drawogl_xy_to_render_target(sdl_window_info *window, int x, int y, in
|
|||||||
// drawogl_window_get_primitives
|
// drawogl_window_get_primitives
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
static render_primitive_list &drawogl_window_get_primitives(sdl_window_info *window)
|
static void drawogl_set_target_bounds(sdl_window_info *window)
|
||||||
{
|
{
|
||||||
if ((!window->fullscreen()) || (video_config.switchres))
|
|
||||||
{
|
|
||||||
window->blit_surface_size(window->width, window->height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
window->blit_surface_size(window->monitor()->center_width, window->monitor()->center_height);
|
|
||||||
}
|
|
||||||
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
|
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
|
||||||
return window->target->get_primitives();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
@ -105,7 +105,7 @@ static void drawsdl_attach(sdl_draw_info *info, sdl_window_info *window);
|
|||||||
static int drawsdl_window_create(sdl_window_info *window, int width, int height);
|
static int drawsdl_window_create(sdl_window_info *window, int width, int height);
|
||||||
static void drawsdl_window_resize(sdl_window_info *window, int width, int height);
|
static void drawsdl_window_resize(sdl_window_info *window, int width, int height);
|
||||||
static void drawsdl_window_destroy(sdl_window_info *window);
|
static void drawsdl_window_destroy(sdl_window_info *window);
|
||||||
static render_primitive_list &drawsdl_window_get_primitives(sdl_window_info *window);
|
static void drawsdl_set_target_bounds(sdl_window_info *window);
|
||||||
static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update);
|
||||||
static void drawsdl_destroy_all_textures(sdl_window_info *window);
|
static void drawsdl_destroy_all_textures(sdl_window_info *window);
|
||||||
static void drawsdl_window_clear(sdl_window_info *window);
|
static void drawsdl_window_clear(sdl_window_info *window);
|
||||||
@ -221,7 +221,7 @@ static void drawsdl_attach(sdl_draw_info *info, sdl_window_info *window)
|
|||||||
// fill in the callbacks
|
// fill in the callbacks
|
||||||
window->create = drawsdl_window_create;
|
window->create = drawsdl_window_create;
|
||||||
window->resize = drawsdl_window_resize;
|
window->resize = drawsdl_window_resize;
|
||||||
window->get_primitives = drawsdl_window_get_primitives;
|
window->set_target_bounds = drawsdl_set_target_bounds;
|
||||||
window->draw = drawsdl_window_draw;
|
window->draw = drawsdl_window_draw;
|
||||||
window->destroy = drawsdl_window_destroy;
|
window->destroy = drawsdl_window_destroy;
|
||||||
window->destroy_all_textures = drawsdl_destroy_all_textures;
|
window->destroy_all_textures = drawsdl_destroy_all_textures;
|
||||||
@ -460,8 +460,7 @@ static int drawsdl_window_create(sdl_window_info *window, int width, int height)
|
|||||||
|
|
||||||
if (!found)
|
if (!found)
|
||||||
{
|
{
|
||||||
osd_printf_verbose("window: Scale mode %s not supported!\n", sm->name);
|
fatalerror("window: Scale mode %s not supported!", sm->name);
|
||||||
window->machine().ui().popup_time(3, "Scale mode %s not supported!", sm->name);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -618,26 +617,15 @@ static int drawsdl_xy_to_render_target(sdl_window_info *window, int x, int y, in
|
|||||||
// drawsdl_window_get_primitives
|
// drawsdl_window_get_primitives
|
||||||
//============================================================
|
//============================================================
|
||||||
|
|
||||||
static render_primitive_list &drawsdl_window_get_primitives(sdl_window_info *window)
|
static void drawsdl_set_target_bounds(sdl_window_info *window)
|
||||||
{
|
{
|
||||||
sdl_info *sdl = (sdl_info *) window->dxdata;
|
sdl_info *sdl = (sdl_info *) window->dxdata;
|
||||||
const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
|
const sdl_scale_mode *sm = &scale_modes[video_config.scale_mode];
|
||||||
|
|
||||||
if ((!window->fullscreen()) || (video_config.switchres))
|
|
||||||
{
|
|
||||||
window->blit_surface_size(window->width, window->height);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
window->blit_surface_size(window->monitor()->center_width, window->monitor()->center_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sm->is_scale)
|
if (!sm->is_scale)
|
||||||
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
|
window->target->set_bounds(window->blitwidth, window->blitheight, sdlvideo_monitor_get_aspect(window->monitor()));
|
||||||
else
|
else
|
||||||
window->target->set_bounds(sdl->hw_scale_width, sdl->hw_scale_height);
|
window->target->set_bounds(sdl->hw_scale_width, sdl->hw_scale_height);
|
||||||
|
|
||||||
return window->target->get_primitives();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//============================================================
|
//============================================================
|
||||||
|
@ -687,7 +687,7 @@ static void worker_thread_process(osd_work_queue *queue, work_thread_info *threa
|
|||||||
// loop until everything is processed
|
// loop until everything is processed
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
osd_work_item *item;
|
osd_work_item *item = NULL;
|
||||||
|
|
||||||
bool end_loop = false;
|
bool end_loop = false;
|
||||||
|
|
||||||
@ -767,4 +767,4 @@ bool queue_has_list_items(osd_work_queue *queue)
|
|||||||
osd_scalable_lock_release(queue->lock, lockslot);
|
osd_scalable_lock_release(queue->lock, lockslot);
|
||||||
return has_list_items;
|
return has_list_items;
|
||||||
}
|
}
|
||||||
#endif // SDLMAME_NOASM
|
#endif // SDLMAME_NOASM
|
||||||
|
@ -109,8 +109,8 @@ struct worker_param {
|
|||||||
: m_window(awindow), m_list(NULL), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
|
: m_window(awindow), m_list(NULL), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
worker_param(running_machine &amachine, sdl_window_info *awindow, render_primitive_list *alist)
|
worker_param(running_machine &amachine, sdl_window_info *awindow, render_primitive_list &alist)
|
||||||
: m_window(awindow), m_list(alist), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
|
: m_window(awindow), m_list(&alist), m_machine(&amachine), m_resize_new_width(0), m_resize_new_height(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
worker_param(sdl_window_info *awindow, int anew_width, int anew_height)
|
worker_param(sdl_window_info *awindow, int anew_width, int anew_height)
|
||||||
@ -980,8 +980,19 @@ void sdl_window_info::video_window_update(running_machine &machine)
|
|||||||
|
|
||||||
if (osd_event_wait(rendered_event, event_wait_ticks))
|
if (osd_event_wait(rendered_event, event_wait_ticks))
|
||||||
{
|
{
|
||||||
|
if ((!fullscreen()) || (video_config.switchres))
|
||||||
|
{
|
||||||
|
blit_surface_size(width, height);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
blit_surface_size(monitor()->center_width, monitor()->center_height);
|
||||||
|
}
|
||||||
|
|
||||||
// ensure the target bounds are up-to-date, and then get the primitives
|
// ensure the target bounds are up-to-date, and then get the primitives
|
||||||
render_primitive_list *primlist = &get_primitives(this);
|
set_target_bounds(this);
|
||||||
|
|
||||||
|
render_primitive_list &primlist = target->get_primitives();
|
||||||
|
|
||||||
// and redraw now
|
// and redraw now
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ struct sdl_window_info
|
|||||||
int (*create)(sdl_window_info *window, int width, int height);
|
int (*create)(sdl_window_info *window, int width, int height);
|
||||||
void (*resize)(sdl_window_info *window, int width, int height);
|
void (*resize)(sdl_window_info *window, int width, int height);
|
||||||
int (*draw)(sdl_window_info *window, UINT32 dc, int update);
|
int (*draw)(sdl_window_info *window, UINT32 dc, int update);
|
||||||
render_primitive_list &(*get_primitives)(sdl_window_info *window);
|
void (*set_target_bounds)(sdl_window_info *window);
|
||||||
int (*xy_to_render_target)(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
int (*xy_to_render_target)(sdl_window_info *window, int x, int y, int *xt, int *yt);
|
||||||
void (*destroy_all_textures)(sdl_window_info *window);
|
void (*destroy_all_textures)(sdl_window_info *window);
|
||||||
void (*destroy)(sdl_window_info *window);
|
void (*destroy)(sdl_window_info *window);
|
||||||
|
Loading…
Reference in New Issue
Block a user