Converted render.c objects into C++ objects. Updated all callers.

This commit is contained in:
Aaron Giles 2010-10-13 06:20:10 +00:00
parent f391c5f8d7
commit 3beb0ec246
52 changed files with 3873 additions and 4020 deletions

View File

@ -522,7 +522,7 @@ void cheat_render_text(running_machine *machine, render_container *container)
{ {
/* output the text */ /* output the text */
ui_draw_text_full(container, cheatinfo->output[linenum], ui_draw_text_full(container, cheatinfo->output[linenum],
0.0f, (float)linenum * ui_get_line_height(), 1.0f, 0.0f, (float)linenum * ui_get_line_height(*machine), 1.0f,
cheatinfo->justify[linenum], WRAP_NEVER, DRAW_OPAQUE, cheatinfo->justify[linenum], WRAP_NEVER, DRAW_OPAQUE,
ARGB_WHITE, ARGB_BLACK, NULL, NULL); ARGB_WHITE, ARGB_BLACK, NULL, NULL);
} }
@ -901,7 +901,7 @@ static void cheat_frame(running_machine &machine)
/* set up for accumulating output */ /* set up for accumulating output */
cheatinfo->lastline = 0; cheatinfo->lastline = 0;
cheatinfo->numlines = floor(1.0f / ui_get_line_height()); cheatinfo->numlines = floor(1.0f / ui_get_line_height(machine));
cheatinfo->numlines = MIN(cheatinfo->numlines, ARRAY_LENGTH(cheatinfo->output)); cheatinfo->numlines = MIN(cheatinfo->numlines, ARRAY_LENGTH(cheatinfo->output));
for (linenum = 0; linenum < ARRAY_LENGTH(cheatinfo->output); linenum++) for (linenum = 0; linenum < ARRAY_LENGTH(cheatinfo->output); linenum++)
cheatinfo->output[linenum].reset(); cheatinfo->output[linenum].reset();

View File

@ -196,8 +196,8 @@ static void create_bitmap(running_machine *machine, int player)
} }
/* create a texture to reference the bitmap */ /* create a texture to reference the bitmap */
global.texture[player] = render_texture_alloc(render_texture_hq_scale, NULL); global.texture[player] = machine->render().texture_alloc(render_texture::hq_scale);
render_texture_set_bitmap(global.texture[player], global.bitmap[player], NULL, TEXFORMAT_ARGB32, NULL); global.texture[player]->set_bitmap(global.bitmap[player], NULL, TEXFORMAT_ARGB32);
} }
@ -263,8 +263,7 @@ static void crosshair_exit(running_machine &machine)
/* free bitmaps and textures for each player */ /* free bitmaps and textures for each player */
for (player = 0; player < MAX_PLAYERS; player++) for (player = 0; player < MAX_PLAYERS; player++)
{ {
if (global.texture[player] != NULL) machine.render().texture_free(global.texture[player]);
render_texture_free(global.texture[player]);
global.texture[player] = NULL; global.texture[player] = NULL;
global_free(global.bitmap[player]); global_free(global.bitmap[player]);
@ -396,11 +395,10 @@ void crosshair_render(screen_device &screen)
((global.screen[player] == &screen) || (global.screen[player] == CROSSHAIR_SCREEN_ALL))) ((global.screen[player] == &screen) || (global.screen[player] == CROSSHAIR_SCREEN_ALL)))
{ {
/* add a quad assuming a 4:3 screen (this is not perfect) */ /* add a quad assuming a 4:3 screen (this is not perfect) */
render_screen_add_quad(&screen, screen.container().add_quad(global.x[player] - 0.03f, global.y[player] - 0.04f,
global.x[player] - 0.03f, global.y[player] - 0.04f, global.x[player] + 0.03f, global.y[player] + 0.04f,
global.x[player] + 0.03f, global.y[player] + 0.04f, MAKE_ARGB(0xc0, global.fade, global.fade, global.fade),
MAKE_ARGB(0xc0, global.fade, global.fade, global.fade), global.texture[player], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
global.texture[player], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
} }

View File

@ -1114,7 +1114,7 @@ static void execute_comment(running_machine *machine, int ref, int params, const
/* Now try adding the comment */ /* Now try adding the comment */
cpu->debug()->comment_add(address, param[1], 0x00ff0000); cpu->debug()->comment_add(address, param[1], 0x00ff0000);
cpu->machine->m_debug_view->update_all(DVT_DISASSEMBLY); cpu->machine->debug_view().update_all(DVT_DISASSEMBLY);
} }
@ -1138,7 +1138,7 @@ static void execute_comment_del(running_machine *machine, int ref, int params, c
/* If it's a number, it must be an address */ /* If it's a number, it must be an address */
/* The bankoff and cbn will be pulled from what's currently active */ /* The bankoff and cbn will be pulled from what's currently active */
cpu->debug()->comment_remove(address); cpu->debug()->comment_remove(address);
cpu->machine->m_debug_view->update_all(DVT_DISASSEMBLY); cpu->machine->debug_view().update_all(DVT_DISASSEMBLY);
} }
@ -2427,9 +2427,9 @@ static void execute_snap(running_machine *machine, int ref, int params, const ch
const char *filename = param[0]; const char *filename = param[0];
int scrnum = (params > 1) ? atoi(param[1]) : 0; int scrnum = (params > 1) ? atoi(param[1]) : 0;
device_t *screen = machine->m_devicelist.find(SCREEN, scrnum); screen_device *screen = downcast<screen_device *>(machine->m_devicelist.find(SCREEN, scrnum));
if ((screen == NULL) || !render_is_live_screen(screen)) if ((screen == NULL) || !machine->render().is_live(*screen))
{ {
debug_console_printf(machine, "Invalid screen number '%d'\n", scrnum); debug_console_printf(machine, "Invalid screen number '%d'\n", scrnum);
return; return;

View File

@ -382,7 +382,7 @@ CMDERR debug_console_execute_command(running_machine *machine, const char *comma
/* update all views */ /* update all views */
if (echo) if (echo)
{ {
machine->m_debug_view->update_all(); machine->debug_view().update_all();
debugger_refresh_display(machine); debugger_refresh_display(machine);
} }
return result; return result;
@ -481,7 +481,7 @@ void CLIB_DECL debug_console_printf(running_machine *machine, const char *format
text_buffer_print(console_textbuf, buffer); text_buffer_print(console_textbuf, buffer);
/* force an update of any console views */ /* force an update of any console views */
machine->m_debug_view->update_all(DVT_CONSOLE); machine->debug_view().update_all(DVT_CONSOLE);
} }
@ -499,7 +499,7 @@ void CLIB_DECL debug_console_vprintf(running_machine *machine, const char *forma
text_buffer_print(console_textbuf, buffer); text_buffer_print(console_textbuf, buffer);
/* force an update of any console views */ /* force an update of any console views */
machine->m_debug_view->update_all(DVT_CONSOLE); machine->debug_view().update_all(DVT_CONSOLE);
} }
@ -521,7 +521,7 @@ void CLIB_DECL debug_console_printf_wrap(running_machine *machine, int wrapcol,
text_buffer_print_wrap(console_textbuf, buffer, wrapcol); text_buffer_print_wrap(console_textbuf, buffer, wrapcol);
/* force an update of any console views */ /* force an update of any console views */
machine->m_debug_view->update_all(DVT_CONSOLE); machine->debug_view().update_all(DVT_CONSOLE);
} }
@ -547,7 +547,7 @@ void debug_errorlog_write_line(running_machine &machine, const char *line)
text_buffer_print(errorlog_textbuf, line); text_buffer_print(errorlog_textbuf, line);
/* force an update of any log views */ /* force an update of any log views */
machine.m_debug_view->update_all(DVT_LOG); machine.debug_view().update_all(DVT_LOG);
} }

View File

@ -1813,8 +1813,8 @@ void device_debug::start_hook(attotime endtime)
// check for periodic updates // check for periodic updates
if (&m_device == global->visiblecpu && osd_ticks() > global->last_periodic_update_time + osd_ticks_per_second()/4) if (&m_device == global->visiblecpu && osd_ticks() > global->last_periodic_update_time + osd_ticks_per_second()/4)
{ {
m_device.machine->m_debug_view->update_all(); m_device.machine->debug_view().update_all();
m_device.machine->m_debug_view->flush_osd_updates(); m_device.machine->debug_view().flush_osd_updates();
global->last_periodic_update_time = osd_ticks(); global->last_periodic_update_time = osd_ticks();
} }
@ -1949,8 +1949,8 @@ void device_debug::instruction_hook(offs_t curpc)
// update every 100 steps until we are within 200 of the end // update every 100 steps until we are within 200 of the end
else if ((m_flags & DEBUG_FLAG_STEPPING_OUT) == 0 && (m_stepsleft < 200 || m_stepsleft % 100 == 0)) else if ((m_flags & DEBUG_FLAG_STEPPING_OUT) == 0 && (m_stepsleft < 200 || m_stepsleft % 100 == 0))
{ {
m_device.machine->m_debug_view->update_all(); m_device.machine->debug_view().update_all();
m_device.machine->m_debug_view->flush_osd_updates(); m_device.machine->debug_view().flush_osd_updates();
debugger_refresh_display(m_device.machine); debugger_refresh_display(m_device.machine);
} }
} }
@ -1998,7 +1998,7 @@ void device_debug::instruction_hook(offs_t curpc)
global->visiblecpu = &m_device; global->visiblecpu = &m_device;
// update all views // update all views
m_device.machine->m_debug_view->update_all(); m_device.machine->debug_view().update_all();
debugger_refresh_display(m_device.machine); debugger_refresh_display(m_device.machine);
// wait for the debugger; during this time, disable sound output // wait for the debugger; during this time, disable sound output
@ -2006,7 +2006,7 @@ void device_debug::instruction_hook(offs_t curpc)
while (global->execution_state == EXECUTION_STATE_STOPPED) while (global->execution_state == EXECUTION_STATE_STOPPED)
{ {
// flush any pending updates before waiting again // flush any pending updates before waiting again
m_device.machine->m_debug_view->flush_osd_updates(); m_device.machine->debug_view().flush_osd_updates();
// clear the memory modified flag and wait // clear the memory modified flag and wait
global->memory_modified = false; global->memory_modified = false;
@ -2019,7 +2019,7 @@ void device_debug::instruction_hook(offs_t curpc)
// if something modified memory, update the screen // if something modified memory, update the screen
if (global->memory_modified) if (global->memory_modified)
{ {
m_device.machine->m_debug_view->update_all(DVT_DISASSEMBLY); m_device.machine->debug_view().update_all(DVT_DISASSEMBLY);
debugger_refresh_display(m_device.machine); debugger_refresh_display(m_device.machine);
} }

View File

@ -159,8 +159,8 @@ public:
{ {
this->target = target; this->target = target;
//dv->container = render_target_get_component_container(target, name, &pos); //dv->container = render_target_get_component_container(target, name, &pos);
this->container = render_debug_alloc(target); this->container = target->debug_alloc();
this->view = machine->m_debug_view->alloc_view(type, dview_update, this); this->view = machine->debug_view().alloc_view(type, dview_update, this);
this->type = type; this->type = type;
this->machine = machine; this->machine = machine;
this->state = flags | VIEW_STATE_NEEDS_UPDATE; this->state = flags | VIEW_STATE_NEEDS_UPDATE;
@ -185,8 +185,8 @@ public:
} }
~DView() ~DView()
{ {
render_debug_free(this->target, this->container); this->target->debug_free(*this->container);
machine->m_debug_view->free_view(*this->view); machine->debug_view().free_view(*this->view);
} }
DView * next; DView * next;
@ -295,7 +295,7 @@ static void set_focus_view(DView *dv)
focus_view = dv; focus_view = dv;
LIST_REMOVE(list, dv, DView); LIST_REMOVE(list, dv, DView);
LIST_ADD_FRONT(list, dv, DView); LIST_ADD_FRONT(list, dv, DView);
render_debug_top(dv->target, dv->container); dv->target->debug_top(*dv->container);
} }
} }
@ -364,7 +364,7 @@ static void dview_get_rect(DView *dv, int type, rectangle *rect)
static void dview_clear(DView *dv) static void dview_clear(DView *dv)
{ {
render_container_empty(dv->container); dv->container->empty();
} }
static void dview_draw_outlined_box(DView *dv, int rtype, int x, int y, int w, int h, rgb_t bg) static void dview_draw_outlined_box(DView *dv, int rtype, int x, int y, int w, int h, rgb_t bg)
@ -381,7 +381,7 @@ static void dview_draw_box(DView *dv, int rtype, int x, int y, int w, int h, rgb
rectangle r; rectangle r;
dview_get_rect(dv, rtype, &r); dview_get_rect(dv, rtype, &r);
render_container_add_rect(dv->container, NX(dv, x + r.min_x), NY(dv, y + r.min_y), dv->container->add_rect(NX(dv, x + r.min_x), NY(dv, y + r.min_y),
NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), col, NX(dv, x + r.min_x + w), NY(dv, y + r.min_y + h), col,
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
@ -391,14 +391,14 @@ static void dview_draw_char(DView *dv, int rtype, int x, int y, int h, rgb_t col
rectangle r; rectangle r;
dview_get_rect(dv, rtype, &r); dview_get_rect(dv, rtype, &r);
render_container_add_char(dv->container, dv->container->add_char(
NX(dv, x + r.min_x), NX(dv, x + r.min_x),
NY(dv, y + r.min_y), NY(dv, y + r.min_y),
NY(dv, h), NY(dv, h),
debug_font_aspect, debug_font_aspect,
//(float) rect_get_height(&dv->bounds) / (float) rect_get_width(&dv->bounds), //render_get_ui_aspect(), //(float) rect_get_height(&dv->bounds) / (float) rect_get_width(&dv->bounds), //render_get_ui_aspect(),
col, col,
debug_font, *debug_font,
ch); ch);
} }
@ -777,15 +777,15 @@ static void dview_draw(DView *dv)
static void dview_size_allocate(DView *dv) static void dview_size_allocate(DView *dv)
{ {
debug_view_xy size, pos, col, vsize; debug_view_xy size, pos, col, vsize;
render_container_user_settings rcus; render_container::user_settings rcus;
rectangle r; rectangle r;
render_container_get_user_settings(dv->container, &rcus); dv->container->get_user_settings(rcus);
rcus.xoffset = (float) dv->ofs_x / (float) dv->rt_width; rcus.m_xoffset = (float) dv->ofs_x / (float) dv->rt_width;
rcus.yoffset = (float) dv->ofs_y / (float) dv->rt_height; rcus.m_yoffset = (float) dv->ofs_y / (float) dv->rt_height;
rcus.xscale = 1.0; //(float) rect_get_width(&dv->bounds) / (float) dv->rt_width; rcus.m_xscale = 1.0; //(float) rect_get_width(&dv->bounds) / (float) dv->rt_width;
rcus.yscale = 1.0; //(float) rect_get_height(&dv->bounds) / (float) dv->rt_height; rcus.m_yscale = 1.0; //(float) rect_get_height(&dv->bounds) / (float) dv->rt_height;
render_container_set_user_settings(dv->container, &rcus); dv->container->set_user_settings(rcus);
//printf("%d %d %d %d\n", wpos.min_x, wpos.max_x, wpos.min_y, wpos.max_y); //printf("%d %d %d %d\n", wpos.min_x, wpos.max_x, wpos.min_y, wpos.max_y);
pos = dv->view->visible_position(); pos = dv->view->visible_position();
@ -899,7 +899,7 @@ void debugint_init(running_machine *machine)
{ {
unicode_char ch; unicode_char ch;
int chw; int chw;
debug_font = render_font_alloc("ui.bdf"); //ui_get_font(); debug_font = render_font_alloc(*machine, "ui.bdf"); //ui_get_font();
debug_font_width = 0; debug_font_width = 0;
debug_font_height = 15; debug_font_height = 15;
@ -908,7 +908,7 @@ void debugint_init(running_machine *machine)
list = NULL; list = NULL;
focus_view = NULL; focus_view = NULL;
debug_font_aspect = render_get_ui_aspect(); debug_font_aspect = machine->render().ui_aspect();
for (ch=0;ch<=127;ch++) for (ch=0;ch<=127;ch++)
{ {
@ -930,14 +930,14 @@ static void set_view_by_name(render_target *target, const char *name)
for (i = 0; ; i++ ) for (i = 0; ; i++ )
{ {
s = render_target_get_view_name(target, i); s = target->view_name(i);
if (s == NULL) if (s == NULL)
return; return;
//printf("%d %s\n", i, s); //printf("%d %s\n", i, s);
if (strcmp(name, s) == 0) if (strcmp(name, s) == 0)
{ {
render_target_set_view(target, i); target->set_view(i);
//printf("%d\n", render_target_get_view(target) ); //printf("%d\n", target->view() );
return; return;
} }
} }
@ -977,11 +977,11 @@ static void on_disassembly_window_activate(DView *dv, const ui_menu_event *event
render_target *target; render_target *target;
const debug_view_source *source; const debug_view_source *source;
target = render_get_ui_target(); target = &dv->machine->render().ui_target();
ndv = dview_alloc(target, dv->machine, DVT_DISASSEMBLY, 0); ndv = dview_alloc(target, dv->machine, DVT_DISASSEMBLY, 0);
ndv->editor.active = TRUE; ndv->editor.active = TRUE;
ndv->editor.container = render_container_get_ui(); ndv->editor.container = &dv->machine->render().ui_container();
source = ndv->view->source(); source = ndv->view->source();
dview_set_title(ndv, source->name()); dview_set_title(ndv, source->name());
set_focus_view(ndv); set_focus_view(ndv);
@ -1010,7 +1010,7 @@ static void on_log_window_activate(DView *dv, const ui_menu_event *event)
DView *ndv; DView *ndv;
render_target *target; render_target *target;
target = render_get_ui_target(); target = &dv->machine->render().ui_target();
ndv = dview_alloc(target, dv->machine, DVT_LOG, 0); ndv = dview_alloc(target, dv->machine, DVT_LOG, 0);
dview_set_title(ndv, "Log"); dview_set_title(ndv, "Log");
set_focus_view(ndv); set_focus_view(ndv);
@ -1125,7 +1125,7 @@ static void render_editor(DView_edit *editor)
float width, maxwidth; float width, maxwidth;
float x1, y1, x2, y2; float x1, y1, x2, y2;
render_container_empty(editor->container); editor->container->empty();
/* get the size of the text */ /* get the size of the text */
ui_draw_text_full(editor->container, editor->str, 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE, ui_draw_text_full(editor->container, editor->str, 0.0f, 0.0f, 1.0f, JUSTIFY_CENTER, WRAP_TRUNCATE,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL); DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &width, NULL);
@ -1165,7 +1165,7 @@ static void CreateMainMenu(running_machine *machine)
if (menu != NULL) if (menu != NULL)
ui_menu_free(menu); ui_menu_free(menu);
menu = ui_menu_alloc(machine, render_container_get_ui(),NULL,NULL); menu = ui_menu_alloc(machine, &machine->render().ui_container(),NULL,NULL);
switch (focus_view->type) switch (focus_view->type)
{ {
@ -1348,7 +1348,7 @@ static void handle_menus(running_machine *machine)
{ {
const ui_menu_event *event; const ui_menu_event *event;
render_container_empty(render_container_get_ui()); machine->render().ui_container().empty();
ui_input_frame_update(*machine); ui_input_frame_update(*machine);
if (menu != NULL) if (menu != NULL)
{ {
@ -1414,7 +1414,8 @@ static void dview_update_view(DView *dv)
INT32 old_rt_width = dv->rt_width; INT32 old_rt_width = dv->rt_width;
INT32 old_rt_height = dv->rt_height; INT32 old_rt_height = dv->rt_height;
render_target_get_bounds(dv->target, &dv->rt_width, &dv->rt_height, NULL); dv->rt_width = dv->target->width();
dv->rt_height = dv->target->height();
if (dview_is_state(dv, VIEW_STATE_NEEDS_UPDATE) || dv->rt_width != old_rt_width || dv->rt_height != old_rt_height) if (dview_is_state(dv, VIEW_STATE_NEEDS_UPDATE) || dv->rt_width != old_rt_width || dv->rt_height != old_rt_height)
{ {
dview_size_allocate(dv); dview_size_allocate(dv);
@ -1446,24 +1447,24 @@ void debugint_wait_for_debugger(running_device *device, int firststop)
DView *dv; DView *dv;
render_target *target; render_target *target;
target = render_get_ui_target(); target = &device->machine->render().ui_target();
//set_view_by_name(target, "Debug"); //set_view_by_name(target, "Debug");
dv = dview_alloc(target, device->machine, DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU); dv = dview_alloc(target, device->machine, DVT_DISASSEMBLY, VIEW_STATE_FOLLOW_CPU);
dv->editor.active = TRUE; dv->editor.active = TRUE;
dv->editor.container = render_container_get_ui(); dv->editor.container = &device->machine->render().ui_container();
dv = dview_alloc(target, device->machine, DVT_STATE, VIEW_STATE_FOLLOW_CPU); dv = dview_alloc(target, device->machine, DVT_STATE, VIEW_STATE_FOLLOW_CPU);
dv = dview_alloc(target, device->machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU); dv = dview_alloc(target, device->machine, DVT_CONSOLE, VIEW_STATE_FOLLOW_CPU);
dview_set_title(dv, "Console"); dview_set_title(dv, "Console");
dv->editor.active = TRUE; dv->editor.active = TRUE;
dv->editor.container = render_container_get_ui(); dv->editor.container = &device->machine->render().ui_container();
set_focus_view(dv); set_focus_view(dv);
} }
followers_set_cpu(device); followers_set_cpu(device);
//ui_update_and_render(device->machine, render_container_get_ui()); //ui_update_and_render(device->machine, &device->machine->render().ui_container()());
update_views(); update_views();
osd_update(device->machine, FALSE); osd_update(device->machine, FALSE);
handle_menus(device->machine); handle_menus(device->machine);

View File

@ -23,7 +23,7 @@
static MACHINE_START( empty ) static MACHINE_START( empty )
{ {
/* force the UI to show the game select screen */ /* force the UI to show the game select screen */
ui_menu_force_game_select(machine, render_container_get_ui()); ui_menu_force_game_select(machine, &machine->render().ui_container());
} }

View File

@ -77,11 +77,11 @@ public:
void * m_base; // base of the allocation void * m_base; // base of the allocation
const char * m_file; // file the allocation was made from const char * m_file; // file the allocation was made from
int m_line; // line number within that file int m_line; // line number within that file
int m_id; // unique id UINT64 m_id; // unique id
static const int k_hash_prime = 193; static const int k_hash_prime = 193;
static int s_curid; // current ID static UINT64 s_curid; // current ID
static osd_lock * s_lock; // lock for managing the list static osd_lock * s_lock; // lock for managing the list
static bool s_lock_alloc; // set to true temporarily during lock allocation static bool s_lock_alloc; // set to true temporarily during lock allocation
static memory_entry *s_hash[k_hash_prime];// hash table based on pointer static memory_entry *s_hash[k_hash_prime];// hash table based on pointer
@ -110,7 +110,7 @@ resource_pool global_resource_pool;
const zeromem_t zeromem = { }; const zeromem_t zeromem = { };
// globals for memory_entry // globals for memory_entry
int memory_entry::s_curid = 0; UINT64 memory_entry::s_curid = 0;
osd_lock *memory_entry::s_lock = NULL; osd_lock *memory_entry::s_lock = NULL;
bool memory_entry::s_lock_alloc = false; bool memory_entry::s_lock_alloc = false;
memory_entry *memory_entry::s_hash[memory_entry::k_hash_prime] = { NULL }; memory_entry *memory_entry::s_hash[memory_entry::k_hash_prime] = { NULL };
@ -134,10 +134,10 @@ void *malloc_file_line(size_t size, const char *file, int line)
if (result == NULL) if (result == NULL)
return NULL; return NULL;
#ifdef MAME_DEBUG
// add a new entry // add a new entry
memory_entry::allocate(size, result, file, line); memory_entry::allocate(size, result, file, line);
#ifdef MAME_DEBUG
// randomize the memory // randomize the memory
rand_memory(result, size); rand_memory(result, size);
#endif #endif
@ -153,7 +153,6 @@ void *malloc_file_line(size_t size, const char *file, int line)
void free_file_line(void *memory, const char *file, int line) void free_file_line(void *memory, const char *file, int line)
{ {
#ifdef MAME_DEBUG
// find the memory entry // find the memory entry
memory_entry *entry = memory_entry::find(memory); memory_entry *entry = memory_entry::find(memory);
@ -165,6 +164,7 @@ void free_file_line(void *memory, const char *file, int line)
return; return;
} }
#ifdef MAME_DEBUG
// clear memory to a bogus value // clear memory to a bogus value
memset(memory, 0xfc, entry->m_size); memset(memory, 0xfc, entry->m_size);
@ -236,15 +236,42 @@ void resource_pool::add(resource_pool_item &item)
int hashval = reinterpret_cast<FPTR>(item.m_ptr) % k_hash_prime; int hashval = reinterpret_cast<FPTR>(item.m_ptr) % k_hash_prime;
item.m_next = m_hash[hashval]; item.m_next = m_hash[hashval];
m_hash[hashval] = &item; m_hash[hashval] = &item;
// insert into ordered list // fetch the ID of this item's pointer; some implementations put hidden data
item.m_ordered_next = NULL; // before, so if we don't find it, check 4 bytes ahead
item.m_ordered_prev = m_ordered_tail; memory_entry *entry = memory_entry::find(item.m_ptr);
if (m_ordered_tail != NULL) if (entry == NULL)
m_ordered_tail->m_ordered_next = &item; entry = memory_entry::find(reinterpret_cast<UINT8 *>(item.m_ptr) - sizeof(size_t));
m_ordered_tail = &item; assert(entry != NULL);
if (m_ordered_head == NULL) item.m_id = entry->m_id;
// find the entry to insert after
resource_pool_item *insert_after;
for (insert_after = m_ordered_tail; insert_after != NULL; insert_after = insert_after->m_ordered_prev)
if (insert_after->m_id < item.m_id)
break;
// insert into the appropriate spot
if (insert_after != NULL)
{
item.m_ordered_next = insert_after->m_ordered_next;
if (item.m_ordered_next != NULL)
item.m_ordered_next->m_ordered_prev = &item;
else
m_ordered_tail = &item;
item.m_ordered_prev = insert_after;
insert_after->m_ordered_next = &item;
}
else
{
item.m_ordered_next = m_ordered_head;
if (item.m_ordered_next != NULL)
item.m_ordered_next->m_ordered_prev = &item;
else
m_ordered_tail = &item;
item.m_ordered_prev = NULL;
m_ordered_head = &item; m_ordered_head = &item;
}
osd_lock_release(m_listlock); osd_lock_release(m_listlock);
} }
@ -516,7 +543,7 @@ void memory_entry::report_unfreed()
if (total == 0) if (total == 0)
fprintf(stderr, "--- memory leak warning ---\n"); fprintf(stderr, "--- memory leak warning ---\n");
total += entry->m_size; total += entry->m_size;
fprintf(stderr, "allocation #%06d, %d bytes (%s:%d)\n", entry->m_id, static_cast<UINT32>(entry->m_size), entry->m_file, (int)entry->m_line); fprintf(stderr, "allocation #%06d, %d bytes (%s:%d)\n", (UINT32)entry->m_id, static_cast<UINT32>(entry->m_size), entry->m_file, (int)entry->m_line);
} }
release_lock(); release_lock();

View File

@ -87,7 +87,8 @@ public:
m_ordered_next(NULL), m_ordered_next(NULL),
m_ordered_prev(NULL), m_ordered_prev(NULL),
m_ptr(ptr), m_ptr(ptr),
m_size(size) { } m_size(size),
m_id(~(UINT64)0) { }
virtual ~resource_pool_item() { } virtual ~resource_pool_item() { }
resource_pool_item * m_next; resource_pool_item * m_next;
@ -95,6 +96,7 @@ public:
resource_pool_item * m_ordered_prev; resource_pool_item * m_ordered_prev;
void * m_ptr; void * m_ptr;
size_t m_size; size_t m_size;
UINT64 m_id;
}; };

View File

@ -381,17 +381,6 @@ public:
void reset() { while (m_head != NULL) remove(*m_head); } void reset() { while (m_head != NULL) remove(*m_head); }
int index(T *object) const
{
int num = 0;
for (T *cur = m_head; cur != NULL; cur = cur->m_next)
if (cur == object)
return num;
else
num++;
return -1;
}
T &prepend(T &object) T &prepend(T &object)
{ {
object.m_next = m_head; object.m_next = m_head;
@ -401,6 +390,20 @@ public:
m_count++; m_count++;
return object; return object;
} }
void prepend_list(simple_list<T> &list)
{
int count = list.count();
if (count == 0)
return;
T *tail = list.last();
T *head = list.detach_all();
tail->m_next = m_head;
m_head = head;
if (m_tail == NULL)
m_tail = tail;
m_count += count;
}
T &append(T &object) T &append(T &object)
{ {
@ -413,7 +416,35 @@ public:
return object; return object;
} }
void detach(T &object) void append_list(simple_list<T> &list)
{
int count = list.count();
if (count == 0)
return;
T *tail = list.last();
T *head = list.detach_all();
if (m_tail != NULL)
m_tail->m_next = head;
else
m_head = head;
m_tail = tail;
m_count += count;
}
T *detach_head()
{
T *result = m_head;
if (result != NULL)
{
m_head = result->m_next;
m_count--;
if (m_head == NULL)
m_tail = NULL;
}
return result;
}
T &detach(T &object)
{ {
T *prev = NULL; T *prev = NULL;
for (T *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next) for (T *cur = m_head; cur != NULL; prev = cur, cur = cur->m_next)
@ -426,8 +457,17 @@ public:
if (m_tail == &object) if (m_tail == &object)
m_tail = prev; m_tail = prev;
m_count--; m_count--;
return; return object;
} }
return object;
}
T *detach_all()
{
T *result = m_head;
m_head = m_tail = NULL;
m_count = 0;
return result;
} }
void remove(T &object) void remove(T &object)
@ -435,7 +475,7 @@ public:
detach(object); detach(object);
pool_free(m_pool, &object); pool_free(m_pool, &object);
} }
T *find(int index) const T *find(int index) const
{ {
for (T *cur = m_head; cur != NULL; cur = cur->m_next) for (T *cur = m_head; cur != NULL; cur = cur->m_next)
@ -443,6 +483,48 @@ public:
return cur; return cur;
return NULL; return NULL;
} }
int indexof(const T &object) const
{
int index = 0;
for (T *cur = m_head; cur != NULL; cur = cur->m_next)
{
if (cur == &object)
return index;
index++;
}
return -1;
}
};
// ======================> fixed_allocator
template<class T>
class fixed_allocator
{
DISABLE_COPYING(fixed_allocator);
public:
fixed_allocator(resource_pool &pool = global_resource_pool)
: m_pool(pool),
m_freelist(pool) { }
T *alloc()
{
T *result = m_freelist.detach_head();
if (result == NULL)
result = m_pool.add_object(new T);
return result;
}
void reclaim(T *item) { if (item != NULL) m_freelist.append(*item); }
void reclaim(T &item) { m_freelist.append(item); }
void reclaim_all(simple_list<T> &list) { m_freelist.append_list(list); }
private:
resource_pool &m_pool;
simple_list<T> m_freelist;
}; };

View File

@ -2490,7 +2490,8 @@ g_profiler.start(PROFILER_INPUT);
{ {
const char *tag = NULL; const char *tag = NULL;
input_port_value mask; input_port_value mask;
if (render_target_map_point_input(mouse_target, mouse_target_x, mouse_target_y, &tag, &mask, NULL, NULL)) float x, y;
if (mouse_target->map_point_input(mouse_target_x, mouse_target_y, tag, mask, x, y))
mouse_field = input_field_by_tag_and_mask(machine->m_portlist, tag, mask); mouse_field = input_field_by_tag_and_mask(machine->m_portlist, tag, mask);
} }

View File

@ -173,7 +173,6 @@ running_machine::running_machine(const machine_config &_config, core_options &op
generic_machine_data(NULL), generic_machine_data(NULL),
generic_video_data(NULL), generic_video_data(NULL),
generic_audio_data(NULL), generic_audio_data(NULL),
m_debug_view(NULL),
m_logerror_list(NULL), m_logerror_list(NULL),
m_scheduler(*this), m_scheduler(*this),
m_options(options), m_options(options),
@ -190,7 +189,9 @@ running_machine::running_machine(const machine_config &_config, core_options &op
m_saveload_schedule_time(attotime_zero), m_saveload_schedule_time(attotime_zero),
m_saveload_searchpath(NULL), m_saveload_searchpath(NULL),
m_rand_seed(0x9d14abd7), m_rand_seed(0x9d14abd7),
m_driver_device(NULL) m_driver_device(NULL),
m_render(NULL),
m_debug_view(NULL)
{ {
memset(gfx, 0, sizeof(gfx)); memset(gfx, 0, sizeof(gfx));
memset(&generic, 0, sizeof(generic)); memset(&generic, 0, sizeof(generic));
@ -271,7 +272,7 @@ void running_machine::start()
state_init(this); state_init(this);
state_save_allow_registration(this, true); state_save_allow_registration(this, true);
palette_init(this); palette_init(this);
render_init(this); m_render = auto_alloc(this, render_manager(*this));
ui_init(this); ui_init(this);
generic_machine_init(this); generic_machine_init(this);
generic_video_init(this); generic_video_init(this);
@ -453,7 +454,7 @@ void running_machine::schedule_exit()
if (m_exit_to_game_select && options_get_string(&m_options, OPTION_GAMENAME)[0] != 0) if (m_exit_to_game_select && options_get_string(&m_options, OPTION_GAMENAME)[0] != 0)
{ {
options_set_string(&m_options, OPTION_GAMENAME, "", OPTION_PRIORITY_CMDLINE); options_set_string(&m_options, OPTION_GAMENAME, "", OPTION_PRIORITY_CMDLINE);
ui_menu_force_game_select(this, render_container_get_ui()); ui_menu_force_game_select(this, &render().ui_container());
} }
// otherwise, exit for real // otherwise, exit for real

View File

@ -181,6 +181,7 @@ const int DEBUG_FLAG_OSD_ENABLED = 0x00001000; // The OSD debugger is enabled
class gfx_element; class gfx_element;
class colortable_t; class colortable_t;
class debug_view_manager; class debug_view_manager;
class render_manager;
typedef struct _mame_private mame_private; typedef struct _mame_private mame_private;
typedef struct _cpuexec_private cpuexec_private; typedef struct _cpuexec_private cpuexec_private;
@ -329,6 +330,8 @@ class running_machine : public bindable_object
{ {
DISABLE_COPYING(running_machine); DISABLE_COPYING(running_machine);
friend void debugger_init(running_machine *machine);
typedef void (*notify_callback)(running_machine &machine); typedef void (*notify_callback)(running_machine &machine);
typedef void (*logerror_callback)(running_machine &machine, const char *string); typedef void (*logerror_callback)(running_machine &machine, const char *string);
@ -381,6 +384,10 @@ public:
// regions // regions
region_info *region_alloc(const char *name, UINT32 length, UINT32 flags); region_info *region_alloc(const char *name, UINT32 length, UINT32 flags);
void region_free(const char *name); void region_free(const char *name);
// managers
render_manager &render() const { assert(m_render != NULL); return *m_render; }
debug_view_manager &debug_view() const { assert(m_debug_view != NULL); return *m_debug_view; }
// misc // misc
void CLIB_DECL logerror(const char *format, ...); void CLIB_DECL logerror(const char *format, ...);
@ -449,8 +456,6 @@ public:
generic_video_private * generic_video_data; // internal data from video/generic.c generic_video_private * generic_video_data; // internal data from video/generic.c
generic_audio_private * generic_audio_data; // internal data from audio/generic.c generic_audio_private * generic_audio_data; // internal data from audio/generic.c
debug_view_manager * m_debug_view; // internal data from debugvw.c
// driver-specific information // driver-specific information
driver_device *driver_data() const { return m_driver_device; } driver_device *driver_data() const { return m_driver_device; }
@ -520,6 +525,8 @@ private:
time_t m_base_time; time_t m_base_time;
driver_device * m_driver_device; driver_device * m_driver_device;
render_manager * m_render; // internal data from render.c
debug_view_manager * m_debug_view; // internal data from debugvw.c
}; };

View File

@ -1246,22 +1246,22 @@ VIDEO_UPDATE( laserdisc )
if (overbitmap != NULL) if (overbitmap != NULL)
{ {
if (overbitmap->format == BITMAP_FORMAT_INDEXED16) if (overbitmap->format == BITMAP_FORMAT_INDEXED16)
render_texture_set_bitmap(ldcore->overtex, overbitmap, &ldcore->config.overclip, TEXFORMAT_PALETTEA16, laserdisc->machine->palette); ldcore->overtex->set_bitmap(overbitmap, &ldcore->config.overclip, TEXFORMAT_PALETTEA16, laserdisc->machine->palette);
else if (overbitmap->format == BITMAP_FORMAT_RGB32) else if (overbitmap->format == BITMAP_FORMAT_RGB32)
render_texture_set_bitmap(ldcore->overtex, overbitmap, &ldcore->config.overclip, TEXFORMAT_ARGB32, NULL); ldcore->overtex->set_bitmap(overbitmap, &ldcore->config.overclip, TEXFORMAT_ARGB32);
} }
/* get the laserdisc video */ /* get the laserdisc video */
laserdisc_get_video(laserdisc, &vidbitmap); laserdisc_get_video(laserdisc, &vidbitmap);
if (vidbitmap != NULL) if (vidbitmap != NULL)
render_texture_set_bitmap(ldcore->videotex, vidbitmap, NULL, TEXFORMAT_YUY16, ldcore->videopalette); ldcore->videotex->set_bitmap(vidbitmap, NULL, TEXFORMAT_YUY16, ldcore->videopalette);
/* reset the screen contents */ /* reset the screen contents */
render_container_empty(render_container_get_screen(screen)); screen->container().empty();
/* add the video texture */ /* add the video texture */
if (ldcore->videoenable) if (ldcore->videoenable)
render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), ldcore->videotex, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); screen->container().add_quad(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), ldcore->videotex, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
/* add the overlay */ /* add the overlay */
if (ldcore->overenable && overbitmap != NULL) if (ldcore->overenable && overbitmap != NULL)
@ -1270,7 +1270,7 @@ VIDEO_UPDATE( laserdisc )
float y0 = 0.5f - 0.5f * ldcore->config.overscaley + ldcore->config.overposy; float y0 = 0.5f - 0.5f * ldcore->config.overscaley + ldcore->config.overposy;
float x1 = x0 + ldcore->config.overscalex; float x1 = x0 + ldcore->config.overscalex;
float y1 = y0 + ldcore->config.overscaley; float y1 = y0 + ldcore->config.overscaley;
render_screen_add_quad(screen, x0, y0, x1, y1, MAKE_ARGB(0xff,0xff,0xff,0xff), ldcore->overtex, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1)); screen->container().add_quad(x0, y0, x1, y1, MAKE_ARGB(0xff,0xff,0xff,0xff), ldcore->overtex, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1));
} }
/* swap to the next bitmap */ /* swap to the next bitmap */
@ -1418,7 +1418,7 @@ static void init_video(running_device *device)
/* allocate texture for rendering */ /* allocate texture for rendering */
ldcore->videoenable = TRUE; ldcore->videoenable = TRUE;
ldcore->videotex = render_texture_alloc(NULL, NULL); ldcore->videotex = device->machine->render().texture_alloc();
if (ldcore->videotex == NULL) if (ldcore->videotex == NULL)
fatalerror("Out of memory allocating video texture"); fatalerror("Out of memory allocating video texture");
@ -1435,7 +1435,7 @@ static void init_video(running_device *device)
ldcore->overenable = TRUE; ldcore->overenable = TRUE;
ldcore->overbitmap[0] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); ldcore->overbitmap[0] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat);
ldcore->overbitmap[1] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat); ldcore->overbitmap[1] = auto_bitmap_alloc(device->machine, ldcore->config.overwidth, ldcore->config.overheight, (bitmap_format)ldcore->config.overformat);
ldcore->overtex = render_texture_alloc(NULL, NULL); ldcore->overtex = device->machine->render().texture_alloc();
if (ldcore->overtex == NULL) if (ldcore->overtex == NULL)
fatalerror("Out of memory allocating overlay texture"); fatalerror("Out of memory allocating overlay texture");
} }
@ -1536,12 +1536,10 @@ static DEVICE_STOP( laserdisc )
chd_async_complete(ldcore->disc); chd_async_complete(ldcore->disc);
/* free any textures and palettes */ /* free any textures and palettes */
if (ldcore->videotex != NULL) device->machine->render().texture_free(ldcore->videotex);
render_texture_free(ldcore->videotex);
if (ldcore->videopalette != NULL) if (ldcore->videopalette != NULL)
palette_deref(ldcore->videopalette); palette_deref(ldcore->videopalette);
if (ldcore->overtex != NULL) device->machine->render().texture_free(ldcore->overtex);
render_texture_free(ldcore->overtex);
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -2333,24 +2333,27 @@ static void FUNC_PREFIX(setup_and_draw_textured_quad)(const render_primitive *pr
using a software rasterizer using a software rasterizer
-------------------------------------------------*/ -------------------------------------------------*/
static void FUNC_PREFIX(draw_primitives)(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch) static void FUNC_PREFIX(draw_primitives)(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch)
{ {
const render_primitive *prim; const render_primitive *prim;
/* loop over the list and render each element */ /* loop over the list and render each element */
for (prim = primlist; prim != NULL; prim = prim->next) for (prim = primlist.first(); prim != NULL; prim = prim->next())
switch (prim->type) switch (prim->type)
{ {
case RENDER_PRIMITIVE_LINE: case render_primitive::LINE:
FUNC_PREFIX(draw_line)(prim, dstdata, width, height, pitch); FUNC_PREFIX(draw_line)(prim, dstdata, width, height, pitch);
break; break;
case RENDER_PRIMITIVE_QUAD: case render_primitive::QUAD:
if (!prim->texture.base) if (!prim->texture.base)
FUNC_PREFIX(draw_rect)(prim, dstdata, width, height, pitch); FUNC_PREFIX(draw_rect)(prim, dstdata, width, height, pitch);
else else
FUNC_PREFIX(setup_and_draw_textured_quad)(prim, dstdata, width, height, pitch); FUNC_PREFIX(setup_and_draw_textured_quad)(prim, dstdata, width, height, pitch);
break; break;
default:
throw emu_fatalerror("Unexpected render_primitive type");
} }
} }

View File

@ -52,6 +52,7 @@ struct _render_font_char
/*typedef struct _render_font render_font; -- defined in rendfont.h */ /*typedef struct _render_font render_font; -- defined in rendfont.h */
struct _render_font struct _render_font
{ {
running_machine * machine;
int format; /* format of font data */ int format; /* format of font data */
int height; /* height of the font, from ascent to descent */ int height; /* height of the font, from ascent to descent */
int yoffs; /* y offset from baseline to descent */ int yoffs; /* y offset from baseline to descent */
@ -136,7 +137,7 @@ INLINE render_font_char *get_char(render_font *font, unicode_char chnum)
and load the BDF file and load the BDF file
-------------------------------------------------*/ -------------------------------------------------*/
render_font *render_font_alloc(const char *filename) render_font *render_font_alloc(running_machine &machine, const char *filename)
{ {
file_error filerr; file_error filerr;
mame_file *ramfile; mame_file *ramfile;
@ -144,6 +145,7 @@ render_font *render_font_alloc(const char *filename)
/* allocate and clear memory */ /* allocate and clear memory */
font = global_alloc_clear(render_font); font = global_alloc_clear(render_font);
font->machine = &machine;
/* attempt to load the cached version of the font first */ /* attempt to load the cached version of the font first */
if (filename != NULL && render_font_load_cached_bdf(font, filename) == 0) if (filename != NULL && render_font_load_cached_bdf(font, filename) == 0)
@ -152,6 +154,7 @@ render_font *render_font_alloc(const char *filename)
/* if we failed, clean up and realloc */ /* if we failed, clean up and realloc */
render_font_free(font); render_font_free(font);
font = global_alloc_clear(render_font); font = global_alloc_clear(render_font);
font->machine = &machine;
/* load the raw data instead */ /* load the raw data instead */
filerr = mame_fopen_ram(font_uismall, sizeof(font_uismall), OPEN_FLAG_READ, &ramfile); filerr = mame_fopen_ram(font_uismall, sizeof(font_uismall), OPEN_FLAG_READ, &ramfile);
@ -183,8 +186,7 @@ void render_font_free(render_font *font)
for (charnum = 0; charnum < 256; charnum++) for (charnum = 0; charnum < 256; charnum++)
{ {
render_font_char *ch = &font->chars[tablenum][charnum]; render_font_char *ch = &font->chars[tablenum][charnum];
if (ch->texture != NULL) font->machine->render().texture_free(ch->texture);
render_texture_free(ch->texture);
global_free(ch->bitmap); global_free(ch->bitmap);
} }
@ -274,8 +276,8 @@ static void render_font_char_expand(render_font *font, render_font_char *ch)
} }
/* wrap a texture around the bitmap */ /* wrap a texture around the bitmap */
ch->texture = render_texture_alloc(render_texture_hq_scale, NULL); ch->texture = font->machine->render().texture_alloc(render_texture::hq_scale);
render_texture_set_bitmap(ch->texture, ch->bitmap, NULL, TEXFORMAT_ARGB32, NULL); ch->texture->set_bitmap(ch->bitmap, NULL, TEXFORMAT_ARGB32);
} }
@ -343,7 +345,11 @@ void render_font_get_scaled_bitmap_and_bounds(render_font *font, bitmap_t *dest,
origheight = dest->height; origheight = dest->height;
dest->width = bounds->max_x - bounds->min_x; dest->width = bounds->max_x - bounds->min_x;
dest->height = bounds->max_y - bounds->min_y; dest->height = bounds->max_y - bounds->min_y;
render_texture_hq_scale(dest, ch->bitmap, NULL, NULL); rectangle clip;
clip.min_x = clip.min_y = 0;
clip.max_x = ch->bitmap->width - 1;
clip.max_y = ch->bitmap->height - 1;
render_texture::hq_scale(*dest, *ch->bitmap, clip, NULL);
dest->width = origwidth; dest->width = origwidth;
dest->height = origheight; dest->height = origheight;
} }
@ -812,8 +818,7 @@ static int render_font_save_cached(render_font *font, const char *filename, UINT
goto error; goto error;
/* free the bitmap and texture */ /* free the bitmap and texture */
if (ch->texture != NULL) font->machine->render().texture_free(ch->texture);
render_texture_free(ch->texture);
ch->texture = NULL; ch->texture = NULL;
global_free(ch->bitmap); global_free(ch->bitmap);
ch->bitmap = NULL; ch->bitmap = NULL;

View File

@ -20,7 +20,7 @@
FUNCTION PROTOTYPES FUNCTION PROTOTYPES
***************************************************************************/ ***************************************************************************/
render_font *render_font_alloc(const char *filename); render_font *render_font_alloc(running_machine &machine, const char *filename);
void render_font_free(render_font *font); void render_font_free(render_font *font);
INT32 render_font_get_pixel_height(render_font *font); INT32 render_font_get_pixel_height(render_font *font);
render_texture *render_font_get_char_texture_and_bounds(render_font *font, float height, float aspect, unicode_char ch, render_bounds *bounds); render_texture *render_font_get_char_texture_and_bounds(render_font *font, float height, float aspect, unicode_char ch, render_bounds *bounds);

File diff suppressed because it is too large Load Diff

View File

@ -96,6 +96,7 @@ struct _element_texture
struct _layout_element struct _layout_element
{ {
layout_element * next; /* link to next element */ layout_element * next; /* link to next element */
running_machine * machine;
const char * name; /* name of this element */ const char * name; /* name of this element */
element_component * complist; /* head of the list of components */ element_component * complist; /* head of the list of components */
int defstate; /* default state of this element */ int defstate; /* default state of this element */
@ -164,7 +165,7 @@ void layout_view_recompute(layout_view *view, int layerconfig);
/* ----- layout file parsing ----- */ /* ----- layout file parsing ----- */
layout_file *layout_file_load(const machine_config *config, const char *dirname, const char *filename); layout_file *layout_file_load(running_machine &machine, const char *dirname, const char *filename);
void layout_file_free(layout_file *file); void layout_file_free(layout_file *file);

View File

@ -1455,7 +1455,7 @@ void ui_image_menu_software(running_machine *machine, ui_menu *menu, void *param
if (event != NULL && event->iptkey == IPT_UI_SELECT) if (event != NULL && event->iptkey == IPT_UI_SELECT)
{ {
ui_menu *child_menu = ui_menu_alloc(machine, render_container_get_ui(), ui_mess_menu_software_list, NULL); ui_menu *child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), ui_mess_menu_software_list, NULL);
software_menu_state *child_menustate = (software_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); software_menu_state *child_menustate = (software_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
child_menustate->list_name = (char *)event->itemref; child_menustate->list_name = (char *)event->itemref;
child_menustate->image = image; child_menustate->image = image;

View File

@ -240,7 +240,7 @@ int ui_init(running_machine *machine)
machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_exit); machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_exit);
/* allocate the font and messagebox string */ /* allocate the font and messagebox string */
ui_font = render_font_alloc("ui.bdf"); ui_font = render_font_alloc(*machine, "ui.bdf");
/* initialize the other UI bits */ /* initialize the other UI bits */
ui_menu_init(machine); ui_menu_init(machine);
@ -374,7 +374,7 @@ void ui_set_startup_text(running_machine *machine, const char *text, int force)
void ui_update_and_render(running_machine *machine, render_container *container) void ui_update_and_render(running_machine *machine, render_container *container)
{ {
/* always start clean */ /* always start clean */
render_container_empty(container); container->empty();
/* if we're paused, dim the whole screen */ /* if we're paused, dim the whole screen */
if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused())) if (machine->phase() >= MACHINE_PHASE_RESET && (single_step || machine->paused()))
@ -385,7 +385,7 @@ void ui_update_and_render(running_machine *machine, render_container *container)
if (alpha > 255) if (alpha > 255)
alpha = 255; alpha = 255;
if (alpha >= 0) if (alpha >= 0)
render_container_add_rect(container, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_rect(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(alpha,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
/* render any cheat stuff at the bottom */ /* render any cheat stuff at the bottom */
@ -422,17 +422,14 @@ render_font *ui_get_font(void)
of a line of a line
-------------------------------------------------*/ -------------------------------------------------*/
float ui_get_line_height(void) float ui_get_line_height(running_machine &machine)
{ {
INT32 raw_font_pixel_height = render_font_get_pixel_height(ui_font); INT32 raw_font_pixel_height = render_font_get_pixel_height(ui_font);
INT32 target_pixel_width, target_pixel_height; render_target &ui_target = machine.render().ui_target();
INT32 target_pixel_height = ui_target.height();
float one_to_one_line_height; float one_to_one_line_height;
float target_aspect;
float scale_factor; float scale_factor;
/* get info about the UI target */
render_target_get_bounds(render_get_ui_target(), &target_pixel_width, &target_pixel_height, &target_aspect);
/* compute the font pixel height at the nominal size */ /* compute the font pixel height at the nominal size */
one_to_one_line_height = (float)raw_font_pixel_height / (float)target_pixel_height; one_to_one_line_height = (float)raw_font_pixel_height / (float)target_pixel_height;
@ -470,9 +467,9 @@ float ui_get_line_height(void)
single character single character
-------------------------------------------------*/ -------------------------------------------------*/
float ui_get_char_width(unicode_char ch) float ui_get_char_width(running_machine &machine, unicode_char ch)
{ {
return render_font_get_char_width(ui_font, ui_get_line_height(), render_get_ui_aspect(), ch); return render_font_get_char_width(ui_font, ui_get_line_height(machine), machine.render().ui_aspect(), ch);
} }
@ -481,9 +478,9 @@ float ui_get_char_width(unicode_char ch)
character string character string
-------------------------------------------------*/ -------------------------------------------------*/
float ui_get_string_width(const char *s) float ui_get_string_width(running_machine &machine, const char *s)
{ {
return render_font_get_utf8string_width(ui_font, ui_get_line_height(), render_get_ui_aspect(), s); return render_font_get_utf8string_width(ui_font, ui_get_line_height(machine), machine.render().ui_aspect(), s);
} }
@ -495,11 +492,11 @@ float ui_get_string_width(const char *s)
void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor) void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor)
{ {
render_container_add_rect(container, x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_rect(x0, y0, x1, y1, backcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_line(x0, y0, x1, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_line(x1, y0, x1, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_line(x1, y1, x0, y1, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(container, x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_line(x0, y1, x0, y0, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
@ -521,7 +518,8 @@ void ui_draw_text(render_container *container, const char *buf, float x, float y
void ui_draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight) void ui_draw_text_full(render_container *container, const char *origs, float x, float y, float origwrapwidth, int justify, int wrap, int draw, rgb_t fgcolor, rgb_t bgcolor, float *totalwidth, float *totalheight)
{ {
float lineheight = ui_get_line_height(); running_machine &machine = container->manager().machine();
float lineheight = ui_get_line_height(machine);
const char *ends = origs + strlen(origs); const char *ends = origs + strlen(origs);
float wrapwidth = origwrapwidth; float wrapwidth = origwrapwidth;
const char *s = origs; const char *s = origs;
@ -576,7 +574,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
break; break;
/* get the width of this character */ /* get the width of this character */
chwidth = ui_get_char_width(schar); chwidth = ui_get_char_width(machine, schar);
/* if we hit a space, remember the location and width *without* the space */ /* if we hit a space, remember the location and width *without* the space */
if (schar == ' ') if (schar == ' ')
@ -620,7 +618,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
if (scharcount == -1) if (scharcount == -1)
break; break;
curwidth -= ui_get_char_width(schar); curwidth -= ui_get_char_width(machine, schar);
} }
} }
@ -628,7 +626,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
else if (wrap == WRAP_TRUNCATE) else if (wrap == WRAP_TRUNCATE)
{ {
/* add in the width of the ... */ /* add in the width of the ... */
curwidth += 3.0f * ui_get_char_width('.'); curwidth += 3.0f * ui_get_char_width(machine, '.');
/* while we are above the wrap width, back up one character */ /* while we are above the wrap width, back up one character */
while (curwidth > wrapwidth && s > linestart) while (curwidth > wrapwidth && s > linestart)
@ -639,7 +637,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
if (scharcount == -1) if (scharcount == -1)
break; break;
curwidth -= ui_get_char_width(schar); curwidth -= ui_get_char_width(machine, schar);
} }
} }
} }
@ -656,7 +654,7 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
/* if opaque, add a black box */ /* if opaque, add a black box */
if (draw == DRAW_OPAQUE) if (draw == DRAW_OPAQUE)
render_container_add_rect(container, curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_rect(curx, cury, curx + curwidth, cury + lineheight, bgcolor, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* loop from the line start and add the characters */ /* loop from the line start and add the characters */
while (linestart < s) while (linestart < s)
@ -669,8 +667,8 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
if (draw != DRAW_NONE) if (draw != DRAW_NONE)
{ {
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, linechar); container->add_char(curx, cury, lineheight, machine.render().ui_aspect(), fgcolor, *ui_font, linechar);
curx += ui_get_char_width(linechar); curx += ui_get_char_width(machine, linechar);
} }
linestart += linecharcount; linestart += linecharcount;
} }
@ -678,12 +676,12 @@ void ui_draw_text_full(render_container *container, const char *origs, float x,
/* append ellipses if needed */ /* append ellipses if needed */
if (wrap == WRAP_TRUNCATE && *s != 0 && draw != DRAW_NONE) if (wrap == WRAP_TRUNCATE && *s != 0 && draw != DRAW_NONE)
{ {
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); container->add_char(curx, cury, lineheight, machine.render().ui_aspect(), fgcolor, *ui_font, '.');
curx += ui_get_char_width('.'); curx += ui_get_char_width(machine, '.');
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); container->add_char(curx, cury, lineheight, machine.render().ui_aspect(), fgcolor, *ui_font, '.');
curx += ui_get_char_width('.'); curx += ui_get_char_width(machine, '.');
render_container_add_char(container, curx, cury, lineheight, render_get_ui_aspect(), fgcolor, ui_font, '.'); container->add_char(curx, cury, lineheight, machine.render().ui_aspect(), fgcolor, *ui_font, '.');
curx += ui_get_char_width('.'); curx += ui_get_char_width(machine, '.');
} }
/* if we're not word-wrapping, we're done */ /* if we're not word-wrapping, we're done */
@ -732,7 +730,7 @@ void ui_draw_text_box(render_container *container, const char *text, int justify
ui_draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER, ui_draw_text_full(container, text, 0, 0, 1.0f - 2.0f * UI_BOX_LR_BORDER,
justify, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height); justify, WRAP_WORD, DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &target_width, &target_height);
if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER) if (target_height > 1.0f - 2.0f * UI_BOX_TB_BORDER)
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height()) * ui_get_line_height(); target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / ui_get_line_height(container->manager().machine())) * ui_get_line_height(container->manager().machine());
/* determine the target location */ /* determine the target location */
target_x = xpos - 0.5f * target_width; target_x = xpos - 0.5f * target_width;
@ -1848,18 +1846,17 @@ static INT32 slider_refresh(running_machine *machine, void *arg, astring *string
static INT32 slider_brightness(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_brightness(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
screen_device *screen = reinterpret_cast<screen_device *>(arg); screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container *container = render_container_get_screen(screen); render_container::user_settings settings;
render_container_user_settings settings;
render_container_get_user_settings(container, &settings); screen->container().get_user_settings(settings);
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
{ {
settings.brightness = (float)newval * 0.001f; settings.m_brightness = (float)newval * 0.001f;
render_container_set_user_settings(container, &settings); screen->container().set_user_settings(settings);
} }
if (string != NULL) if (string != NULL)
string->printf("%.3f", settings.brightness); string->printf("%.3f", settings.m_brightness);
return floor(settings.brightness * 1000.0f + 0.5f); return floor(settings.m_brightness * 1000.0f + 0.5f);
} }
@ -1871,18 +1868,17 @@ static INT32 slider_brightness(running_machine *machine, void *arg, astring *str
static INT32 slider_contrast(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_contrast(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
screen_device *screen = reinterpret_cast<screen_device *>(arg); screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container *container = render_container_get_screen(screen); render_container::user_settings settings;
render_container_user_settings settings;
render_container_get_user_settings(container, &settings); screen->container().get_user_settings(settings);
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
{ {
settings.contrast = (float)newval * 0.001f; settings.m_contrast = (float)newval * 0.001f;
render_container_set_user_settings(container, &settings); screen->container().set_user_settings(settings);
} }
if (string != NULL) if (string != NULL)
string->printf("%.3f", settings.contrast); string->printf("%.3f", settings.m_contrast);
return floor(settings.contrast * 1000.0f + 0.5f); return floor(settings.m_contrast * 1000.0f + 0.5f);
} }
@ -1893,18 +1889,17 @@ static INT32 slider_contrast(running_machine *machine, void *arg, astring *strin
static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_gamma(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
screen_device *screen = reinterpret_cast<screen_device *>(arg); screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container *container = render_container_get_screen(screen); render_container::user_settings settings;
render_container_user_settings settings;
render_container_get_user_settings(container, &settings); screen->container().get_user_settings(settings);
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
{ {
settings.gamma = (float)newval * 0.001f; settings.m_gamma = (float)newval * 0.001f;
render_container_set_user_settings(container, &settings); screen->container().set_user_settings(settings);
} }
if (string != NULL) if (string != NULL)
string->printf("%.3f", settings.gamma); string->printf("%.3f", settings.m_gamma);
return floor(settings.gamma * 1000.0f + 0.5f); return floor(settings.m_gamma * 1000.0f + 0.5f);
} }
@ -1916,18 +1911,17 @@ static INT32 slider_gamma(running_machine *machine, void *arg, astring *string,
static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_xscale(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
screen_device *screen = reinterpret_cast<screen_device *>(arg); screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container *container = render_container_get_screen(screen); render_container::user_settings settings;
render_container_user_settings settings;
render_container_get_user_settings(container, &settings); screen->container().get_user_settings(settings);
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
{ {
settings.xscale = (float)newval * 0.001f; settings.m_xscale = (float)newval * 0.001f;
render_container_set_user_settings(container, &settings); screen->container().set_user_settings(settings);
} }
if (string != NULL) if (string != NULL)
string->printf("%.3f", settings.xscale); string->printf("%.3f", settings.m_xscale);
return floor(settings.xscale * 1000.0f + 0.5f); return floor(settings.m_xscale * 1000.0f + 0.5f);
} }
@ -1939,18 +1933,17 @@ static INT32 slider_xscale(running_machine *machine, void *arg, astring *string,
static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_yscale(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
screen_device *screen = reinterpret_cast<screen_device *>(arg); screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container *container = render_container_get_screen(screen); render_container::user_settings settings;
render_container_user_settings settings;
render_container_get_user_settings(container, &settings); screen->container().get_user_settings(settings);
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
{ {
settings.yscale = (float)newval * 0.001f; settings.m_yscale = (float)newval * 0.001f;
render_container_set_user_settings(container, &settings); screen->container().set_user_settings(settings);
} }
if (string != NULL) if (string != NULL)
string->printf("%.3f", settings.yscale); string->printf("%.3f", settings.m_yscale);
return floor(settings.yscale * 1000.0f + 0.5f); return floor(settings.m_yscale * 1000.0f + 0.5f);
} }
@ -1962,18 +1955,17 @@ static INT32 slider_yscale(running_machine *machine, void *arg, astring *string,
static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
screen_device *screen = reinterpret_cast<screen_device *>(arg); screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container *container = render_container_get_screen(screen); render_container::user_settings settings;
render_container_user_settings settings;
render_container_get_user_settings(container, &settings); screen->container().get_user_settings(settings);
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
{ {
settings.xoffset = (float)newval * 0.001f; settings.m_xoffset = (float)newval * 0.001f;
render_container_set_user_settings(container, &settings); screen->container().set_user_settings(settings);
} }
if (string != NULL) if (string != NULL)
string->printf("%.3f", settings.xoffset); string->printf("%.3f", settings.m_xoffset);
return floor(settings.xoffset * 1000.0f + 0.5f); return floor(settings.m_xoffset * 1000.0f + 0.5f);
} }
@ -1985,18 +1977,17 @@ static INT32 slider_xoffset(running_machine *machine, void *arg, astring *string
static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string, INT32 newval) static INT32 slider_yoffset(running_machine *machine, void *arg, astring *string, INT32 newval)
{ {
screen_device *screen = reinterpret_cast<screen_device *>(arg); screen_device *screen = reinterpret_cast<screen_device *>(arg);
render_container *container = render_container_get_screen(screen); render_container::user_settings settings;
render_container_user_settings settings;
render_container_get_user_settings(container, &settings); screen->container().get_user_settings(settings);
if (newval != SLIDER_NOCHANGE) if (newval != SLIDER_NOCHANGE)
{ {
settings.yoffset = (float)newval * 0.001f; settings.m_yoffset = (float)newval * 0.001f;
render_container_set_user_settings(container, &settings); screen->container().set_user_settings(settings);
} }
if (string != NULL) if (string != NULL)
string->printf("%.3f", settings.yoffset); string->printf("%.3f", settings.m_yoffset);
return floor(settings.yoffset * 1000.0f + 0.5f); return floor(settings.m_yoffset * 1000.0f + 0.5f);
} }

View File

@ -136,11 +136,11 @@ void ui_update_and_render(running_machine *machine, render_container *container)
render_font *ui_get_font(void); render_font *ui_get_font(void);
/* returns the line height of the font used by the UI system */ /* returns the line height of the font used by the UI system */
float ui_get_line_height(void); float ui_get_line_height(running_machine &machine);
/* returns the width of a character or string in the UI font */ /* returns the width of a character or string in the UI font */
float ui_get_char_width(unicode_char ch); float ui_get_char_width(running_machine &machine, unicode_char ch);
float ui_get_string_width(const char *s); float ui_get_string_width(running_machine &machine, const char *s);
/* draw an outlined box filled with a given color */ /* draw an outlined box filled with a given color */
void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor); void ui_draw_outlined_box(render_container *container, float x0, float y0, float x1, float y1, rgb_t backcolor);

View File

@ -136,8 +136,7 @@ void ui_gfx_init(running_machine *machine)
static void ui_gfx_exit(running_machine &machine) static void ui_gfx_exit(running_machine &machine)
{ {
/* free the texture */ /* free the texture */
if (ui_gfx.texture != NULL) machine.render().texture_free(ui_gfx.texture);
render_texture_free(ui_gfx.texture);
ui_gfx.texture = NULL; ui_gfx.texture = NULL;
/* free the bitmap */ /* free the bitmap */
@ -253,8 +252,8 @@ static void palette_handler(running_machine *machine, render_container *containe
int x, y, skip; int x, y, skip;
/* add a half character padding for the box */ /* add a half character padding for the box */
chheight = ui_get_line_height(); chheight = ui_get_line_height(*machine);
chwidth = render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), '0'); chwidth = render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), '0');
boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x0 = 0.0f + 0.5f * chwidth;
boxbounds.x1 = 1.0f - 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth;
boxbounds.y0 = 0.0f + 0.5f * chheight; boxbounds.y0 = 0.0f + 0.5f * chheight;
@ -274,7 +273,7 @@ static void palette_handler(running_machine *machine, render_container *containe
cellboxbounds.y0 += 3.0f * chheight; cellboxbounds.y0 += 3.0f * chheight;
/* figure out the title and expand the outer box to fit */ /* figure out the title and expand the outer box to fit */
titlewidth = render_font_get_string_width(ui_font, chheight, render_get_ui_aspect(), title); titlewidth = render_font_get_string_width(ui_font, chheight, machine->render().ui_aspect(), title);
x0 = 0.0f; x0 = 0.0f;
if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth) if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth)
x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth));
@ -287,8 +286,8 @@ static void palette_handler(running_machine *machine, render_container *containe
y0 = boxbounds.y0 + 0.5f * chheight; y0 = boxbounds.y0 + 0.5f * chheight;
for (x = 0; title[x] != 0; x++) for (x = 0; title[x] != 0; x++)
{ {
render_container_add_char(container, x0, y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, title[x]); container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]);
x0 += render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), title[x]); x0 += render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), title[x]);
} }
/* compute the cell size */ /* compute the cell size */
@ -301,12 +300,12 @@ static void palette_handler(running_machine *machine, render_container *containe
{ {
x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth; x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth;
y0 = boxbounds.y0 + 2.0f * chheight; y0 = boxbounds.y0 + 2.0f * chheight;
render_container_add_char(container, x0 + 0.5f * (cellwidth - chwidth), y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, "0123456789ABCDEF"[x & 0xf]); container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]);
/* if we're skipping, draw a point between the character and the box to indicate which */ /* if we're skipping, draw a point between the character and the box to indicate which */
/* one it's referring to */ /* one it's referring to */
if (skip != 0) if (skip != 0)
render_container_add_point(container, x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + cellboxbounds.y0), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + cellboxbounds.y0), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
/* draw the side column headers */ /* draw the side column headers */
@ -323,14 +322,14 @@ static void palette_handler(running_machine *machine, render_container *containe
x0 = boxbounds.x0 + 5.5f * chwidth; x0 = boxbounds.x0 + 5.5f * chwidth;
y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight; y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight;
if (skip != 0) if (skip != 0)
render_container_add_point(container, 0.5f * (x0 + cellboxbounds.x0), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_point(0.5f * (x0 + cellboxbounds.x0), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* draw the row header */ /* draw the row header */
sprintf(buffer, "%5X", state->palette.offset + y * state->palette.count); sprintf(buffer, "%5X", state->palette.offset + y * state->palette.count);
for (x = 4; x >= 0; x--) for (x = 4; x >= 0; x--)
{ {
x0 -= render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), buffer[x]); x0 -= render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), buffer[x]);
render_container_add_char(container, x0, y0 + 0.5f * (cellheight - chheight), chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, buffer[x]); container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]);
} }
} }
@ -342,7 +341,7 @@ static void palette_handler(running_machine *machine, render_container *containe
if (index < total) if (index < total)
{ {
pen_t pen = state->palette.which ? colortable_palette_get_color(machine->colortable, index) : raw_color[index]; pen_t pen = state->palette.which ? colortable_palette_get_color(machine->colortable, index) : raw_color[index];
render_container_add_rect(container, cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight, container->add_rect(cellboxbounds.x0 + x * cellwidth, cellboxbounds.y0 + y * cellheight,
cellboxbounds.x0 + (x + 1) * cellwidth, cellboxbounds.y0 + (y + 1) * cellheight, cellboxbounds.x0 + (x + 1) * cellwidth, cellboxbounds.y0 + (y + 1) * cellheight,
0xff000000 | pen, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); 0xff000000 | pen, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
@ -440,19 +439,17 @@ static void gfxset_handler(running_machine *machine, render_container *container
render_bounds cellboxbounds; render_bounds cellboxbounds;
render_bounds boxbounds; render_bounds boxbounds;
int cellboxwidth, cellboxheight; int cellboxwidth, cellboxheight;
int targwidth, targheight; int targwidth = machine->render().ui_target().width();
int targheight = machine->render().ui_target().height();
int cellxpix, cellypix; int cellxpix, cellypix;
int xcells, ycells; int xcells, ycells;
int pixelscale = 0; int pixelscale = 0;
int x, y, skip; int x, y, skip;
char title[100]; char title[100];
/* get the bounds of our target */
render_target_get_bounds(render_get_ui_target(), &targwidth, &targheight, NULL);
/* add a half character padding for the box */ /* add a half character padding for the box */
chheight = ui_get_line_height(); chheight = ui_get_line_height(*machine);
chwidth = render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), '0'); chwidth = render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), '0');
boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x0 = 0.0f + 0.5f * chwidth;
boxbounds.x1 = 1.0f - 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth;
boxbounds.y0 = 0.0f + 0.5f * chheight; boxbounds.y0 = 0.0f + 0.5f * chheight;
@ -517,7 +514,7 @@ static void gfxset_handler(running_machine *machine, render_container *container
/* figure out the title and expand the outer box to fit */ /* figure out the title and expand the outer box to fit */
for (x = 0; x < MAX_GFX_ELEMENTS && machine->gfx[x] != NULL; x++) ; for (x = 0; x < MAX_GFX_ELEMENTS && machine->gfx[x] != NULL; x++) ;
sprintf(title, "GFX %d/%d %dx%d COLOR %X", state->gfxset.set, x - 1, gfx->width, gfx->height, state->gfxset.color[set]); sprintf(title, "GFX %d/%d %dx%d COLOR %X", state->gfxset.set, x - 1, gfx->width, gfx->height, state->gfxset.color[set]);
titlewidth = render_font_get_string_width(ui_font, chheight, render_get_ui_aspect(), title); titlewidth = render_font_get_string_width(ui_font, chheight, machine->render().ui_aspect(), title);
x0 = 0.0f; x0 = 0.0f;
if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth) if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth)
x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth)); x0 = boxbounds.x0 - (0.5f - 0.5f * (titlewidth + chwidth));
@ -530,8 +527,8 @@ static void gfxset_handler(running_machine *machine, render_container *container
y0 = boxbounds.y0 + 0.5f * chheight; y0 = boxbounds.y0 + 0.5f * chheight;
for (x = 0; title[x] != 0; x++) for (x = 0; title[x] != 0; x++)
{ {
render_container_add_char(container, x0, y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, title[x]); container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]);
x0 += render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), title[x]); x0 += render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), title[x]);
} }
/* draw the top column headers */ /* draw the top column headers */
@ -540,12 +537,12 @@ static void gfxset_handler(running_machine *machine, render_container *container
{ {
x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth; x0 = boxbounds.x0 + 6.0f * chwidth + (float)x * cellwidth;
y0 = boxbounds.y0 + 2.0f * chheight; y0 = boxbounds.y0 + 2.0f * chheight;
render_container_add_char(container, x0 + 0.5f * (cellwidth - chwidth), y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, "0123456789ABCDEF"[x & 0xf]); container->add_char(x0 + 0.5f * (cellwidth - chwidth), y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, "0123456789ABCDEF"[x & 0xf]);
/* if we're skipping, draw a point between the character and the box to indicate which */ /* if we're skipping, draw a point between the character and the box to indicate which */
/* one it's referring to */ /* one it's referring to */
if (skip != 0) if (skip != 0)
render_container_add_point(container, x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + boxbounds.y0 + 3.5f * chheight), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_point(x0 + 0.5f * cellwidth, 0.5f * (y0 + chheight + boxbounds.y0 + 3.5f * chheight), UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
/* draw the side column headers */ /* draw the side column headers */
@ -562,14 +559,14 @@ static void gfxset_handler(running_machine *machine, render_container *container
x0 = boxbounds.x0 + 5.5f * chwidth; x0 = boxbounds.x0 + 5.5f * chwidth;
y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight; y0 = boxbounds.y0 + 3.5f * chheight + (float)y * cellheight;
if (skip != 0) if (skip != 0)
render_container_add_point(container, 0.5f * (x0 + boxbounds.x0 + 6.0f * chwidth), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); container->add_point(0.5f * (x0 + boxbounds.x0 + 6.0f * chwidth), y0 + 0.5f * cellheight, UI_LINE_WIDTH, ARGB_WHITE, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* draw the row header */ /* draw the row header */
sprintf(buffer, "%5X", state->gfxset.offset[set] + y * xcells); sprintf(buffer, "%5X", state->gfxset.offset[set] + y * xcells);
for (x = 4; x >= 0; x--) for (x = 4; x >= 0; x--)
{ {
x0 -= render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), buffer[x]); x0 -= render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), buffer[x]);
render_container_add_char(container, x0, y0 + 0.5f * (cellheight - chheight), chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, buffer[x]); container->add_char(x0, y0 + 0.5f * (cellheight - chheight), chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, buffer[x]);
} }
} }
@ -577,7 +574,7 @@ static void gfxset_handler(running_machine *machine, render_container *container
gfxset_update_bitmap(machine, state, xcells, ycells, gfx); gfxset_update_bitmap(machine, state, xcells, ycells, gfx);
/* add the final quad */ /* add the final quad */
render_container_add_quad(container, boxbounds.x0 + 6.0f * chwidth, boxbounds.y0 + 3.5f * chheight, container->add_quad(boxbounds.x0 + 6.0f * chwidth, boxbounds.y0 + 3.5f * chheight,
boxbounds.x0 + 6.0f * chwidth + (float)cellboxwidth / (float)targwidth, boxbounds.x0 + 6.0f * chwidth + (float)cellboxwidth / (float)targwidth,
boxbounds.y0 + 3.5f * chheight + (float)cellboxheight / (float)targheight, boxbounds.y0 + 3.5f * chheight + (float)cellboxheight / (float)targheight,
ARGB_WHITE, state->texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); ARGB_WHITE, state->texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
@ -699,14 +696,13 @@ static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state,
if (state->bitmap == NULL || state->texture == NULL || state->bitmap->bpp != 32 || state->bitmap->width != cellxpix * xcells || state->bitmap->height != cellypix * ycells) if (state->bitmap == NULL || state->texture == NULL || state->bitmap->bpp != 32 || state->bitmap->width != cellxpix * xcells || state->bitmap->height != cellypix * ycells)
{ {
/* free the old stuff */ /* free the old stuff */
if (state->texture != NULL) machine->render().texture_free(state->texture);
render_texture_free(state->texture);
global_free(state->bitmap); global_free(state->bitmap);
/* allocate new stuff */ /* allocate new stuff */
state->bitmap = global_alloc(bitmap_t(cellxpix * xcells, cellypix * ycells, BITMAP_FORMAT_ARGB32)); state->bitmap = global_alloc(bitmap_t(cellxpix * xcells, cellypix * ycells, BITMAP_FORMAT_ARGB32));
state->texture = render_texture_alloc(NULL, NULL); state->texture = machine->render().texture_alloc();
render_texture_set_bitmap(state->texture, state->bitmap, NULL, TEXFORMAT_ARGB32, NULL); state->texture->set_bitmap(state->bitmap, NULL, TEXFORMAT_ARGB32);
/* force a redraw */ /* force a redraw */
state->bitmap_dirty = TRUE; state->bitmap_dirty = TRUE;
@ -754,7 +750,7 @@ static void gfxset_update_bitmap(running_machine *machine, ui_gfx_state *state,
} }
/* reset the texture to force an update */ /* reset the texture to force an update */
render_texture_set_bitmap(state->texture, state->bitmap, NULL, TEXFORMAT_ARGB32, NULL); state->texture->set_bitmap(state->bitmap, NULL, TEXFORMAT_ARGB32);
state->bitmap_dirty = FALSE; state->bitmap_dirty = FALSE;
} }
} }
@ -848,7 +844,8 @@ static void tilemap_handler(running_machine *machine, render_container *containe
float chwidth, chheight; float chwidth, chheight;
render_bounds mapboxbounds; render_bounds mapboxbounds;
render_bounds boxbounds; render_bounds boxbounds;
int targwidth, targheight; int targwidth = machine->render().ui_target().width();
int targheight = machine->render().ui_target().height();
float titlewidth; float titlewidth;
float x0, y0; float x0, y0;
int mapboxwidth, mapboxheight; int mapboxwidth, mapboxheight;
@ -857,17 +854,14 @@ static void tilemap_handler(running_machine *machine, render_container *containe
int x, pixelscale; int x, pixelscale;
char title[100]; char title[100];
/* get the bounds of our target */
render_target_get_bounds(render_get_ui_target(), &targwidth, &targheight, NULL);
/* get the size of the tilemap itself */ /* get the size of the tilemap itself */
tilemap_size_by_index(machine, state->tilemap.which, &mapwidth, &mapheight); tilemap_size_by_index(machine, state->tilemap.which, &mapwidth, &mapheight);
if (state->tilemap.rotate & ORIENTATION_SWAP_XY) if (state->tilemap.rotate & ORIENTATION_SWAP_XY)
{ UINT32 temp = mapwidth; mapwidth = mapheight; mapheight = temp; } { UINT32 temp = mapwidth; mapwidth = mapheight; mapheight = temp; }
/* add a half character padding for the box */ /* add a half character padding for the box */
chheight = ui_get_line_height(); chheight = ui_get_line_height(*machine);
chwidth = render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), '0'); chwidth = render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), '0');
boxbounds.x0 = 0.0f + 0.5f * chwidth; boxbounds.x0 = 0.0f + 0.5f * chwidth;
boxbounds.x1 = 1.0f - 0.5f * chwidth; boxbounds.x1 = 1.0f - 0.5f * chwidth;
boxbounds.y0 = 0.0f + 0.5f * chheight; boxbounds.y0 = 0.0f + 0.5f * chheight;
@ -914,7 +908,7 @@ static void tilemap_handler(running_machine *machine, render_container *containe
/* figure out the title and expand the outer box to fit */ /* figure out the title and expand the outer box to fit */
sprintf(title, "TMAP %d/%d %dx%d OFFS %d,%d", state->tilemap.which, tilemap_count(machine) - 1, mapwidth, mapheight, state->tilemap.xoffs, state->tilemap.yoffs); sprintf(title, "TMAP %d/%d %dx%d OFFS %d,%d", state->tilemap.which, tilemap_count(machine) - 1, mapwidth, mapheight, state->tilemap.xoffs, state->tilemap.yoffs);
titlewidth = render_font_get_string_width(ui_font, chheight, render_get_ui_aspect(), title); titlewidth = render_font_get_string_width(ui_font, chheight, machine->render().ui_aspect(), title);
if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth) if (boxbounds.x1 - boxbounds.x0 < titlewidth + chwidth)
{ {
boxbounds.x0 = 0.5f - 0.5f * (titlewidth + chwidth); boxbounds.x0 = 0.5f - 0.5f * (titlewidth + chwidth);
@ -929,15 +923,15 @@ static void tilemap_handler(running_machine *machine, render_container *containe
y0 = boxbounds.y0 + 0.5f * chheight; y0 = boxbounds.y0 + 0.5f * chheight;
for (x = 0; title[x] != 0; x++) for (x = 0; title[x] != 0; x++)
{ {
render_container_add_char(container, x0, y0, chheight, render_get_ui_aspect(), ARGB_WHITE, ui_font, title[x]); container->add_char(x0, y0, chheight, machine->render().ui_aspect(), ARGB_WHITE, *ui_font, title[x]);
x0 += render_font_get_char_width(ui_font, chheight, render_get_ui_aspect(), title[x]); x0 += render_font_get_char_width(ui_font, chheight, machine->render().ui_aspect(), title[x]);
} }
/* update the bitmap */ /* update the bitmap */
tilemap_update_bitmap(machine, state, mapboxwidth / pixelscale, mapboxheight / pixelscale); tilemap_update_bitmap(machine, state, mapboxwidth / pixelscale, mapboxheight / pixelscale);
/* add the final quad */ /* add the final quad */
render_container_add_quad(container, mapboxbounds.x0, mapboxbounds.y0, container->add_quad(mapboxbounds.x0, mapboxbounds.y0,
mapboxbounds.x1, mapboxbounds.y1, mapboxbounds.x1, mapboxbounds.y1,
ARGB_WHITE, state->texture, ARGB_WHITE, state->texture,
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(state->tilemap.rotate)); PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXORIENT(state->tilemap.rotate));
@ -1058,14 +1052,13 @@ static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state,
if (state->bitmap == NULL || state->texture == NULL || state->bitmap->format != screen_format || state->bitmap->width != width || state->bitmap->height != height) if (state->bitmap == NULL || state->texture == NULL || state->bitmap->format != screen_format || state->bitmap->width != width || state->bitmap->height != height)
{ {
/* free the old stuff */ /* free the old stuff */
if (state->texture != NULL) machine->render().texture_free(state->texture);
render_texture_free(state->texture);
global_free(state->bitmap); global_free(state->bitmap);
/* allocate new stuff */ /* allocate new stuff */
state->bitmap = global_alloc(bitmap_t(width, height, screen_format)); state->bitmap = global_alloc(bitmap_t(width, height, screen_format));
state->texture = render_texture_alloc(NULL, NULL); state->texture = machine->render().texture_alloc();
render_texture_set_bitmap(state->texture, state->bitmap, NULL, screen_texformat, palette); state->texture->set_bitmap(state->bitmap, NULL, screen_texformat, palette);
/* force a redraw */ /* force a redraw */
state->bitmap_dirty = TRUE; state->bitmap_dirty = TRUE;
@ -1077,7 +1070,7 @@ static void tilemap_update_bitmap(running_machine *machine, ui_gfx_state *state,
tilemap_draw_by_index(machine, state->bitmap, state->tilemap.which, state->tilemap.xoffs, state->tilemap.yoffs); tilemap_draw_by_index(machine, state->bitmap, state->tilemap.which, state->tilemap.xoffs, state->tilemap.yoffs);
/* reset the texture to force an update */ /* reset the texture to force an update */
render_texture_set_bitmap(state->texture, state->bitmap, NULL, screen_texformat, palette); state->texture->set_bitmap(state->bitmap, NULL, screen_texformat, palette);
state->bitmap_dirty = FALSE; state->bitmap_dirty = FALSE;
} }
} }

View File

@ -147,14 +147,14 @@ static void input_character(char *buffer, size_t buffer_length, unicode_char uni
or footer text or footer text
-------------------------------------------------*/ -------------------------------------------------*/
static void extra_text_draw_box(float origx1, float origx2, float origy, float yspan, const char *text, int direction) static void extra_text_draw_box(render_container &ui_container, float origx1, float origx2, float origy, float yspan, const char *text, int direction)
{ {
float text_width, text_height; float text_width, text_height;
float width, maxwidth; float width, maxwidth;
float x1, y1, x2, y2, temp; float x1, y1, x2, y2, temp;
/* get the size of the text */ /* get the size of the text */
ui_draw_text_full( render_container_get_ui(),text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD, ui_draw_text_full(&ui_container,text, 0.0f, 0.0f, 1.0f, JUSTIFY_LEFT, WRAP_WORD,
DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &text_width, &text_height); DRAW_NONE, ARGB_WHITE, ARGB_BLACK, &text_width, &text_height);
width = text_width + (2 * UI_BOX_LR_BORDER); width = text_width + (2 * UI_BOX_LR_BORDER);
maxwidth = MAX(width, origx2 - origx1); maxwidth = MAX(width, origx2 - origx1);
@ -173,7 +173,7 @@ static void extra_text_draw_box(float origx1, float origx2, float origy, float y
} }
/* draw a box */ /* draw a box */
ui_draw_outlined_box(render_container_get_ui(),x1, y1, x2, y2, UI_BACKGROUND_COLOR); ui_draw_outlined_box(&ui_container,x1, y1, x2, y2, UI_BACKGROUND_COLOR);
/* take off the borders */ /* take off the borders */
x1 += UI_BOX_LR_BORDER; x1 += UI_BOX_LR_BORDER;
@ -182,7 +182,7 @@ static void extra_text_draw_box(float origx1, float origx2, float origy, float y
y2 -= UI_BOX_TB_BORDER; y2 -= UI_BOX_TB_BORDER;
/* draw the text within it */ /* draw the text within it */
ui_draw_text_full(render_container_get_ui(),text, x1, y1, text_width, JUSTIFY_LEFT, WRAP_WORD, ui_draw_text_full(&ui_container,text, x1, y1, text_width, JUSTIFY_LEFT, WRAP_WORD,
DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL); DRAW_NORMAL, ARGB_WHITE, ARGB_BLACK, NULL, NULL);
} }
@ -201,9 +201,9 @@ static void extra_text_render(running_machine *machine, ui_menu *menu, void *sta
footer = ((footer != NULL) && (footer[0] != '\0')) ? footer : NULL; footer = ((footer != NULL) && (footer[0] != '\0')) ? footer : NULL;
if (header != NULL) if (header != NULL)
extra_text_draw_box(origx1, origx2, origy1, top, header, -1); extra_text_draw_box(machine->render().ui_container(), origx1, origx2, origy1, top, header, -1);
if (footer != NULL) if (footer != NULL)
extra_text_draw_box(origx1, origx2, origy2, bottom, footer, +1); extra_text_draw_box(machine->render().ui_container(), origx1, origx2, origy2, bottom, footer, +1);
} }
@ -338,7 +338,7 @@ static void menu_file_create_populate(running_machine *machine, ui_menu *menu, v
ui_menu_item_append(menu, "Create", NULL, 0, ITEMREF_CREATE); ui_menu_item_append(menu, "Create", NULL, 0, ITEMREF_CREATE);
/* set up custom render proc */ /* set up custom render proc */
ui_menu_set_custom_render(menu, file_create_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0); ui_menu_set_custom_render(menu, file_create_render_extra, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 0);
} }
@ -379,7 +379,7 @@ static int create_new_image(device_image_interface *image, const char *directory
case ENTTYPE_FILE: case ENTTYPE_FILE:
/* a file exists here - ask for permission from the user */ /* a file exists here - ask for permission from the user */
child_menu = ui_menu_alloc(image->device().machine, render_container_get_ui(), menu_confirm_save_as, NULL); child_menu = ui_menu_alloc(image->device().machine, &image->device().machine->render().ui_container(), menu_confirm_save_as, NULL);
child_menustate = (confirm_save_as_menu_state*)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate = (confirm_save_as_menu_state*)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
child_menustate->yes = yes; child_menustate->yes = yes;
ui_menu_stack_push(child_menu); ui_menu_stack_push(child_menu);
@ -742,7 +742,7 @@ static file_error menu_file_selector_populate(running_machine *machine, ui_menu
ui_menu_set_selection(menu, (void *) selected_entry); ui_menu_set_selection(menu, (void *) selected_entry);
/* set up custom render proc */ /* set up custom render proc */
ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 0); ui_menu_set_custom_render(menu, file_selector_render_extra, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 0);
done: done:
if (directory != NULL) if (directory != NULL)
@ -811,13 +811,13 @@ static void menu_file_selector(running_machine *machine, ui_menu *menu, void *pa
case SELECTOR_ENTRY_TYPE_CREATE: case SELECTOR_ENTRY_TYPE_CREATE:
/* create */ /* create */
child_menu = ui_menu_alloc(machine, render_container_get_ui(), menu_file_create, NULL); child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), menu_file_create, NULL);
child_menustate = (file_create_menu_state*)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate = (file_create_menu_state*)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
child_menustate->manager_menustate = menustate->manager_menustate; child_menustate->manager_menustate = menustate->manager_menustate;
ui_menu_stack_push(child_menu); ui_menu_stack_push(child_menu);
break; break;
case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST: case SELECTOR_ENTRY_TYPE_SOFTWARE_LIST:
child_menu = ui_menu_alloc(machine, render_container_get_ui(), ui_image_menu_software, menustate->manager_menustate->selected_device); child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), ui_image_menu_software, menustate->manager_menustate->selected_device);
ui_menu_stack_push(child_menu); ui_menu_stack_push(child_menu);
break; break;
case SELECTOR_ENTRY_TYPE_DRIVE: case SELECTOR_ENTRY_TYPE_DRIVE:
@ -919,7 +919,7 @@ static void menu_file_manager_populate(running_machine *machine, ui_menu *menu,
} }
/* set up custom render proc */ /* set up custom render proc */
ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER); ui_menu_set_custom_render(menu, file_manager_render_extra, 0, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER);
} }
@ -988,7 +988,7 @@ void ui_image_menu_file_manager(running_machine *machine, ui_menu *menu, void *p
ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_POSITION); ui_menu_reset(menu, UI_MENU_RESET_REMEMBER_POSITION);
/* push the menu */ /* push the menu */
child_menu = ui_menu_alloc(machine, render_container_get_ui(), menu_file_selector, NULL); child_menu = ui_menu_alloc(machine, &machine->render().ui_container(), menu_file_selector, NULL);
child_menustate = (file_selector_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL); child_menustate = (file_selector_menu_state *)ui_menu_alloc_state(child_menu, sizeof(*child_menustate), NULL);
child_menustate->manager_menustate = menustate; child_menustate->manager_menustate = menustate;
ui_menu_stack_push(child_menu); ui_menu_stack_push(child_menu);

View File

@ -80,9 +80,14 @@ enum
enum enum
{ {
VIDEO_ITEM_ROTATE = 0x80000000, VIDEO_ITEM_ROTATE = 0x80000000,
VIDEO_ITEM_BACKDROPS,
VIDEO_ITEM_OVERLAYS,
VIDEO_ITEM_BEZELS,
VIDEO_ITEM_ZOOM,
VIDEO_ITEM_VIEW VIDEO_ITEM_VIEW
}; };
enum enum
{ {
CROSSHAIR_ITEM_VIS = 0, CROSSHAIR_ITEM_VIS = 0,
@ -300,7 +305,7 @@ static void menu_select_game_build_driver_list(ui_menu *menu, select_game_state
static void menu_select_game_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2); static void menu_select_game_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
/* menu helpers */ /* menu helpers */
static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param); static void menu_render_triangle(bitmap_t &dest, const bitmap_t &source, const rectangle &sbounds, void *param);
static void menu_settings_custom_render_one(render_container *container, float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask); static void menu_settings_custom_render_one(render_container *container, float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask);
static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2); static void menu_settings_custom_render(running_machine *machine, ui_menu *menu, void *state, void *selectedref, float top, float bottom, float x, float y, float x2, float y2);
@ -394,11 +399,11 @@ void ui_menu_init(running_machine *machine)
if (x > 256 - 25) alpha = 0xff * (255 - x) / 25; if (x > 256 - 25) alpha = 0xff * (255 - x) / 25;
*BITMAP_ADDR32(hilight_bitmap, 0, x) = MAKE_ARGB(alpha,0xff,0xff,0xff); *BITMAP_ADDR32(hilight_bitmap, 0, x) = MAKE_ARGB(alpha,0xff,0xff,0xff);
} }
hilight_texture = render_texture_alloc(NULL, NULL); hilight_texture = machine->render().texture_alloc();
render_texture_set_bitmap(hilight_texture, hilight_bitmap, NULL, TEXFORMAT_ARGB32, NULL); hilight_texture->set_bitmap(hilight_bitmap, NULL, TEXFORMAT_ARGB32);
/* create a texture for arrow icons */ /* create a texture for arrow icons */
arrow_texture = render_texture_alloc(menu_render_triangle, NULL); arrow_texture = machine->render().texture_alloc(menu_render_triangle);
/* add an exit callback to free memory */ /* add an exit callback to free memory */
machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_menu_exit); machine->add_notifier(MACHINE_NOTIFY_EXIT, ui_menu_exit);
@ -416,8 +421,8 @@ static void ui_menu_exit(running_machine &machine)
ui_menu_clear_free_list(&machine); ui_menu_clear_free_list(&machine);
/* free textures */ /* free textures */
render_texture_free(hilight_texture); machine.render().texture_free(hilight_texture);
render_texture_free(arrow_texture); machine.render().texture_free(arrow_texture);
} }
@ -735,9 +740,9 @@ void ui_menu_set_selection(ui_menu *menu, void *selected_itemref)
static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly) static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly)
{ {
float line_height = ui_get_line_height(); float line_height = ui_get_line_height(*machine);
float lr_arrow_width = 0.4f * line_height * render_get_ui_aspect(); float lr_arrow_width = 0.4f * line_height * machine->render().ui_aspect();
float ud_arrow_width = line_height * render_get_ui_aspect(); float ud_arrow_width = line_height * machine->render().ui_aspect();
float gutter_width = lr_arrow_width * 1.3f; float gutter_width = lr_arrow_width * 1.3f;
float x1, y1, x2, y2; float x1, y1, x2, y2;
@ -763,11 +768,11 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
float total_width; float total_width;
/* compute width of left hand side */ /* compute width of left hand side */
total_width = gutter_width + ui_get_string_width(item->text) + gutter_width; total_width = gutter_width + ui_get_string_width(*machine, item->text) + gutter_width;
/* add in width of right hand side */ /* add in width of right hand side */
if (item->subtext) if (item->subtext)
total_width += 2.0f * gutter_width + ui_get_string_width(item->subtext); total_width += 2.0f * gutter_width + ui_get_string_width(*machine, item->subtext);
/* track the maximum */ /* track the maximum */
if (total_width > visible_width) if (total_width > visible_width)
@ -828,7 +833,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
{ {
mouse_target = ui_input_find_mouse(machine, &mouse_target_x, &mouse_target_y, &mouse_button); mouse_target = ui_input_find_mouse(machine, &mouse_target_x, &mouse_target_y, &mouse_button);
if (mouse_target != NULL) if (mouse_target != NULL)
if (render_target_map_point_container(mouse_target, mouse_target_x, mouse_target_y, menu->container, &mouse_x, &mouse_y)) if (mouse_target->map_point_container(mouse_target_x, mouse_target_y, *menu->container, mouse_x, mouse_y))
mouse_hit = TRUE; mouse_hit = TRUE;
} }
@ -874,13 +879,13 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
/* if we have some background hilighting to do, add a quad behind everything else */ /* if we have some background hilighting to do, add a quad behind everything else */
if (bgcolor != UI_TEXT_BG_COLOR) if (bgcolor != UI_TEXT_BG_COLOR)
render_container_add_quad(menu->container, line_x0, line_y0, line_x1, line_y1, bgcolor, hilight_texture, menu->container->add_quad(line_x0, line_y0, line_x1, line_y1, bgcolor, hilight_texture,
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE)); PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_TEXWRAP(TRUE));
/* if we're on the top line, display the up arrow */ /* if we're on the top line, display the up arrow */
if (linenum == 0 && top_line != 0) if (linenum == 0 && top_line != 0)
{ {
render_container_add_quad( menu->container, menu->container->add_quad(
0.5f * (x1 + x2) - 0.5f * ud_arrow_width, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
line_y + 0.25f * line_height, line_y + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width, 0.5f * (x1 + x2) + 0.5f * ud_arrow_width,
@ -895,7 +900,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
/* if we're on the bottom line, display the down arrow */ /* if we're on the bottom line, display the down arrow */
else if (linenum == visible_lines - 1 && itemnum != menu->numitems - 1) else if (linenum == visible_lines - 1 && itemnum != menu->numitems - 1)
{ {
render_container_add_quad( menu->container, menu->container->add_quad(
0.5f * (x1 + x2) - 0.5f * ud_arrow_width, 0.5f * (x1 + x2) - 0.5f * ud_arrow_width,
line_y + 0.25f * line_height, line_y + 0.25f * line_height,
0.5f * (x1 + x2) + 0.5f * ud_arrow_width, 0.5f * (x1 + x2) + 0.5f * ud_arrow_width,
@ -909,7 +914,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
/* if we're just a divider, draw a line */ /* if we're just a divider, draw a line */
else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0) else if (strcmp(itemtext, MENU_SEPARATOR_ITEM) == 0)
render_container_add_line(menu->container, visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); menu->container->add_line(visible_left, line_y + 0.5f * line_height, visible_left + visible_width, line_y + 0.5f * line_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* if we don't have a subitem, just draw the string centered */ /* if we don't have a subitem, just draw the string centered */
else if (item->subtext == NULL) else if (item->subtext == NULL)
@ -931,7 +936,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
item_width += 2.0f * gutter_width; item_width += 2.0f * gutter_width;
/* if the subitem doesn't fit here, display dots */ /* if the subitem doesn't fit here, display dots */
if (ui_get_string_width(subitem_text) > effective_width - item_width) if (ui_get_string_width(*machine, subitem_text) > effective_width - item_width)
{ {
subitem_text = "..."; subitem_text = "...";
if (itemnum == menu->selected) if (itemnum == menu->selected)
@ -945,7 +950,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
/* apply arrows */ /* apply arrows */
if (itemnum == menu->selected && (item->flags & MENU_FLAG_LEFT_ARROW)) if (itemnum == menu->selected && (item->flags & MENU_FLAG_LEFT_ARROW))
{ {
render_container_add_quad( menu->container, menu->container->add_quad(
effective_left + effective_width - subitem_width - gutter_width, effective_left + effective_width - subitem_width - gutter_width,
line_y + 0.1f * line_height, line_y + 0.1f * line_height,
effective_left + effective_width - subitem_width - gutter_width + lr_arrow_width, effective_left + effective_width - subitem_width - gutter_width + lr_arrow_width,
@ -956,7 +961,7 @@ static void ui_menu_draw(running_machine *machine, ui_menu *menu, int customonly
} }
if (itemnum == menu->selected && (item->flags & MENU_FLAG_RIGHT_ARROW)) if (itemnum == menu->selected && (item->flags & MENU_FLAG_RIGHT_ARROW))
{ {
render_container_add_quad( menu->container, menu->container->add_quad(
effective_left + effective_width + gutter_width - lr_arrow_width, effective_left + effective_width + gutter_width - lr_arrow_width,
line_y + 0.1f * line_height, line_y + 0.1f * line_height,
effective_left + effective_width + gutter_width, effective_left + effective_width + gutter_width,
@ -1019,8 +1024,8 @@ static void ui_menu_draw_text_box(ui_menu *menu)
{ {
const char *text = menu->item[0].text; const char *text = menu->item[0].text;
const char *backtext = menu->item[1].text; const char *backtext = menu->item[1].text;
float line_height = ui_get_line_height(); float line_height = ui_get_line_height(*menu->machine);
float lr_arrow_width = 0.4f * line_height * render_get_ui_aspect(); float lr_arrow_width = 0.4f * line_height * menu->machine->render().ui_aspect();
float gutter_width = lr_arrow_width; float gutter_width = lr_arrow_width;
float target_width, target_height, prior_width; float target_width, target_height, prior_width;
float target_x, target_y; float target_x, target_y;
@ -1033,7 +1038,7 @@ static void ui_menu_draw_text_box(ui_menu *menu)
target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height; target_height = floor((1.0f - 2.0f * UI_BOX_TB_BORDER) / line_height) * line_height;
/* maximum against "return to prior menu" text */ /* maximum against "return to prior menu" text */
prior_width = ui_get_string_width(backtext) + 2.0f * gutter_width; prior_width = ui_get_string_width(*menu->machine, backtext) + 2.0f * gutter_width;
target_width = MAX(target_width, prior_width); target_width = MAX(target_width, prior_width);
/* determine the target location */ /* determine the target location */
@ -1059,7 +1064,7 @@ static void ui_menu_draw_text_box(ui_menu *menu)
JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); JUSTIFY_LEFT, WRAP_WORD, DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
/* draw the "return to prior menu" text with a hilight behind it */ /* draw the "return to prior menu" text with a hilight behind it */
render_container_add_quad(menu->container, menu->container->add_quad(
target_x + 0.5f * UI_LINE_WIDTH, target_x + 0.5f * UI_LINE_WIDTH,
target_y + target_height - line_height, target_y + target_height - line_height,
target_x + target_width - 0.5f * UI_LINE_WIDTH, target_x + target_width - 0.5f * UI_LINE_WIDTH,
@ -1557,7 +1562,7 @@ static void menu_main_populate(running_machine *machine, ui_menu *menu, void *st
ui_menu_item_append(menu, "Slider Controls", NULL, 0, (void *)menu_sliders); ui_menu_item_append(menu, "Slider Controls", NULL, 0, (void *)menu_sliders);
/* add video options menu */ /* add video options menu */
ui_menu_item_append(menu, "Video Options", NULL, 0, (render_target_get_indexed(1) != NULL) ? (void *)menu_video_targets : (void *)menu_video_options); ui_menu_item_append(menu, "Video Options", NULL, 0, (machine->render().target_by_index(1) != NULL) ? (void *)menu_video_targets : (void *)menu_video_options);
/* add crosshair options menu */ /* add crosshair options menu */
if (crosshair_get_usage(machine)) if (crosshair_get_usage(machine))
@ -2177,8 +2182,8 @@ static void menu_settings_custom_render(running_machine *machine, ui_menu *menu,
static void menu_settings_custom_render_one(render_container *container, float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask) static void menu_settings_custom_render_one(render_container *container, float x1, float y1, float x2, float y2, const dip_descriptor *dip, UINT32 selectedmask)
{ {
float switch_field_width = SINGLE_TOGGLE_SWITCH_FIELD_WIDTH * render_get_ui_aspect(); float switch_field_width = SINGLE_TOGGLE_SWITCH_FIELD_WIDTH * container->manager().ui_aspect();
float switch_width = SINGLE_TOGGLE_SWITCH_WIDTH * render_get_ui_aspect(); float switch_width = SINGLE_TOGGLE_SWITCH_WIDTH * container->manager().ui_aspect();
int numtoggles, toggle; int numtoggles, toggle;
float switch_toggle_gap; float switch_toggle_gap;
float y1_off, y1_on; float y1_off, y1_on;
@ -2194,7 +2199,7 @@ static void menu_settings_custom_render_one(render_container *container, float x
dip->name, dip->name,
0, 0,
y1 + (DIP_SWITCH_HEIGHT - UI_TARGET_FONT_HEIGHT) / 2, y1 + (DIP_SWITCH_HEIGHT - UI_TARGET_FONT_HEIGHT) / 2,
x1 - ui_get_string_width(" "), x1 - ui_get_string_width(container->manager().machine(), " "),
JUSTIFY_RIGHT, JUSTIFY_RIGHT,
WRAP_NEVER, WRAP_NEVER,
DRAW_NORMAL, DRAW_NORMAL,
@ -2223,13 +2228,13 @@ static void menu_settings_custom_render_one(render_container *container, float x
if (dip->mask & (1 << toggle)) if (dip->mask & (1 << toggle))
{ {
float innery1 = (dip->state & (1 << toggle)) ? y1_on : y1_off; float innery1 = (dip->state & (1 << toggle)) ? y1_on : y1_off;
render_container_add_rect(container, innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT, container->add_rect(innerx1, innery1, innerx1 + switch_width, innery1 + SINGLE_TOGGLE_SWITCH_HEIGHT,
(selectedmask & (1 << toggle)) ? UI_DIPSW_COLOR : UI_TEXT_COLOR, (selectedmask & (1 << toggle)) ? UI_DIPSW_COLOR : UI_TEXT_COLOR,
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
else else
{ {
render_container_add_rect(container, innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT, container->add_rect(innerx1, y1_off, innerx1 + switch_width, y1_on + SINGLE_TOGGLE_SWITCH_HEIGHT,
UI_UNAVAILABLE_COLOR, UI_UNAVAILABLE_COLOR,
PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
} }
@ -2871,7 +2876,7 @@ static void menu_sliders_populate(running_machine *machine, ui_menu *menu, int m
break; break;
} }
ui_menu_set_custom_render(menu, menu_sliders_custom_render, 0.0f, 2.0f * ui_get_line_height() + 2.0f * UI_BOX_TB_BORDER); ui_menu_set_custom_render(menu, menu_sliders_custom_render, 0.0f, 2.0f * ui_get_line_height(*machine) + 2.0f * UI_BOX_TB_BORDER);
} }
@ -2886,7 +2891,7 @@ static void menu_sliders_custom_render(running_machine *machine, ui_menu *menu,
if (curslider != NULL) if (curslider != NULL)
{ {
float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x; float bar_left, bar_area_top, bar_width, bar_area_height, bar_top, bar_bottom, default_x, current_x;
float line_height = ui_get_line_height(); float line_height = ui_get_line_height(*machine);
float percentage, default_percentage; float percentage, default_percentage;
astring tempstring; astring tempstring;
float text_height; float text_height;
@ -2929,15 +2934,15 @@ static void menu_sliders_custom_render(running_machine *machine, ui_menu *menu,
current_x = bar_left + bar_width * percentage; current_x = bar_left + bar_width * percentage;
/* fill in the percentage */ /* fill in the percentage */
render_container_add_rect(menu->container, bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); menu->container->add_rect(bar_left, bar_top, current_x, bar_bottom, UI_SLIDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* draw the top and bottom lines */ /* draw the top and bottom lines */
render_container_add_line(menu->container, bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); menu->container->add_line(bar_left, bar_top, bar_left + bar_width, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(menu->container, bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); menu->container->add_line(bar_left, bar_bottom, bar_left + bar_width, bar_bottom, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* draw default marker */ /* draw default marker */
render_container_add_line(menu->container, default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); menu->container->add_line(default_x, bar_area_top, default_x, bar_top, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
render_container_add_line(menu->container, default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); menu->container->add_line(default_x, bar_bottom, default_x, bar_area_top + bar_area_height, UI_LINE_WIDTH, UI_BORDER_COLOR, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
/* draw the actual text */ /* draw the actual text */
ui_draw_text_full(menu->container, tempstring, x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER, ui_draw_text_full(menu->container, tempstring, x1 + UI_BOX_LR_BORDER, y1 + line_height, x2 - x1 - 2.0f * UI_BOX_LR_BORDER,
@ -2978,7 +2983,7 @@ static void menu_video_targets_populate(running_machine *machine, ui_menu *menu)
/* find the targets */ /* find the targets */
for (targetnum = 0; ; targetnum++) for (targetnum = 0; ; targetnum++)
{ {
render_target *target = render_target_get_indexed(targetnum); render_target *target = machine->render().target_by_index(targetnum);
char buffer[40]; char buffer[40];
/* stop when we run out */ /* stop when we run out */
@ -2999,7 +3004,7 @@ static void menu_video_targets_populate(running_machine *machine, ui_menu *menu)
static void menu_video_options(running_machine *machine, ui_menu *menu, void *parameter, void *state) static void menu_video_options(running_machine *machine, ui_menu *menu, void *parameter, void *state)
{ {
render_target *target = (parameter != NULL) ? (render_target *)parameter : render_target_get_indexed(0); render_target *target = (parameter != NULL) ? (render_target *)parameter : machine->render().first_target();
const ui_menu_event *event; const ui_menu_event *event;
int changed = FALSE; int changed = FALSE;
@ -3018,26 +3023,47 @@ static void menu_video_options(running_machine *machine, ui_menu *menu, void *pa
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT) if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
{ {
int delta = (event->iptkey == IPT_UI_LEFT) ? ROT270 : ROT90; int delta = (event->iptkey == IPT_UI_LEFT) ? ROT270 : ROT90;
render_target_set_orientation(target, orientation_add(delta, render_target_get_orientation(target))); target->set_orientation(orientation_add(delta, target->orientation()));
if (target == render_get_ui_target()) if (target->is_ui_target())
{ {
render_container_user_settings settings; render_container::user_settings settings;
render_container_get_user_settings(menu->container, &settings); menu->container->get_user_settings(settings);
settings.orientation = orientation_add(delta ^ ROT180, settings.orientation); settings.m_orientation = orientation_add(delta ^ ROT180, settings.m_orientation);
render_container_set_user_settings(menu->container, &settings); menu->container->set_user_settings(settings);
} }
changed = TRUE; changed = TRUE;
} }
break; break;
/* layer config bitmasks handle left/right keys the same (toggle) */ /* layer config bitmasks handle left/right keys the same (toggle) */
case LAYER_CONFIG_ENABLE_BACKDROP: case VIDEO_ITEM_BACKDROPS:
case LAYER_CONFIG_ENABLE_OVERLAY:
case LAYER_CONFIG_ENABLE_BEZEL:
case LAYER_CONFIG_ZOOM_TO_SCREEN:
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT) if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
{ {
render_target_set_layer_config(target, render_target_get_layer_config(target) ^ (FPTR)event->itemref); target->set_backdrops_enabled(!target->backdrops_enabled());
changed = TRUE;
}
break;
case VIDEO_ITEM_OVERLAYS:
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
{
target->set_overlays_enabled(!target->overlays_enabled());
changed = TRUE;
}
break;
case VIDEO_ITEM_BEZELS:
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
{
target->set_bezels_enabled(!target->bezels_enabled());
changed = TRUE;
}
break;
case VIDEO_ITEM_ZOOM:
if (event->iptkey == IPT_UI_LEFT || event->iptkey == IPT_UI_RIGHT)
{
target->set_zoom_to_screen(!target->zoom_to_screen());
changed = TRUE; changed = TRUE;
} }
break; break;
@ -3046,7 +3072,7 @@ static void menu_video_options(running_machine *machine, ui_menu *menu, void *pa
default: default:
if (event->iptkey == IPT_UI_SELECT && (int)(FPTR)event->itemref >= VIDEO_ITEM_VIEW) if (event->iptkey == IPT_UI_SELECT && (int)(FPTR)event->itemref >= VIDEO_ITEM_VIEW)
{ {
render_target_set_view(target, (FPTR)event->itemref - VIDEO_ITEM_VIEW); target->set_view((FPTR)event->itemref - VIDEO_ITEM_VIEW);
changed = TRUE; changed = TRUE;
} }
break; break;
@ -3066,7 +3092,6 @@ static void menu_video_options(running_machine *machine, ui_menu *menu, void *pa
static void menu_video_options_populate(running_machine *machine, ui_menu *menu, render_target *target) static void menu_video_options_populate(running_machine *machine, ui_menu *menu, render_target *target)
{ {
int layermask = render_target_get_layer_config(target);
const char *subtext = ""; const char *subtext = "";
astring tempstring; astring tempstring;
int viewnum; int viewnum;
@ -3075,7 +3100,7 @@ static void menu_video_options_populate(running_machine *machine, ui_menu *menu,
/* add items for each view */ /* add items for each view */
for (viewnum = 0; ; viewnum++) for (viewnum = 0; ; viewnum++)
{ {
const char *name = render_target_get_view_name(target, viewnum); const char *name = target->view_name(viewnum);
if (name == NULL) if (name == NULL)
break; break;
@ -3088,7 +3113,7 @@ static void menu_video_options_populate(running_machine *machine, ui_menu *menu,
ui_menu_item_append(menu, MENU_SEPARATOR_ITEM, NULL, 0, NULL); ui_menu_item_append(menu, MENU_SEPARATOR_ITEM, NULL, 0, NULL);
/* add a rotate item */ /* add a rotate item */
switch (render_target_get_orientation(target)) switch (target->orientation())
{ {
case ROT0: subtext = "None"; break; case ROT0: subtext = "None"; break;
case ROT90: subtext = "CW 90" UTF8_DEGREES; break; case ROT90: subtext = "CW 90" UTF8_DEGREES; break;
@ -3098,20 +3123,20 @@ static void menu_video_options_populate(running_machine *machine, ui_menu *menu,
ui_menu_item_append(menu, "Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE); ui_menu_item_append(menu, "Rotate", subtext, MENU_FLAG_LEFT_ARROW | MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_ROTATE);
/* backdrop item */ /* backdrop item */
enabled = layermask & LAYER_CONFIG_ENABLE_BACKDROP; enabled = target->backdrops_enabled();
ui_menu_item_append(menu, "Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_BACKDROP); ui_menu_item_append(menu, "Backdrops", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BACKDROPS);
/* overlay item */ /* overlay item */
enabled = layermask & LAYER_CONFIG_ENABLE_OVERLAY; enabled = target->overlays_enabled();
ui_menu_item_append(menu, "Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_OVERLAY); ui_menu_item_append(menu, "Overlays", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_OVERLAYS);
/* bezel item */ /* bezel item */
enabled = layermask & LAYER_CONFIG_ENABLE_BEZEL; enabled = target->bezels_enabled();
ui_menu_item_append(menu, "Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)LAYER_CONFIG_ENABLE_BEZEL); ui_menu_item_append(menu, "Bezels", enabled ? "Enabled" : "Disabled", enabled ? MENU_FLAG_LEFT_ARROW : MENU_FLAG_RIGHT_ARROW, (void *)VIDEO_ITEM_BEZELS);
/* cropping */ /* cropping */
enabled = layermask & LAYER_CONFIG_ZOOM_TO_SCREEN; enabled = target->zoom_to_screen();
ui_menu_item_append(menu, "View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)LAYER_CONFIG_ZOOM_TO_SCREEN); ui_menu_item_append(menu, "View", enabled ? "Cropped" : "Full", enabled ? MENU_FLAG_RIGHT_ARROW : MENU_FLAG_LEFT_ARROW, (void *)VIDEO_ITEM_ZOOM);
} }
@ -3556,7 +3581,7 @@ static void menu_select_game_populate(running_machine *machine, ui_menu *menu, s
} }
/* configure the custom rendering */ /* configure the custom rendering */
ui_menu_set_custom_render(menu, menu_select_game_custom_render, ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER, 4.0f * ui_get_line_height() + 3.0f * UI_BOX_TB_BORDER); ui_menu_set_custom_render(menu, menu_select_game_custom_render, ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER, 4.0f * ui_get_line_height(*machine) + 3.0f * UI_BOX_TB_BORDER);
} }
@ -3787,7 +3812,7 @@ static void menu_select_game_custom_render(running_machine *machine, ui_menu *me
{ {
ui_draw_text_full(menu->container, &tempbuf[line][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE, ui_draw_text_full(menu->container, &tempbuf[line][0], x1, y1, x2 - x1, JUSTIFY_CENTER, WRAP_TRUNCATE,
DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL); DRAW_NORMAL, UI_TEXT_COLOR, UI_TEXT_BG_COLOR, NULL, NULL);
y1 += ui_get_line_height(); y1 += ui_get_line_height(*machine);
} }
} }
@ -3803,23 +3828,23 @@ static void menu_select_game_custom_render(running_machine *machine, ui_menu *me
indicators indicators
-------------------------------------------------*/ -------------------------------------------------*/
static void menu_render_triangle(bitmap_t *dest, const bitmap_t *source, const rectangle *sbounds, void *param) static void menu_render_triangle(bitmap_t &dest, const bitmap_t &source, const rectangle &sbounds, void *param)
{ {
int halfwidth = dest->width / 2; int halfwidth = dest.width / 2;
int height = dest->height; int height = dest.height;
int x, y; int x, y;
/* start with all-transparent */ /* start with all-transparent */
bitmap_fill(dest, NULL, MAKE_ARGB(0x00,0x00,0x00,0x00)); bitmap_fill(&dest, NULL, MAKE_ARGB(0x00,0x00,0x00,0x00));
/* render from the tip to the bottom */ /* render from the tip to the bottom */
for (y = 0; y < height; y++) for (y = 0; y < height; y++)
{ {
int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height; int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height;
UINT32 *target = BITMAP_ADDR32(dest, y, halfwidth); UINT32 *target = BITMAP_ADDR32(&dest, y, halfwidth);
/* don't antialias if height < 12 */ /* don't antialias if height < 12 */
if (dest->height < 12) if (dest.height < 12)
{ {
int pixels = (linewidth + 254) / 255; int pixels = (linewidth + 254) / 255;
if (pixels % 2 == 0) pixels++; if (pixels % 2 == 0) pixels++;

View File

@ -193,7 +193,7 @@ static void video_mng_record_frame(running_machine *machine);
static void video_avi_record_frame(running_machine *machine); static void video_avi_record_frame(running_machine *machine);
/* software rendering */ /* software rendering */
static void rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void rgb888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
@ -311,18 +311,16 @@ void video_init(running_machine *machine)
/* the native target is hard-coded to our internal layout and has all options disabled */ /* the native target is hard-coded to our internal layout and has all options disabled */
if (global.snap_native) if (global.snap_native)
{ {
global.snap_target = render_target_alloc(machine, layout_snap, RENDER_CREATE_SINGLE_FILE | RENDER_CREATE_HIDDEN); global.snap_target = machine->render().target_alloc(layout_snap, RENDER_CREATE_SINGLE_FILE | RENDER_CREATE_HIDDEN);
assert(global.snap_target != NULL); global.snap_target->set_layer_config(0);
render_target_set_layer_config(global.snap_target, 0);
} }
/* other targets select the specified view and turn off effects */ /* other targets select the specified view and turn off effects */
else else
{ {
global.snap_target = render_target_alloc(machine, NULL, RENDER_CREATE_HIDDEN); global.snap_target = machine->render().target_alloc(NULL, RENDER_CREATE_HIDDEN);
assert(global.snap_target != NULL); global.snap_target->set_view(video_get_view_for_target(machine, global.snap_target, viewname, 0, 1));
render_target_set_view(global.snap_target, video_get_view_for_target(machine, global.snap_target, viewname, 0, 1)); global.snap_target->set_screen_overlay_enabled(false);
render_target_set_layer_config(global.snap_target, render_target_get_layer_config(global.snap_target) & ~LAYER_CONFIG_ENABLE_SCREEN_OVERLAY);
} }
/* extract snap resolution if present */ /* extract snap resolution if present */
@ -364,8 +362,7 @@ static void video_exit(running_machine &machine)
gfx_element_free(machine.gfx[i]); gfx_element_free(machine.gfx[i]);
/* free the snapshot target */ /* free the snapshot target */
if (global.snap_target != NULL) machine.render().target_free(global.snap_target);
render_target_free(global.snap_target);
if (global.snap_bitmap != NULL) if (global.snap_bitmap != NULL)
global_free(global.snap_bitmap); global_free(global.snap_bitmap);
@ -455,7 +452,7 @@ void video_frame_update(running_machine *machine, int debug)
} }
/* draw the user interface */ /* draw the user interface */
ui_update_and_render(machine, render_container_get_ui()); ui_update_and_render(machine, &machine->render().ui_container());
/* update the internal render debugger */ /* update the internal render debugger */
debugint_update_during_game(machine); debugint_update_during_game(machine);
@ -991,7 +988,7 @@ static void update_refresh_speed(running_machine *machine)
/* only do this if the refreshspeed option is used */ /* only do this if the refreshspeed option is used */
if (options_get_bool(machine->options(), OPTION_REFRESHSPEED)) if (options_get_bool(machine->options(), OPTION_REFRESHSPEED))
{ {
float minrefresh = render_get_max_update_rate(); float minrefresh = machine->render().max_update_rate();
if (minrefresh != 0) if (minrefresh != 0)
{ {
attoseconds_t min_frame_period = ATTOSECONDS_PER_SECOND; attoseconds_t min_frame_period = ATTOSECONDS_PER_SECOND;
@ -1156,7 +1153,7 @@ void video_save_active_screen_snapshots(running_machine *machine)
{ {
/* write one snapshot per visible screen */ /* write one snapshot per visible screen */
for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen)) for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen))
if (render_is_live_screen(screen)) if (machine->render().is_live(*screen))
{ {
file_error filerr = mame_fopen_next(machine, SEARCHPATH_SCREENSHOT, "png", &fp); file_error filerr = mame_fopen_next(machine, SEARCHPATH_SCREENSHOT, "png", &fp);
if (filerr == FILERR_NONE) if (filerr == FILERR_NONE)
@ -1188,7 +1185,6 @@ void video_save_active_screen_snapshots(running_machine *machine)
static void create_snapshot_bitmap(device_t *screen) static void create_snapshot_bitmap(device_t *screen)
{ {
const render_primitive_list *primlist;
INT32 width, height; INT32 width, height;
int view_index; int view_index;
@ -1197,15 +1193,15 @@ static void create_snapshot_bitmap(device_t *screen)
{ {
view_index = screen->machine->m_devicelist.index(SCREEN, screen->tag()); view_index = screen->machine->m_devicelist.index(SCREEN, screen->tag());
assert(view_index != -1); assert(view_index != -1);
render_target_set_view(global.snap_target, view_index); global.snap_target->set_view(view_index);
} }
/* get the minimum width/height and set it on the target */ /* get the minimum width/height and set it on the target */
width = global.snap_width; width = global.snap_width;
height = global.snap_height; height = global.snap_height;
if (width == 0 || height == 0) if (width == 0 || height == 0)
render_target_get_minimum_size(global.snap_target, &width, &height); global.snap_target->compute_minimum_size(width, height);
render_target_set_bounds(global.snap_target, width, height, 0); global.snap_target->set_bounds(width, height);
/* if we don't have a bitmap, or if it's not the right size, allocate a new one */ /* if we don't have a bitmap, or if it's not the right size, allocate a new one */
if (global.snap_bitmap == NULL || width != global.snap_bitmap->width || height != global.snap_bitmap->height) if (global.snap_bitmap == NULL || width != global.snap_bitmap->width || height != global.snap_bitmap->height)
@ -1217,10 +1213,10 @@ static void create_snapshot_bitmap(device_t *screen)
} }
/* render the screen there */ /* render the screen there */
primlist = render_target_get_primitives(global.snap_target); render_primitive_list &primlist = global.snap_target->get_primitives();
osd_lock_acquire(primlist->lock); primlist.acquire_lock();
rgb888_draw_primitives(primlist->head, global.snap_bitmap->base, width, height, global.snap_bitmap->rowpixels); rgb888_draw_primitives(primlist, global.snap_bitmap->base, width, height, global.snap_bitmap->rowpixels);
osd_lock_release(primlist->lock); primlist.release_lock();
} }
@ -1586,7 +1582,7 @@ int video_get_view_for_target(running_machine *machine, render_target *target, c
/* scan for a matching view name */ /* scan for a matching view name */
for (viewindex = 0; ; viewindex++) for (viewindex = 0; ; viewindex++)
{ {
const char *name = render_target_get_view_name(target, viewindex); const char *name = target->view_name(viewindex);
/* stop scanning when we hit NULL */ /* stop scanning when we hit NULL */
if (name == NULL) if (name == NULL)
@ -1610,7 +1606,7 @@ int video_get_view_for_target(running_machine *machine, render_target *target, c
/* find the first view with this screen and this screen only */ /* find the first view with this screen and this screen only */
for (viewindex = 0; ; viewindex++) for (viewindex = 0; ; viewindex++)
{ {
UINT32 viewscreens = render_target_get_view_screens(target, viewindex); UINT32 viewscreens = target->view_screens(viewindex);
if (viewscreens == (1 << targetindex)) if (viewscreens == (1 << targetindex))
break; break;
if (viewscreens == 0) if (viewscreens == 0)
@ -1626,7 +1622,7 @@ int video_get_view_for_target(running_machine *machine, render_target *target, c
{ {
for (viewindex = 0; ; viewindex++) for (viewindex = 0; ; viewindex++)
{ {
UINT32 viewscreens = render_target_get_view_screens(target, viewindex); UINT32 viewscreens = target->view_screens(viewindex);
if (viewscreens == (1 << scrcount) - 1) if (viewscreens == (1 << scrcount) - 1)
break; break;
if (viewscreens == 0) if (viewscreens == 0)
@ -1636,7 +1632,7 @@ int video_get_view_for_target(running_machine *machine, render_target *target, c
} }
/* make sure it's a valid view */ /* make sure it's a valid view */
if (render_target_get_view_name(target, viewindex) == NULL) if (target->view_name(viewindex) == NULL)
viewindex = 0; viewindex = 0;
return viewindex; return viewindex;
@ -1897,6 +1893,7 @@ bool screen_device_config::device_validity_check(const game_driver &driver) cons
screen_device::screen_device(running_machine &_machine, const screen_device_config &config) screen_device::screen_device(running_machine &_machine, const screen_device_config &config)
: device_t(_machine, config), : device_t(_machine, config),
m_config(config), m_config(config),
m_container(NULL),
m_width(m_config.m_width), m_width(m_config.m_width),
m_height(m_config.m_height), m_height(m_config.m_height),
m_visarea(m_config.m_visarea), m_visarea(m_config.m_visarea),
@ -1930,10 +1927,8 @@ screen_device::screen_device(running_machine &_machine, const screen_device_conf
screen_device::~screen_device() screen_device::~screen_device()
{ {
if (m_texture[0] != NULL) m_machine.render().texture_free(m_texture[0]);
render_texture_free(m_texture[0]); m_machine.render().texture_free(m_texture[1]);
if (m_texture[1] != NULL)
render_texture_free(m_texture[1]);
if (m_burnin != NULL) if (m_burnin != NULL)
finalize_burnin(); finalize_burnin();
} }
@ -1946,17 +1941,16 @@ screen_device::~screen_device()
void screen_device::device_start() void screen_device::device_start()
{ {
// get and validate that the container for this screen exists // get and validate that the container for this screen exists
render_container *container = render_container_get_screen(this); m_container = m_machine.render().container_for_screen(this);
assert(container != NULL);
// configure the default cliparea // configure the default cliparea
render_container_user_settings settings; render_container::user_settings settings;
render_container_get_user_settings(container, &settings); m_container->get_user_settings(settings);
settings.xoffset = m_config.m_xoffset; settings.m_xoffset = m_config.m_xoffset;
settings.yoffset = m_config.m_yoffset; settings.m_yoffset = m_config.m_yoffset;
settings.xscale = m_config.m_xscale; settings.m_xscale = m_config.m_xscale;
settings.yscale = m_config.m_yscale; settings.m_yscale = m_config.m_yscale;
render_container_set_user_settings(container, &settings); m_container->set_user_settings(settings);
// allocate the VBLANK timers // allocate the VBLANK timers
m_vblank_begin_timer = timer_alloc(machine, static_vblank_begin_callback, (void *)this); m_vblank_begin_timer = timer_alloc(machine, static_vblank_begin_callback, (void *)this);
@ -2096,10 +2090,8 @@ void screen_device::realloc_screen_bitmaps()
if (m_width > curwidth || m_height > curheight) if (m_width > curwidth || m_height > curheight)
{ {
// free what we have currently // free what we have currently
if (m_texture[0] != NULL) global_free(m_texture[0]);
render_texture_free(m_texture[0]); global_free(m_texture[1]);
if (m_texture[1] != NULL)
render_texture_free(m_texture[1]);
if (m_bitmap[0] != NULL) if (m_bitmap[0] != NULL)
auto_free(machine, m_bitmap[0]); auto_free(machine, m_bitmap[0]);
if (m_bitmap[1] != NULL) if (m_bitmap[1] != NULL)
@ -2126,10 +2118,10 @@ void screen_device::realloc_screen_bitmaps()
bitmap_set_palette(m_bitmap[1], machine->palette); bitmap_set_palette(m_bitmap[1], machine->palette);
// allocate textures // allocate textures
m_texture[0] = render_texture_alloc(NULL, NULL); m_texture[0] = m_machine.render().texture_alloc();
render_texture_set_bitmap(m_texture[0], m_bitmap[0], &m_visarea, m_texture_format, palette); m_texture[0]->set_bitmap(m_bitmap[0], &m_visarea, m_texture_format, palette);
m_texture[1] = render_texture_alloc(NULL, NULL); m_texture[1] = m_machine.render().texture_alloc();
render_texture_set_bitmap(m_texture[1], m_bitmap[1], &m_visarea, m_texture_format, palette); m_texture[1]->set_bitmap(m_bitmap[1], &m_visarea, m_texture_format, palette);
} }
} }
@ -2180,7 +2172,7 @@ bool screen_device::update_partial(int scanline)
} }
// skip if this screen is not visible anywhere // skip if this screen is not visible anywhere
if (!render_is_live_screen(this)) if (!m_machine.render().is_live(*this))
{ {
LOG_PARTIAL_UPDATES(("skipped because screen not live\n")); LOG_PARTIAL_UPDATES(("skipped because screen not live\n"));
return FALSE; return FALSE;
@ -2460,7 +2452,7 @@ void screen_device::scanline_update_callback(int scanline)
bool screen_device::update_quads() bool screen_device::update_quads()
{ {
// only update if live // only update if live
if (render_is_live_screen(this)) if (m_machine.render().is_live(*this))
{ {
// only update if empty and not a vector game; otherwise assume the driver did it directly // only update if empty and not a vector game; otherwise assume the driver did it directly
if (m_config.m_type != SCREEN_TYPE_VECTOR && (machine->config->m_video_attributes & VIDEO_SELF_RENDER) == 0) if (m_config.m_type != SCREEN_TYPE_VECTOR && (machine->config->m_video_attributes & VIDEO_SELF_RENDER) == 0)
@ -2473,15 +2465,15 @@ bool screen_device::update_quads()
fixedvis.max_y++; fixedvis.max_y++;
palette_t *palette = (m_texture_format == TEXFORMAT_PALETTE16) ? machine->palette : NULL; palette_t *palette = (m_texture_format == TEXFORMAT_PALETTE16) ? machine->palette : NULL;
render_texture_set_bitmap(m_texture[m_curbitmap], m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette); m_texture[m_curbitmap]->set_bitmap(m_bitmap[m_curbitmap], &fixedvis, m_texture_format, palette);
m_curtexture = m_curbitmap; m_curtexture = m_curbitmap;
m_curbitmap = 1 - m_curbitmap; m_curbitmap = 1 - m_curbitmap;
} }
// create an empty container with a single quad // create an empty container with a single quad
render_container_empty(render_container_get_screen(this)); m_container->empty();
render_screen_add_quad(this, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), m_texture[m_curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); m_container->add_quad(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), m_texture[m_curtexture], PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1));
} }
} }

View File

@ -72,7 +72,7 @@ enum screen_type_enum
// forward references // forward references
class render_target; class render_target;
struct render_texture; class render_texture;
class screen_device; class screen_device;
@ -155,6 +155,7 @@ public:
int height() const { return m_height; } int height() const { return m_height; }
const rectangle &visible_area() const { return m_visarea; } const rectangle &visible_area() const { return m_visarea; }
bitmap_format format() const { return m_config.m_format; } bitmap_format format() const { return m_config.m_format; }
render_container &container() const { assert(m_container != NULL); return *m_container; }
// dynamic configuration // dynamic configuration
void configure(int width, int height, const rectangle &visarea, attoseconds_t frame_period); void configure(int width, int height, const rectangle &visarea, attoseconds_t frame_period);
@ -218,6 +219,7 @@ private:
// internal state // internal state
const screen_device_config &m_config; const screen_device_config &m_config;
render_container * m_container; // pointer to our container
// dimensions // dimensions
int m_width; // current width (HTOTAL) int m_width; // current width (HTOTAL)

View File

@ -269,8 +269,8 @@ VIDEO_UPDATE( vector )
curpoint = vector_list; curpoint = vector_list;
render_container_empty(render_container_get_screen(screen)); screen->container().empty();
render_screen_add_rect(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); screen->container().add_rect(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0x00,0x00,0x00), PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA));
clip.x0 = clip.y0 = 0.0f; clip.x0 = clip.y0 = 0.0f;
clip.x1 = clip.y1 = 1.0f; clip.x1 = clip.y1 = 1.0f;
@ -300,7 +300,7 @@ VIDEO_UPDATE( vector )
if (curpoint->intensity != 0) if (curpoint->intensity != 0)
if (!render_clip_line(&coords, &clip)) if (!render_clip_line(&coords, &clip))
render_screen_add_line(screen, coords.x0, coords.y0, coords.x1, coords.y1, screen->container().add_line(coords.x0, coords.y0, coords.x1, coords.y1,
beam_width * (1.0f / (float)VECTOR_WIDTH_DENOM), beam_width * (1.0f / (float)VECTOR_WIDTH_DENOM),
(curpoint->intensity << 24) | (curpoint->col & 0xffffff), (curpoint->intensity << 24) | (curpoint->col & 0xffffff),
flags); flags);

View File

@ -215,7 +215,7 @@ VIDEO_UPDATE( test_vcu )
if (dbg_info) if (dbg_info)
{ {
sprintf(buf,"I-info, G-gfx, C-color, V-vbank, 1-4 enable planes"); sprintf(buf,"I-info, G-gfx, C-color, V-vbank, 1-4 enable planes");
ui_draw_text(buf, 10, 0 * ui_get_line_height()); ui_draw_text(buf, 10, 0 * ui_get_line_height(*screen->machine));
sprintf(buf,"g:%1i c:%1i v:%1i vbk=%1i planes=%1i%1i%1i%1i ", dbg_gfx_e&1, dbg_clr_e&1, dbg_vbank, vbank&1, sprintf(buf,"g:%1i c:%1i v:%1i vbk=%1i planes=%1i%1i%1i%1i ", dbg_gfx_e&1, dbg_clr_e&1, dbg_vbank, vbank&1,
planes_enabled[0], planes_enabled[0],
@ -223,7 +223,7 @@ VIDEO_UPDATE( test_vcu )
planes_enabled[2], planes_enabled[2],
planes_enabled[3] ); planes_enabled[3] );
ui_draw_text(buf, 10, 1 * ui_get_line_height()); ui_draw_text(buf, 10, 1 * ui_get_line_height(*screen->machine));
if (dbg_lookup!=4) if (dbg_lookup!=4)
{ {
@ -238,7 +238,7 @@ VIDEO_UPDATE( test_vcu )
{ {
sprintf(buf + strlen(buf), "%02x ", lookup_ram[lookup_offs + x + y * 16]); sprintf(buf + strlen(buf), "%02x ", lookup_ram[lookup_offs + x + y * 16]);
} }
ui_draw_text(buf, 0, (2 + y) * ui_get_line_height()); ui_draw_text(buf, 0, (2 + y) * ui_get_line_height(*screen->machine));
} }
} }
} }

View File

@ -676,8 +676,8 @@ void fd1094_regenerate_key(running_machine *machine)
(*key_changed)(machine); (*key_changed)(machine);
/* force all memory and disassembly views to update */ /* force all memory and disassembly views to update */
machine->m_debug_view->update_all(DVT_MEMORY); machine->debug_view().update_all(DVT_MEMORY);
machine->m_debug_view->update_all(DVT_DISASSEMBLY); machine->debug_view().update_all(DVT_DISASSEMBLY);
/* reset keydirty */ /* reset keydirty */
keydirty = FALSE; keydirty = FALSE;
@ -1014,8 +1014,8 @@ static void execute_fdstate(running_machine *machine, int ref, int params, const
return; return;
fd1094_set_state(keyregion, newstate); fd1094_set_state(keyregion, newstate);
fd1094_regenerate_key(machine); fd1094_regenerate_key(machine);
machine->m_debug_view->update_all(DVT_MEMORY); machine->debug_view().update_all(DVT_MEMORY);
machine->m_debug_view->update_all(DVT_DISASSEMBLY); machine->debug_view().update_all(DVT_DISASSEMBLY);
} }
/* 0 parameters displays the current state */ /* 0 parameters displays the current state */

View File

@ -1077,7 +1077,7 @@ void deco16ic_print_debug_info(running_device *device, bitmap_t *bitmap)
sprintf(&buf[strlen(buf)],"%04X", deco16ic->priority); sprintf(&buf[strlen(buf)],"%04X", deco16ic->priority);
ui_draw_text(render_container_get_ui(), buf, 60, 40); ui_draw_text(&device->machine->render().ui_container(), buf, 60, 40);
} }
/*****************************************************************************************/ /*****************************************************************************************/

View File

@ -948,7 +948,7 @@ static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const recta
if (input_code_pressed(machine, KEYCODE_Z)) /* Display some info on each sprite */ if (input_code_pressed(machine, KEYCODE_Z)) /* Display some info on each sprite */
{ char buf[30]; { char buf[30];
sprintf(buf, "%02X",/*(s2[2] & ~0x3ff)>>8*/mode>>8); sprintf(buf, "%02X",/*(s2[2] & ~0x3ff)>>8*/mode>>8);
ui_draw_text(render_container_get_ui(), buf, sx, sy); ui_draw_text(&machine->render().ui_container(), buf, sx, sy);
} }
#endif #endif
@ -1129,7 +1129,7 @@ static void gdfs_draw_zooming_sprites(running_machine *machine, bitmap_t *bitmap
{ {
char buf[10]; char buf[10];
sprintf(buf, "%X",size); sprintf(buf, "%X",size);
ui_draw_text(render_container_get_ui(), buf, sx / 0x10000, sy / 0x10000); ui_draw_text(&machine->render().ui_container(), buf, sx / 0x10000, sy / 0x10000);
} }
#endif #endif
} /* single-sprites */ } /* single-sprites */

View File

@ -411,7 +411,7 @@ static int (**dpix_sp[9])(UINT32 s_pix);
/******************************************************************************/ /******************************************************************************/
static void print_debug_info(bitmap_t *bitmap) static void print_debug_info(running_machine *machine, bitmap_t *bitmap)
{ {
int l[16]; int l[16];
char buf[64*16]; char buf[64*16];
@ -480,7 +480,7 @@ static void print_debug_info(bitmap_t *bitmap)
l[3]=f3_line_ram[0x15e0]&0xffff; l[3]=f3_line_ram[0x15e0]&0xffff;
bufptr += sprintf(bufptr,"5000: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]); bufptr += sprintf(bufptr,"5000: %04x %04x %04x %04x\n",l[0],l[1],l[2],l[3]);
ui_draw_text(render_container_get_ui(), buf, 60, 40); ui_draw_text(&machine->render().ui_container(), buf, 60, 40);
} }
/******************************************************************************/ /******************************************************************************/
@ -3292,6 +3292,6 @@ VIDEO_UPDATE( f3 )
scanline_draw(screen->machine, bitmap,cliprect); scanline_draw(screen->machine, bitmap,cliprect);
if (VERBOSE) if (VERBOSE)
print_debug_info(bitmap); print_debug_info(screen->machine, bitmap);
return 0; return 0;
} }

View File

@ -124,7 +124,6 @@ static UINT8 *tx1_obj_bmp;
static UINT8 *tx1_rod_bmp; static UINT8 *tx1_rod_bmp;
static bitmap_t *tx1_bitmap; static bitmap_t *tx1_bitmap;
static render_texture *tx1_texture;
/*************************************************************************** /***************************************************************************
@ -1122,7 +1121,6 @@ VIDEO_START( tx1 )
{ {
/* Allocate a large bitmap that covers the three screens */ /* Allocate a large bitmap that covers the three screens */
tx1_bitmap = auto_bitmap_alloc(machine, 768, 256, BITMAP_FORMAT_INDEXED16); tx1_bitmap = auto_bitmap_alloc(machine, 768, 256, BITMAP_FORMAT_INDEXED16);
tx1_texture = render_texture_alloc(NULL, NULL);
/* Allocate some bitmaps */ /* Allocate some bitmaps */
tx1_chr_bmp = auto_alloc_array(machine, UINT8, 256 * 3 * 240); tx1_chr_bmp = auto_alloc_array(machine, UINT8, 256 * 3 * 240);

View File

@ -105,9 +105,7 @@ int main(int argc, char *argv[])
void osd_init(running_machine *machine) void osd_init(running_machine *machine)
{ {
// initialize the video system by allocating a rendering target // initialize the video system by allocating a rendering target
our_target = render_target_alloc(machine, NULL, 0); our_target = machine->render().target_alloc();
if (our_target == NULL)
fatalerror("Error creating render target");
// nothing yet to do to initialize sound, since we don't have any // nothing yet to do to initialize sound, since we don't have any
// sound updates are handled by osd_update_audio_stream() below // sound updates are handled by osd_update_audio_stream() below
@ -164,13 +162,13 @@ void osd_update(running_machine *machine, int skip_redraw)
int minwidth, minheight; int minwidth, minheight;
// get the minimum width/height for the current layout // get the minimum width/height for the current layout
render_target_get_minimum_size(our_target, &minwidth, &minheight); our_target->compute_minimum_size(minwidth, minheight);
// make that the size of our target // make that the size of our target
render_target_set_bounds(our_target, minwidth, minheight, 0); our_target->render_target_set_bounds(minwidth, minheight);
// get the list of primitives for the target at the current size // get the list of primitives for the target at the current size
primlist = render_target_get_primitives(our_target); primlist = our_target->get_primitives();
// lock them, and then render them // lock them, and then render them
osd_lock_acquire(primlist->lock); osd_lock_acquire(primlist->lock);

View File

@ -686,8 +686,8 @@ static const render_primitive_list *draw13_window_get_primitives(sdl_window_info
{ {
sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height); sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height);
} }
render_target_set_bounds(window->target, 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 render_target_get_primitives(window->target); return window->target->get_primitives();
} }
//============================================================ //============================================================
@ -758,7 +758,7 @@ static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update)
switch (prim->type) switch (prim->type)
{ {
case RENDER_PRIMITIVE_LINE: case render_primitive::LINE:
sr = (int)(255.0f * prim->color.r); sr = (int)(255.0f * prim->color.r);
sg = (int)(255.0f * prim->color.g); sg = (int)(255.0f * prim->color.g);
sb = (int)(255.0f * prim->color.b); sb = (int)(255.0f * prim->color.b);
@ -769,7 +769,7 @@ static int draw13_window_draw(sdl_window_info *window, UINT32 dc, int update)
SDL_RenderDrawLine(prim->bounds.x0 + hofs, prim->bounds.y0 + vofs, SDL_RenderDrawLine(prim->bounds.x0 + hofs, prim->bounds.y0 + vofs,
prim->bounds.x1 + hofs, prim->bounds.y1 + vofs); prim->bounds.x1 + hofs, prim->bounds.y1 + vofs);
break; break;
case RENDER_PRIMITIVE_QUAD: case render_primitive::QUAD:
texture = texture_update(window, prim); texture = texture_update(window, prim);
if (texture) if (texture)
blit_pixels += (texture->rawheight * texture->rawwidth); blit_pixels += (texture->rawheight * texture->rawwidth);

View File

@ -349,7 +349,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 const render_primitive_list *drawogl_window_get_primitives(sdl_window_info *window); static render_primitive_list &drawogl_window_get_primitives(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);
@ -837,7 +837,7 @@ 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 const render_primitive_list *drawogl_window_get_primitives(sdl_window_info *window) static render_primitive_list &drawogl_window_get_primitives(sdl_window_info *window)
{ {
if ((!window->fullscreen) || (video_config.switchres)) if ((!window->fullscreen) || (video_config.switchres))
{ {
@ -847,8 +847,8 @@ static const render_primitive_list *drawogl_window_get_primitives(sdl_window_inf
{ {
sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height); sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height);
} }
render_target_set_bounds(window->target, 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 render_target_get_primitives(window->target); return window->target->get_primitives();
} }
//============================================================ //============================================================
@ -1324,10 +1324,10 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
sdl->last_hofs = hofs; sdl->last_hofs = hofs;
sdl->last_vofs = vofs; sdl->last_vofs = vofs;
osd_lock_acquire(window->primlist->lock); window->primlist->acquire_lock();
// now draw // now draw
for (prim = window->primlist->head; prim != NULL; prim = prim->next) for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
{ {
int i; int i;
@ -1337,7 +1337,7 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
* Try to stay in one Begin/End block as long as possible, * Try to stay in one Begin/End block as long as possible,
* since entering and leaving one is most expensive.. * since entering and leaving one is most expensive..
*/ */
case RENDER_PRIMITIVE_LINE: case render_primitive::LINE:
#if !USE_WIN32_STYLE_LINES #if !USE_WIN32_STYLE_LINES
// check if it's really a point // check if it's really a point
if (((prim->bounds.x1 - prim->bounds.x0) == 0) && ((prim->bounds.y1 - prim->bounds.y0) == 0)) if (((prim->bounds.x1 - prim->bounds.x0) == 0) && ((prim->bounds.y1 - prim->bounds.y0) == 0))
@ -1465,7 +1465,7 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
#endif #endif
break; break;
case RENDER_PRIMITIVE_QUAD: case render_primitive::QUAD:
if(pendingPrimitive!=GL_NO_PRIMITIVE) if(pendingPrimitive!=GL_NO_PRIMITIVE)
{ {
@ -1531,6 +1531,9 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
texture=NULL; texture=NULL;
} }
break; break;
default:
throw emu_fatalerror("Unexpected render_primitive type");
} }
} }
@ -1540,7 +1543,7 @@ static int drawogl_window_draw(sdl_window_info *window, UINT32 dc, int update)
pendingPrimitive=GL_NO_PRIMITIVE; pendingPrimitive=GL_NO_PRIMITIVE;
} }
osd_lock_release(window->primlist->lock); window->primlist->release_lock();
sdl->init_context = 0; sdl->init_context = 0;
#if (!SDL_VERSION_ATLEAST(1,3,0)) #if (!SDL_VERSION_ATLEAST(1,3,0))
@ -2945,7 +2948,7 @@ static void texture_shader_update(sdl_window_info *window, texture_info *texture
{ {
if (scrnum == window->start_viewscreen) if (scrnum == window->start_viewscreen)
{ {
container = render_container_get_screen(screen); container = &screen->container();
} }
scrnum++; scrnum++;
@ -2953,8 +2956,8 @@ static void texture_shader_update(sdl_window_info *window, texture_info *texture
if (container!=NULL) if (container!=NULL)
{ {
render_container_user_settings settings; render_container::user_settings settings;
render_container_get_user_settings(container, &settings); container->get_user_settings(settings);
//FIXME: Intended behaviour //FIXME: Intended behaviour
#if 1 #if 1
vid_attributes[0] = options_get_float(window->machine->options(), OPTION_GAMMA); vid_attributes[0] = options_get_float(window->machine->options(), OPTION_GAMMA);
@ -3128,10 +3131,10 @@ static void drawogl_destroy_all_textures(sdl_window_info *window)
SDL_GL_MakeCurrent(window->sdl_window, sdl->gl_context_id); SDL_GL_MakeCurrent(window->sdl_window, sdl->gl_context_id);
#endif #endif
if(window->primlist && window->primlist->lock) if(window->primlist)
{ {
lock=TRUE; lock=TRUE;
osd_lock_acquire(window->primlist->lock); window->primlist->acquire_lock();
} }
glFinish(); glFinish();
@ -3210,7 +3213,7 @@ static void drawogl_destroy_all_textures(sdl_window_info *window)
sdl->initialized = 0; sdl->initialized = 0;
if (lock) if (lock)
osd_lock_release(window->primlist->lock); window->primlist->release_lock();
} }
//============================================================ //============================================================

View File

@ -102,7 +102,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 const render_primitive_list *drawsdl_window_get_primitives(sdl_window_info *window); static render_primitive_list &drawsdl_window_get_primitives(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);
@ -113,11 +113,11 @@ static void setup_texture(sdl_window_info *window, int tempwidth, int tempheight
#endif #endif
// soft rendering // soft rendering
static void drawsdl_rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawsdl_rgb888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawsdl_bgr888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawsdl_bgr888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawsdl_bgra888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawsdl_bgra888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawsdl_rgb565_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawsdl_rgb565_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawsdl_rgb555_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawsdl_rgb555_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
// YUV overlays // YUV overlays
@ -265,7 +265,7 @@ static void setup_texture(sdl_window_info *window, int tempwidth, int tempheight
if (sdl_sm->is_scale) if (sdl_sm->is_scale)
{ {
render_target_get_minimum_size(window->target, &sdl->hw_scale_width, &sdl->hw_scale_height); window->target->compute_minimum_size(sdl->hw_scale_width, sdl->hw_scale_height);
if (video_config.prescale) if (video_config.prescale)
{ {
sdl->hw_scale_width *= video_config.prescale; sdl->hw_scale_width *= video_config.prescale;
@ -308,7 +308,7 @@ static void yuv_overlay_init(sdl_window_info *window)
const sdl_scale_mode *sdl_sm = sdl->scale_mode; const sdl_scale_mode *sdl_sm = sdl->scale_mode;
int minimum_width, minimum_height; int minimum_width, minimum_height;
render_target_get_minimum_size(window->target, &minimum_width, &minimum_height); window->target->compute_minimum_size(minimum_width, minimum_height);
if (video_config.prescale) if (video_config.prescale)
{ {
@ -615,7 +615,7 @@ 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 const render_primitive_list *drawsdl_window_get_primitives(sdl_window_info *window) static render_primitive_list &drawsdl_window_get_primitives(sdl_window_info *window)
{ {
sdl_info *sdl = (sdl_info *) window->dxdata; sdl_info *sdl = (sdl_info *) window->dxdata;
@ -628,10 +628,10 @@ static const render_primitive_list *drawsdl_window_get_primitives(sdl_window_inf
sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height); sdlwindow_blit_surface_size(window, window->monitor->center_width, window->monitor->center_height);
} }
if (!sdl->scale_mode->is_scale) if (!sdl->scale_mode->is_scale)
render_target_set_bounds(window->target, 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
render_target_set_bounds(window->target, sdl->hw_scale_width, sdl->hw_scale_height, 0); window->target->set_bounds(sdl->hw_scale_width, sdl->hw_scale_height);
return render_target_get_primitives(window->target); return window->target->get_primitives();
} }
//============================================================ //============================================================
@ -768,7 +768,7 @@ static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update)
sdl->last_hofs = hofs; sdl->last_hofs = hofs;
sdl->last_vofs = vofs; sdl->last_vofs = vofs;
osd_lock_acquire(window->primlist->lock); window->primlist->acquire_lock();
// render to it // render to it
if (!sdl->scale_mode->is_yuv) if (!sdl->scale_mode->is_yuv)
@ -791,23 +791,23 @@ static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update)
switch (rmask) switch (rmask)
{ {
case 0x0000ff00: case 0x0000ff00:
drawsdl_bgra888_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 4); drawsdl_bgra888_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 4);
break; break;
case 0x00ff0000: case 0x00ff0000:
drawsdl_rgb888_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 4); drawsdl_rgb888_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 4);
break; break;
case 0x000000ff: case 0x000000ff:
drawsdl_bgr888_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 4); drawsdl_bgr888_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 4);
break; break;
case 0xf800: case 0xf800:
drawsdl_rgb565_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 2); drawsdl_rgb565_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 2);
break; break;
case 0x7c00: case 0x7c00:
drawsdl_rgb555_draw_primitives(window->primlist->head, surfptr, mamewidth, mameheight, pitch / 2); drawsdl_rgb555_draw_primitives(*window->primlist, surfptr, mamewidth, mameheight, pitch / 2);
break; break;
default: default:
@ -819,11 +819,11 @@ static int drawsdl_window_draw(sdl_window_info *window, UINT32 dc, int update)
{ {
assert (sdl->yuv_bitmap != NULL); assert (sdl->yuv_bitmap != NULL);
assert (surfptr != NULL); assert (surfptr != NULL);
drawsdl_rgb555_draw_primitives(window->primlist->head, sdl->yuv_bitmap, sdl->hw_scale_width, sdl->hw_scale_height, sdl->hw_scale_width); drawsdl_rgb555_draw_primitives(*window->primlist, sdl->yuv_bitmap, sdl->hw_scale_width, sdl->hw_scale_height, sdl->hw_scale_width);
sdl->scale_mode->yuv_blit((UINT16 *)sdl->yuv_bitmap, sdl, surfptr, pitch); sdl->scale_mode->yuv_blit((UINT16 *)sdl->yuv_bitmap, sdl, surfptr, pitch);
} }
osd_lock_release(window->primlist->lock); window->primlist->release_lock();
// unlock and flip // unlock and flip
#if (!SDL_VERSION_ATLEAST(1,3,0)) #if (!SDL_VERSION_ATLEAST(1,3,0))

View File

@ -423,6 +423,6 @@ GtkWidget *dview_new(const gchar *widget_name, const gchar *string1, const gchar
void dview_set_debug_view(DView *dv, running_machine *machine, debug_view_type type) void dview_set_debug_view(DView *dv, running_machine *machine, debug_view_type type)
{ {
dv->view = machine->m_debug_view->alloc_view(type, dview_update, dv); dv->view = machine->debug_view().alloc_view(type, dview_update, dv);
dv->dv_type = type; dv->dv_type = type;
} }

View File

@ -838,7 +838,7 @@ static void load_effect_overlay(running_machine *machine, const char *filename)
// set the overlay on all screens // set the overlay on all screens
for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen)) for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen))
render_container_set_overlay(render_container_get_screen(screen), effect_bitmap); screen->container().set_overlay(effect_bitmap);
global_free(tempstr); global_free(tempstr);
} }

View File

@ -347,14 +347,14 @@ void sdlwindow_blit_surface_size(sdl_window_info *window, int window_width, int
INT32 target_height = window_height; INT32 target_height = window_height;
// start with the minimum size // start with the minimum size
render_target_get_minimum_size(window->target, &newwidth, &newheight); window->target->compute_minimum_size(newwidth, newheight);
// compute the appropriate visible area if we're trying to keepaspect // compute the appropriate visible area if we're trying to keepaspect
if (video_config.keepaspect) if (video_config.keepaspect)
{ {
// make sure the monitor is up-to-date // make sure the monitor is up-to-date
sdlvideo_monitor_refresh(window->monitor); sdlvideo_monitor_refresh(window->monitor);
render_target_compute_visible_area(window->target, target_width, target_height, sdlvideo_monitor_get_aspect(window->monitor), render_target_get_orientation(window->target), &target_width, &target_height); window->target->compute_visible_area(target_width, target_height, sdlvideo_monitor_get_aspect(window->monitor), window->target->orientation(), target_width, target_height);
desired_aspect = (float)target_width / (float)target_height; desired_aspect = (float)target_width / (float)target_height;
} }
@ -406,7 +406,7 @@ void sdlwindow_blit_surface_size(sdl_window_info *window, int window_width, int
} }
//FIXME: really necessary to distinguish for yuv_modes ? //FIXME: really necessary to distinguish for yuv_modes ?
if ((render_target_get_layer_config(window->target) & LAYER_CONFIG_ZOOM_TO_SCREEN) if (window->target->zoom_to_screen()
&& (window->scale_mode == VIDEO_SCALE_MODE_NONE )) && (window->scale_mode == VIDEO_SCALE_MODE_NONE ))
newwidth = window_width; newwidth = window_width;
@ -695,12 +695,7 @@ int sdlwindow_video_window_create(running_machine *machine, int index, sdl_monit
window->rendered_event = osd_event_alloc(FALSE, TRUE); window->rendered_event = osd_event_alloc(FALSE, TRUE);
// load the layout // load the layout
window->target = render_target_alloc(machine, NULL, FALSE); window->target = machine->render().target_alloc();
if (window->target == NULL)
{
osd_free(wp);
goto error;
}
// set the specific view // set the specific view
sprintf(option, SDLOPTION_VIEW("%d"), index); sprintf(option, SDLOPTION_VIEW("%d"), index);
@ -789,8 +784,7 @@ static void sdlwindow_video_window_destroy(running_machine *machine, sdl_window_
execute_async_wait(&sdlwindow_video_window_destroy_wt, &wp); execute_async_wait(&sdlwindow_video_window_destroy_wt, &wp);
// free the render target, after the textures! // free the render target, after the textures!
if (window->target != NULL) window->machine->render().target_free(window->target);
render_target_free(window->target);
// free the event // free the event
osd_event_free(window->rendered_event); osd_event_free(window->rendered_event);
@ -813,7 +807,7 @@ static void pick_best_mode(sdl_window_info *window, int *fswidth, int *fsheight)
float size_score, best_score = 0.0f; float size_score, best_score = 0.0f;
// determine the minimum width/height for the selected target // determine the minimum width/height for the selected target
render_target_get_minimum_size(window->target, &minimum_width, &minimum_height); window->target->compute_minimum_size(minimum_width, minimum_height);
// use those as the target for now // use those as the target for now
target_width = minimum_width * MAX(1, window->prescale); target_width = minimum_width * MAX(1, window->prescale);
@ -880,7 +874,7 @@ static void pick_best_mode(sdl_window_info *window, int *fswidth, int *fsheight)
SDL_Rect **modes; SDL_Rect **modes;
// determine the minimum width/height for the selected target // determine the minimum width/height for the selected target
render_target_get_minimum_size(window->target, &minimum_width, &minimum_height); window->target->compute_minimum_size(minimum_width, minimum_height);
// use those as the target for now // use those as the target for now
target_width = minimum_width * MAX(1, window->prescale); target_width = minimum_width * MAX(1, window->prescale);
@ -966,7 +960,7 @@ void sdlwindow_video_window_update(running_machine *machine, sdl_window_info *wi
int tempwidth, tempheight; int tempwidth, tempheight;
// see if the games video mode has changed // see if the games video mode has changed
render_target_get_minimum_size(window->target, &tempwidth, &tempheight); window->target->compute_minimum_size(tempwidth, tempheight);
if (tempwidth != window->minwidth || tempheight != window->minheight) if (tempwidth != window->minwidth || tempheight != window->minheight)
{ {
window->minwidth = tempwidth; window->minwidth = tempwidth;
@ -1026,7 +1020,7 @@ static void set_starting_view(running_machine *machine, int index, sdl_window_in
viewindex = video_get_view_for_target(machine, window->target, view, index, video_config.numscreens); viewindex = video_get_view_for_target(machine, window->target, view, index, video_config.numscreens);
// set the view // set the view
render_target_set_view(window->target, viewindex); window->target->set_view(viewindex);
window->start_viewscreen=viewindex; window->start_viewscreen=viewindex;
} }
@ -1208,21 +1202,21 @@ static void constrain_to_aspect_ratio(sdl_window_info *window, int *window_width
{ {
case WMSZ_BOTTOM: case WMSZ_BOTTOM:
case WMSZ_TOP: case WMSZ_TOP:
render_target_compute_visible_area(window->target, 10000, propheight, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight); window->target->compute_visible_area(10000, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
break; break;
case WMSZ_LEFT: case WMSZ_LEFT:
case WMSZ_RIGHT: case WMSZ_RIGHT:
render_target_compute_visible_area(window->target, propwidth, 10000, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight); window->target->compute_visible_area(propwidth, 10000, pixel_aspect, window->target->orientation(), propwidth, propheight);
break; break;
default: default:
render_target_compute_visible_area(window->target, propwidth, propheight, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight); window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
break; break;
} }
// get the minimum width/height for the current layout // get the minimum width/height for the current layout
render_target_get_minimum_size(window->target, &minwidth, &minheight); window->target->compute_minimum_size(minwidth, minheight);
// clamp against the absolute minimum // clamp against the absolute minimum
propwidth = MAX(propwidth, MIN_WINDOW_DIM); propwidth = MAX(propwidth, MIN_WINDOW_DIM);
@ -1255,7 +1249,7 @@ static void constrain_to_aspect_ratio(sdl_window_info *window, int *window_width
propheight = MIN(propheight, maxheight); propheight = MIN(propheight, maxheight);
// compute the visible area based on the proposed rectangle // compute the visible area based on the proposed rectangle
render_target_compute_visible_area(window->target, propwidth, propheight, pixel_aspect, render_target_get_orientation(window->target), &viswidth, &visheight); window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), viswidth, visheight);
*window_width = viswidth; *window_width = viswidth;
*window_height = visheight; *window_height = visheight;
@ -1272,7 +1266,7 @@ static void get_min_bounds(sdl_window_info *window, int *window_width, int *wind
INT32 minwidth, minheight; INT32 minwidth, minheight;
// get the minimum target size // get the minimum target size
render_target_get_minimum_size(window->target, &minwidth, &minheight); window->target->compute_minimum_size(minwidth, minheight);
// expand to our minimum dimensions // expand to our minimum dimensions
if (minwidth < MIN_WINDOW_DIM) if (minwidth < MIN_WINDOW_DIM)

View File

@ -45,7 +45,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);
const render_primitive_list *(*get_primitives)(sdl_window_info *window); render_primitive_list &(*get_primitives)(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);
@ -71,7 +71,7 @@ struct _sdl_window_info
// rendering info // rendering info
osd_event * rendered_event; osd_event * rendered_event;
render_target * target; render_target * target;
const render_primitive_list *primlist; render_primitive_list *primlist;
// drawing data // drawing data
void * dxdata; void * dxdata;

View File

@ -607,7 +607,7 @@ static void debugwin_window_free(debugwin_info *info)
for (viewnum = 0; viewnum < ARRAY_LENGTH(info->view); viewnum++) for (viewnum = 0; viewnum < ARRAY_LENGTH(info->view); viewnum++)
if (info->view[viewnum].view != NULL) if (info->view[viewnum].view != NULL)
{ {
info->machine->m_debug_view->free_view(*info->view[viewnum].view); info->machine->debug_view().free_view(*info->view[viewnum].view);
info->view[viewnum].view = NULL; info->view[viewnum].view = NULL;
} }
@ -851,7 +851,7 @@ static int debugwin_view_create(debugwin_info *info, int which, debug_view_type
goto cleanup; goto cleanup;
// create the debug view // create the debug view
view->view = info->machine->m_debug_view->alloc_view(type, debugwin_view_update, view); view->view = info->machine->debug_view().alloc_view(type, debugwin_view_update, view);
if (view->view == NULL) if (view->view == NULL)
goto cleanup; goto cleanup;
@ -859,7 +859,7 @@ static int debugwin_view_create(debugwin_info *info, int which, debug_view_type
cleanup: cleanup:
if (view->view) if (view->view)
info->machine->m_debug_view->free_view(*view->view); info->machine->debug_view().free_view(*view->view);
if (view->hscroll) if (view->hscroll)
DestroyWindow(view->hscroll); DestroyWindow(view->hscroll);
if (view->vscroll) if (view->vscroll)
@ -1468,7 +1468,7 @@ static LRESULT CALLBACK debugwin_view_proc(HWND wnd, UINT message, WPARAM wparam
debug_view_xy topleft = info->view->visible_position(); debug_view_xy topleft = info->view->visible_position();
topleft.x = debugwin_view_process_scroll(info, LOWORD(wparam), (HWND)lparam); topleft.x = debugwin_view_process_scroll(info, LOWORD(wparam), (HWND)lparam);
info->view->set_visible_position(topleft); info->view->set_visible_position(topleft);
info->owner->machine->m_debug_view->flush_osd_updates(); info->owner->machine->debug_view().flush_osd_updates();
break; break;
} }
@ -1478,7 +1478,7 @@ static LRESULT CALLBACK debugwin_view_proc(HWND wnd, UINT message, WPARAM wparam
debug_view_xy topleft = info->view->visible_position(); debug_view_xy topleft = info->view->visible_position();
topleft.y = debugwin_view_process_scroll(info, LOWORD(wparam), (HWND)lparam); topleft.y = debugwin_view_process_scroll(info, LOWORD(wparam), (HWND)lparam);
info->view->set_visible_position(topleft); info->view->set_visible_position(topleft);
info->owner->machine->m_debug_view->flush_osd_updates(); info->owner->machine->debug_view().flush_osd_updates();
break; break;
} }
@ -2484,11 +2484,11 @@ void console_create_window(running_machine *machine)
cleanup: cleanup:
if (info->view[2].view) if (info->view[2].view)
machine->m_debug_view->free_view(*info->view[2].view); machine->debug_view().free_view(*info->view[2].view);
if (info->view[1].view) if (info->view[1].view)
machine->m_debug_view->free_view(*info->view[1].view); machine->debug_view().free_view(*info->view[1].view);
if (info->view[0].view) if (info->view[0].view)
machine->m_debug_view->free_view(*info->view[0].view); machine->debug_view().free_view(*info->view[0].view);
} }

View File

@ -439,7 +439,7 @@ INLINE void reset_render_states(d3d_info *d3d)
static void drawd3d_exit(void); static void drawd3d_exit(void);
static int drawd3d_window_init(win_window_info *window); static int drawd3d_window_init(win_window_info *window);
static void drawd3d_window_destroy(win_window_info *window); static void drawd3d_window_destroy(win_window_info *window);
static const render_primitive_list *drawd3d_window_get_primitives(win_window_info *window); static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window);
static int drawd3d_window_draw(win_window_info *window, HDC dc, int update); static int drawd3d_window_draw(win_window_info *window, HDC dc, int update);
// devices // devices
@ -591,7 +591,7 @@ static void drawd3d_window_destroy(win_window_info *window)
// drawd3d_window_get_primitives // drawd3d_window_get_primitives
//============================================================ //============================================================
static const render_primitive_list *drawd3d_window_get_primitives(win_window_info *window) static render_primitive_list *drawd3d_window_get_primitives(win_window_info *window)
{ {
d3d_info *d3d = (d3d_info *)window->drawdata; d3d_info *d3d = (d3d_info *)window->drawdata;
RECT client; RECT client;
@ -599,10 +599,10 @@ static const render_primitive_list *drawd3d_window_get_primitives(win_window_inf
GetClientRectExceptMenu(window->hwnd, &client, window->fullscreen); GetClientRectExceptMenu(window->hwnd, &client, window->fullscreen);
if (rect_width(&client) > 0 && rect_height(&client) > 0) if (rect_width(&client) > 0 && rect_height(&client) > 0)
{ {
render_target_set_bounds(window->target, rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor)); window->target->set_bounds(rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
render_target_set_max_update_rate(window->target, (d3d->refresh == 0) ? d3d->origmode.RefreshRate : d3d->refresh); window->target->set_max_update_rate((d3d->refresh == 0) ? d3d->origmode.RefreshRate : d3d->refresh);
} }
return render_target_get_primitives(window->target); return &window->target->get_primitives();
} }
@ -614,7 +614,7 @@ static const render_primitive_list *drawd3d_window_get_primitives(win_window_inf
static int drawd3d_window_draw(win_window_info *window, HDC dc, int update) static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
{ {
d3d_info *d3d = (d3d_info *)window->drawdata; d3d_info *d3d = (d3d_info *)window->drawdata;
const render_primitive *prim; render_primitive *prim;
HRESULT result; HRESULT result;
// if we haven't been created, just punt // if we haven't been created, just punt
@ -644,8 +644,8 @@ static int drawd3d_window_draw(win_window_info *window, HDC dc, int update)
mtlog_add("drawd3d_window_draw: begin"); mtlog_add("drawd3d_window_draw: begin");
// first update any textures // first update any textures
osd_lock_acquire(window->primlist->lock); window->primlist->acquire_lock();
for (prim = window->primlist->head; prim != NULL; prim = prim->next) for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
if (prim->texture.base != NULL) if (prim->texture.base != NULL)
texture_update(d3d, prim); texture_update(d3d, prim);
@ -658,19 +658,22 @@ mtlog_add("drawd3d_window_draw: begin_scene");
// loop over primitives // loop over primitives
mtlog_add("drawd3d_window_draw: primitive loop begin"); mtlog_add("drawd3d_window_draw: primitive loop begin");
for (prim = window->primlist->head; prim != NULL; prim = prim->next) for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
switch (prim->type) switch (prim->type)
{ {
case RENDER_PRIMITIVE_LINE: case render_primitive::LINE:
draw_line(d3d, prim); draw_line(d3d, prim);
break; break;
case RENDER_PRIMITIVE_QUAD: case render_primitive::QUAD:
draw_quad(d3d, prim); draw_quad(d3d, prim);
break; break;
default:
throw emu_fatalerror("Unexpected render_primitive type");
} }
mtlog_add("drawd3d_window_draw: primitive loop end"); mtlog_add("drawd3d_window_draw: primitive loop end");
osd_lock_release(window->primlist->lock); window->primlist->release_lock();
// flush any pending polygons // flush any pending polygons
mtlog_add("drawd3d_window_draw: flush_pending begin"); mtlog_add("drawd3d_window_draw: flush_pending begin");
@ -796,7 +799,7 @@ try_again:
mame_printf_verbose("Direct3D: Device created at %dx%d\n", d3d->width, d3d->height); mame_printf_verbose("Direct3D: Device created at %dx%d\n", d3d->width, d3d->height);
// set the max texture size // set the max texture size
render_target_set_max_texture_size(window->target, d3d->texture_max_width, d3d->texture_max_height); window->target->set_max_texture_size(d3d->texture_max_width, d3d->texture_max_height);
mame_printf_verbose("Direct3D: Max texture size = %dx%d\n", (int)d3d->texture_max_width, (int)d3d->texture_max_height); mame_printf_verbose("Direct3D: Max texture size = %dx%d\n", (int)d3d->texture_max_width, (int)d3d->texture_max_height);
// set the gamma if we need to // set the gamma if we need to
@ -1288,7 +1291,7 @@ static void pick_best_mode(win_window_info *window)
// note: technically we should not be calling this from an alternate window // note: technically we should not be calling this from an alternate window
// thread; however, it is only done during init time, and the init code on // thread; however, it is only done during init time, and the init code on
// the main thread is waiting for us to finish, so it is safe to do so here // the main thread is waiting for us to finish, so it is safe to do so here
render_target_get_minimum_size(window->target, &minwidth, &minheight); window->target->compute_minimum_size(minwidth, minheight);
// use those as the target for now // use those as the target for now
target_width = minwidth; target_width = minwidth;

View File

@ -178,7 +178,7 @@ INLINE int better_mode(int width0, int height0, int width1, int height1, float d
static void drawdd_exit(void); static void drawdd_exit(void);
static int drawdd_window_init(win_window_info *window); static int drawdd_window_init(win_window_info *window);
static void drawdd_window_destroy(win_window_info *window); static void drawdd_window_destroy(win_window_info *window);
static const render_primitive_list *drawdd_window_get_primitives(win_window_info *window); static render_primitive_list *drawdd_window_get_primitives(win_window_info *window);
static int drawdd_window_draw(win_window_info *window, HDC dc, int update); static int drawdd_window_draw(win_window_info *window, HDC dc, int update);
// surface management // surface management
@ -201,14 +201,14 @@ static void get_adapter_for_monitor(dd_info *dd, win_monitor_info *monitor);
static void pick_best_mode(win_window_info *window); static void pick_best_mode(win_window_info *window);
// rendering // rendering
static void drawdd_rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawdd_rgb888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawdd_bgr888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawdd_bgr888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawdd_rgb565_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawdd_rgb565_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawdd_rgb555_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawdd_rgb555_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawdd_rgb888_nr_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawdd_rgb888_nr_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawdd_bgr888_nr_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawdd_bgr888_nr_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawdd_rgb565_nr_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawdd_rgb565_nr_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
static void drawdd_rgb555_nr_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawdd_rgb555_nr_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
@ -327,15 +327,15 @@ static void drawdd_window_destroy(win_window_info *window)
// drawdd_window_get_primitives // drawdd_window_get_primitives
//============================================================ //============================================================
static const render_primitive_list *drawdd_window_get_primitives(win_window_info *window) static render_primitive_list *drawdd_window_get_primitives(win_window_info *window)
{ {
dd_info *dd = (dd_info *)window->drawdata; dd_info *dd = (dd_info *)window->drawdata;
compute_blit_surface_size(window); compute_blit_surface_size(window);
render_target_set_bounds(window->target, dd->blitwidth, dd->blitheight, 0); window->target->set_bounds(dd->blitwidth, dd->blitheight, 0);
render_target_set_max_update_rate(window->target, (dd->refresh == 0) ? dd->origmode.dwRefreshRate : dd->refresh); window->target->set_max_update_rate((dd->refresh == 0) ? dd->origmode.dwRefreshRate : dd->refresh);
return render_target_get_primitives(window->target); return &window->target->get_primitives();
} }
@ -347,7 +347,7 @@ static const render_primitive_list *drawdd_window_get_primitives(win_window_info
static int drawdd_window_draw(win_window_info *window, HDC dc, int update) static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
{ {
dd_info *dd = (dd_info *)window->drawdata; dd_info *dd = (dd_info *)window->drawdata;
const render_primitive *prim; render_primitive *prim;
int usemembuffer = FALSE; int usemembuffer = FALSE;
HRESULT result; HRESULT result;
@ -386,10 +386,10 @@ static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
} }
// render to it // render to it
osd_lock_acquire(window->primlist->lock); window->primlist->acquire_lock();
// scan the list of primitives for tricky stuff // scan the list of primitives for tricky stuff
for (prim = window->primlist->head; prim != NULL; prim = prim->next) for (prim = window->primlist->first(); prim != NULL; prim = prim->next())
if (PRIMFLAG_GET_BLENDMODE(prim->flags) != BLENDMODE_NONE || if (PRIMFLAG_GET_BLENDMODE(prim->flags) != BLENDMODE_NONE ||
(prim->texture.base != NULL && PRIMFLAG_GET_TEXFORMAT(prim->flags) == TEXFORMAT_ARGB32)) (prim->texture.base != NULL && PRIMFLAG_GET_TEXFORMAT(prim->flags) == TEXFORMAT_ARGB32))
{ {
@ -405,10 +405,10 @@ static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
// based on the target format, use one of our standard renderers // based on the target format, use one of our standard renderers
switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask) switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
{ {
case 0x00ff0000: drawdd_rgb888_draw_primitives(window->primlist->head, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break; case 0x00ff0000: drawdd_rgb888_draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
case 0x000000ff: drawdd_bgr888_draw_primitives(window->primlist->head, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break; case 0x000000ff: drawdd_bgr888_draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
case 0xf800: drawdd_rgb565_draw_primitives(window->primlist->head, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break; case 0xf800: drawdd_rgb565_draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
case 0x7c00: drawdd_rgb555_draw_primitives(window->primlist->head, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break; case 0x7c00: drawdd_rgb555_draw_primitives(*window->primlist, dd->membuffer, dd->blitwidth, dd->blitheight, dd->blitwidth); break;
default: default:
mame_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask); mame_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
break; break;
@ -441,16 +441,16 @@ static int drawdd_window_draw(win_window_info *window, HDC dc, int update)
// based on the target format, use one of our standard renderers // based on the target format, use one of our standard renderers
switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask) switch (dd->blitdesc.ddpfPixelFormat.dwRBitMask)
{ {
case 0x00ff0000: drawdd_rgb888_nr_draw_primitives(window->primlist->head, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break; case 0x00ff0000: drawdd_rgb888_nr_draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
case 0x000000ff: drawdd_bgr888_nr_draw_primitives(window->primlist->head, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break; case 0x000000ff: drawdd_bgr888_nr_draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 4); break;
case 0xf800: drawdd_rgb565_nr_draw_primitives(window->primlist->head, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break; case 0xf800: drawdd_rgb565_nr_draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
case 0x7c00: drawdd_rgb555_nr_draw_primitives(window->primlist->head, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break; case 0x7c00: drawdd_rgb555_nr_draw_primitives(*window->primlist, dd->blitdesc.lpSurface, dd->blitwidth, dd->blitheight, dd->blitdesc.lPitch / 2); break;
default: default:
mame_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask); mame_printf_verbose("DirectDraw: Unknown target mode: R=%08X G=%08X B=%08X\n", (int)dd->blitdesc.ddpfPixelFormat.dwRBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwGBitMask, (int)dd->blitdesc.ddpfPixelFormat.dwBBitMask);
break; break;
} }
} }
osd_lock_release(window->primlist->lock); window->primlist->release_lock();
// unlock and blit // unlock and blit
result = IDirectDrawSurface7_Unlock(dd->blit, NULL); result = IDirectDrawSurface7_Unlock(dd->blit, NULL);
@ -879,7 +879,7 @@ static void compute_blit_surface_size(win_window_info *window)
RECT client; RECT client;
// start with the minimum size // start with the minimum size
render_target_get_minimum_size(window->target, &newwidth, &newheight); window->target->compute_minimum_size(newwidth, newheight);
// get the window's client rectangle // get the window's client rectangle
GetClientRect(window->hwnd, &client); GetClientRect(window->hwnd, &client);
@ -909,7 +909,7 @@ static void compute_blit_surface_size(win_window_info *window)
if (video_config.keepaspect) if (video_config.keepaspect)
{ {
win_monitor_info *monitor = winwindow_video_window_monitor(window, NULL); win_monitor_info *monitor = winwindow_video_window_monitor(window, NULL);
render_target_compute_visible_area(window->target, target_width, target_height, winvideo_monitor_get_aspect(monitor), render_target_get_orientation(window->target), &target_width, &target_height); window->target->compute_visible_area(target_width, target_height, winvideo_monitor_get_aspect(monitor), window->target->orientation(), target_width, target_height);
desired_aspect = (float)target_width / (float)target_height; desired_aspect = (float)target_width / (float)target_height;
} }
@ -1054,7 +1054,7 @@ static void blit_to_primary(win_window_info *window, int srcwidth, int srcheight
else if (video_config.keepaspect) else if (video_config.keepaspect)
{ {
// compute the appropriate visible area // compute the appropriate visible area
render_target_compute_visible_area(window->target, rect_width(&outer), rect_height(&outer), winvideo_monitor_get_aspect(monitor), render_target_get_orientation(window->target), &dstwidth, &dstheight); window->target->compute_visible_area(rect_width(&outer), rect_height(&outer), winvideo_monitor_get_aspect(monitor), window->target->orientation(), dstwidth, dstheight);
} }
// center within // center within
@ -1325,7 +1325,7 @@ static void pick_best_mode(win_window_info *window)
// note: technically we should not be calling this from an alternate window // note: technically we should not be calling this from an alternate window
// thread; however, it is only done during init time, and the init code on // thread; however, it is only done during init time, and the init code on
// the main thread is waiting for us to finish, so it is safe to do so here // the main thread is waiting for us to finish, so it is safe to do so here
render_target_get_minimum_size(window->target, &einfo.minimum_width, &einfo.minimum_height); window->target->compute_minimum_size(einfo.minimum_width, einfo.minimum_height);
// use those as the target for now // use those as the target for now
einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale); einfo.target_width = einfo.minimum_width * MAX(1, video_config.prescale);

View File

@ -75,11 +75,11 @@ struct _gdi_info
static void drawgdi_exit(void); static void drawgdi_exit(void);
static int drawgdi_window_init(win_window_info *window); static int drawgdi_window_init(win_window_info *window);
static void drawgdi_window_destroy(win_window_info *window); static void drawgdi_window_destroy(win_window_info *window);
static const render_primitive_list *drawgdi_window_get_primitives(win_window_info *window); static render_primitive_list *drawgdi_window_get_primitives(win_window_info *window);
static int drawgdi_window_draw(win_window_info *window, HDC dc, int update); static int drawgdi_window_draw(win_window_info *window, HDC dc, int update);
// rendering // rendering
static void drawgdi_rgb888_draw_primitives(const render_primitive *primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch); static void drawgdi_rgb888_draw_primitives(const render_primitive_list &primlist, void *dstdata, UINT32 width, UINT32 height, UINT32 pitch);
@ -172,12 +172,12 @@ static void drawgdi_window_destroy(win_window_info *window)
// drawgdi_window_get_primitives // drawgdi_window_get_primitives
//============================================================ //============================================================
static const render_primitive_list *drawgdi_window_get_primitives(win_window_info *window) static render_primitive_list *drawgdi_window_get_primitives(win_window_info *window)
{ {
RECT client; RECT client;
GetClientRect(window->hwnd, &client); GetClientRect(window->hwnd, &client);
render_target_set_bounds(window->target, rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor)); window->target->set_bounds(rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
return render_target_get_primitives(window->target); return &window->target->get_primitives();
} }
@ -213,9 +213,9 @@ static int drawgdi_window_draw(win_window_info *window, HDC dc, int update)
} }
// draw the primitives to the bitmap // draw the primitives to the bitmap
osd_lock_acquire(window->primlist->lock); window->primlist->acquire_lock();
drawgdi_rgb888_draw_primitives(window->primlist->head, gdi->bmdata, width, height, pitch); drawgdi_rgb888_draw_primitives(*window->primlist, gdi->bmdata, width, height, pitch);
osd_lock_release(window->primlist->lock); window->primlist->release_lock();
// fill in bitmap-specific info // fill in bitmap-specific info
gdi->bminfo.bmiHeader.biWidth = pitch; gdi->bminfo.bmiHeader.biWidth = pitch;

View File

@ -59,7 +59,7 @@
static void drawnone_exit(void); static void drawnone_exit(void);
static int drawnone_window_init(win_window_info *window); static int drawnone_window_init(win_window_info *window);
static void drawnone_window_destroy(win_window_info *window); static void drawnone_window_destroy(win_window_info *window);
static const render_primitive_list *drawnone_window_get_primitives(win_window_info *window); static render_primitive_list *drawnone_window_get_primitives(win_window_info *window);
static int drawnone_window_draw(win_window_info *window, HDC dc, int update); static int drawnone_window_draw(win_window_info *window, HDC dc, int update);
@ -116,12 +116,12 @@ static void drawnone_window_destroy(win_window_info *window)
// drawnone_window_get_primitives // drawnone_window_get_primitives
//============================================================ //============================================================
static const render_primitive_list *drawnone_window_get_primitives(win_window_info *window) static render_primitive_list *drawnone_window_get_primitives(win_window_info *window)
{ {
RECT client; RECT client;
GetClientRect(window->hwnd, &client); GetClientRect(window->hwnd, &client);
render_target_set_bounds(window->target, rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor)); window->target->set_bounds(rect_width(&client), rect_height(&client), winvideo_monitor_get_aspect(window->monitor));
return render_target_get_primitives(window->target); return &window->target->get_primitives();
} }

View File

@ -490,7 +490,7 @@ static void load_effect_overlay(running_machine *machine, const char *filename)
// set the overlay on all screens // set the overlay on all screens
for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen)) for (screen_device *screen = screen_first(*machine); screen != NULL; screen = screen_next(screen))
render_container_set_overlay(render_container_get_screen(screen), effect_bitmap); screen->container().set_overlay(effect_bitmap);
global_free(tempstr); global_free(tempstr);
} }

View File

@ -636,18 +636,16 @@ void winwindow_video_window_create(running_machine *machine, int index, win_moni
window->render_lock = osd_lock_alloc(); window->render_lock = osd_lock_alloc();
// load the layout // load the layout
window->target = render_target_alloc(machine, NULL, 0); window->target = machine->render().target_alloc();
if (window->target == NULL)
fatalerror("Error creating render target for window %d", index);
// set the specific view // set the specific view
sprintf(option, "view%d", index); sprintf(option, "view%d", index);
set_starting_view(index, window, options_get_string(machine->options(), option)); set_starting_view(index, window, options_get_string(machine->options(), option));
// remember the current values in case they change // remember the current values in case they change
window->targetview = render_target_get_view(window->target); window->targetview = window->target->view();
window->targetorient = render_target_get_orientation(window->target); window->targetorient = window->target->orientation();
window->targetlayerconfig = render_target_get_layer_config(window->target); window->targetlayerconfig = window->target->layer_config();
// make the window title // make the window title
if (video_config.numscreens == 1) if (video_config.numscreens == 1)
@ -702,8 +700,7 @@ static void winwindow_video_window_destroy(win_window_info *window)
SendMessage(window->hwnd, WM_USER_SELF_TERMINATE, 0, 0); SendMessage(window->hwnd, WM_USER_SELF_TERMINATE, 0, 0);
// free the render target // free the render target
if (window->target != NULL) window->machine->render().target_free(window->target);
render_target_free(window->target);
// free the lock // free the lock
osd_lock_free(window->render_lock); osd_lock_free(window->render_lock);
@ -728,9 +725,9 @@ void winwindow_video_window_update(win_window_info *window)
mtlog_add("winwindow_video_window_update: begin"); mtlog_add("winwindow_video_window_update: begin");
// see if the target has changed significantly in window mode // see if the target has changed significantly in window mode
targetview = render_target_get_view(window->target); targetview = window->target->view();
targetorient = render_target_get_orientation(window->target); targetorient = window->target->orientation();
targetlayerconfig = render_target_get_layer_config(window->target); targetlayerconfig = window->target->layer_config();
if (targetview != window->targetview || targetorient != window->targetorient || targetlayerconfig != window->targetlayerconfig) if (targetview != window->targetview || targetorient != window->targetorient || targetlayerconfig != window->targetlayerconfig)
{ {
window->targetview = targetview; window->targetview = targetview;
@ -763,7 +760,7 @@ void winwindow_video_window_update(win_window_info *window)
// only render if we were able to get the lock // only render if we were able to get the lock
if (got_lock) if (got_lock)
{ {
const render_primitive_list *primlist; render_primitive_list *primlist;
mtlog_add("winwindow_video_window_update: got lock"); mtlog_add("winwindow_video_window_update: got lock");
@ -873,7 +870,7 @@ static void set_starting_view(int index, win_window_info *window, const char *vi
viewindex = video_get_view_for_target(window->machine, window->target, view, index, video_config.numscreens); viewindex = video_get_view_for_target(window->machine, window->target, view, index, video_config.numscreens);
// set the view // set the view
render_target_set_view(window->target, viewindex); window->target->set_view(viewindex);
} }
@ -1361,7 +1358,7 @@ LRESULT CALLBACK winwindow_video_window_proc(HWND wnd, UINT message, WPARAM wpar
HDC hdc = GetDC(wnd); HDC hdc = GetDC(wnd);
mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW begin"); mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW begin");
window->primlist = (const render_primitive_list *)lparam; window->primlist = (render_primitive_list *)lparam;
draw_video_contents(window, hdc, FALSE); draw_video_contents(window, hdc, FALSE);
mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW end"); mtlog_add("winwindow_video_window_proc: WM_USER_REDRAW end");
@ -1480,21 +1477,21 @@ static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int a
{ {
case WMSZ_BOTTOM: case WMSZ_BOTTOM:
case WMSZ_TOP: case WMSZ_TOP:
render_target_compute_visible_area(window->target, 10000, propheight, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight); window->target->compute_visible_area(10000, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
break; break;
case WMSZ_LEFT: case WMSZ_LEFT:
case WMSZ_RIGHT: case WMSZ_RIGHT:
render_target_compute_visible_area(window->target, propwidth, 10000, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight); window->target->compute_visible_area(propwidth, 10000, pixel_aspect, window->target->orientation(), propwidth, propheight);
break; break;
default: default:
render_target_compute_visible_area(window->target, propwidth, propheight, pixel_aspect, render_target_get_orientation(window->target), &propwidth, &propheight); window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), propwidth, propheight);
break; break;
} }
// get the minimum width/height for the current layout // get the minimum width/height for the current layout
render_target_get_minimum_size(window->target, &minwidth, &minheight); window->target->compute_minimum_size(minwidth, minheight);
// clamp against the absolute minimum // clamp against the absolute minimum
propwidth = MAX(propwidth, MIN_WINDOW_DIM); propwidth = MAX(propwidth, MIN_WINDOW_DIM);
@ -1527,7 +1524,7 @@ static void constrain_to_aspect_ratio(win_window_info *window, RECT *rect, int a
propheight = MIN(propheight, maxheight); propheight = MIN(propheight, maxheight);
// compute the visible area based on the proposed rectangle // compute the visible area based on the proposed rectangle
render_target_compute_visible_area(window->target, propwidth, propheight, pixel_aspect, render_target_get_orientation(window->target), &viswidth, &visheight); window->target->compute_visible_area(propwidth, propheight, pixel_aspect, window->target->orientation(), viswidth, visheight);
// compute the adjustments we need to make // compute the adjustments we need to make
adjwidth = (viswidth + extrawidth) - rect_width(rect); adjwidth = (viswidth + extrawidth) - rect_width(rect);
@ -1576,7 +1573,7 @@ static void get_min_bounds(win_window_info *window, RECT *bounds, int constrain)
assert(GetCurrentThreadId() == window_threadid); assert(GetCurrentThreadId() == window_threadid);
// get the minimum target size // get the minimum target size
render_target_get_minimum_size(window->target, &minwidth, &minheight); window->target->compute_minimum_size(minwidth, minheight);
// expand to our minimum dimensions // expand to our minimum dimensions
if (minwidth < MIN_WINDOW_DIM) if (minwidth < MIN_WINDOW_DIM)

View File

@ -101,7 +101,7 @@ struct _win_window_info
int targetview; int targetview;
int targetorient; int targetorient;
int targetlayerconfig; int targetlayerconfig;
const render_primitive_list *primlist; render_primitive_list *primlist;
// input info // input info
DWORD lastclicktime; DWORD lastclicktime;
@ -121,7 +121,7 @@ struct _win_draw_callbacks
void (*exit)(void); void (*exit)(void);
int (*window_init)(win_window_info *window); int (*window_init)(win_window_info *window);
const render_primitive_list *(*window_get_primitives)(win_window_info *window); render_primitive_list *(*window_get_primitives)(win_window_info *window);
int (*window_draw)(win_window_info *window, HDC dc, int update); int (*window_draw)(win_window_info *window, HDC dc, int update);
void (*window_destroy)(win_window_info *window); void (*window_destroy)(win_window_info *window);
}; };