mirror of
https://github.com/holub/mame
synced 2025-07-03 09:06:08 +03:00
osd: Moved some windows-specific stuff into osd/windows/window.{h,cpp}.
This commit is contained in:
parent
df80004c3c
commit
a4e8ffe3dc
@ -25,9 +25,6 @@ osd_window::osd_window(
|
||||
int index,
|
||||
const std::shared_ptr<osd_monitor_info> &monitor,
|
||||
const osd_window_config &config) :
|
||||
#ifdef OSD_WINDOWS
|
||||
m_dc(nullptr), m_resize_state(0),
|
||||
#endif
|
||||
m_target(nullptr),
|
||||
m_primlist(nullptr),
|
||||
m_win_config(config),
|
||||
|
@ -108,11 +108,6 @@ protected:
|
||||
private:
|
||||
void set_starting_view(int index, const char *defview, const char *view);
|
||||
|
||||
public: // TODO: make these private
|
||||
#ifdef OSD_WINDOWS
|
||||
HDC m_dc; // only used by GDI renderer!
|
||||
int m_resize_state;
|
||||
#endif
|
||||
private:
|
||||
render_target *m_target;
|
||||
public:
|
||||
|
@ -334,7 +334,7 @@ bool video_bgfx::init_bgfx_library(osd_window &window)
|
||||
init.resolution.width = wdim.width();
|
||||
init.resolution.height = wdim.height();
|
||||
init.resolution.numBackBuffers = 1;
|
||||
init.resolution.reset = BGFX_RESET_NONE;
|
||||
init.resolution.reset = video_config.waitvsync ? BGFX_RESET_VSYNC : BGFX_RESET_NONE;
|
||||
if (!set_platform_data(init.platformData, window))
|
||||
{
|
||||
osd_printf_error("Setting BGFX platform data failed\n");
|
||||
|
@ -630,7 +630,7 @@ int renderer_d3d9::initialize()
|
||||
int renderer_d3d9::pre_window_draw_check()
|
||||
{
|
||||
// if we're in the middle of resizing, leave things alone
|
||||
if (window().m_resize_state == RESIZE_STATE_RESIZING)
|
||||
if (dynamic_cast<win_window_info &>(window()).m_resize_state == win_window_info::RESIZE_STATE_RESIZING)
|
||||
return 0;
|
||||
|
||||
// check if shaders should be toggled
|
||||
@ -1407,30 +1407,31 @@ void renderer_d3d9::pick_best_mode()
|
||||
bool renderer_d3d9::update_window_size()
|
||||
{
|
||||
// get the current window bounds
|
||||
auto &win = dynamic_cast<win_window_info &>(window());
|
||||
RECT client;
|
||||
GetClientRectExceptMenu(dynamic_cast<win_window_info &>(window()).platform_window(), &client, window().fullscreen());
|
||||
GetClientRectExceptMenu(win.platform_window(), &client, window().fullscreen());
|
||||
|
||||
// if we have a device and matching width/height, nothing to do
|
||||
if (m_device && rect_width(&client) == m_width && rect_height(&client) == m_height)
|
||||
{
|
||||
// clear out any pending resizing if the area didn't change
|
||||
if (window().m_resize_state == RESIZE_STATE_PENDING)
|
||||
window().m_resize_state = RESIZE_STATE_NORMAL;
|
||||
if (win.m_resize_state == win_window_info::RESIZE_STATE_PENDING)
|
||||
win.m_resize_state = win_window_info::RESIZE_STATE_NORMAL;
|
||||
return false;
|
||||
}
|
||||
|
||||
// if we're in the middle of resizing, leave it alone as well
|
||||
if (window().m_resize_state == RESIZE_STATE_RESIZING)
|
||||
if (win.m_resize_state == win_window_info::RESIZE_STATE_RESIZING)
|
||||
return false;
|
||||
|
||||
// set the new bounds and create the device again
|
||||
m_width = rect_width(&client);
|
||||
m_height = rect_height(&client);
|
||||
if (device_create(dynamic_cast<win_window_info &>(window()).main_window()->platform_window()))
|
||||
if (device_create(win.main_window()->platform_window()))
|
||||
return false;
|
||||
|
||||
// reset the resize state to normal, and indicate we made a change
|
||||
window().m_resize_state = RESIZE_STATE_NORMAL;
|
||||
win.m_resize_state = win_window_info::RESIZE_STATE_NORMAL;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -90,16 +90,18 @@ render_primitive_list *renderer_gdi::get_primitives()
|
||||
|
||||
int renderer_gdi::draw(const int update)
|
||||
{
|
||||
auto &win = dynamic_cast<win_window_info &>(window());
|
||||
|
||||
// we don't have any special resize behaviors
|
||||
if (window().m_resize_state == RESIZE_STATE_PENDING)
|
||||
window().m_resize_state = RESIZE_STATE_NORMAL;
|
||||
if (win.m_resize_state == win_window_info::RESIZE_STATE_PENDING)
|
||||
win.m_resize_state = win_window_info::RESIZE_STATE_NORMAL;
|
||||
|
||||
// get the target bounds
|
||||
RECT bounds;
|
||||
GetClientRect(dynamic_cast<win_window_info &>(window()).platform_window(), &bounds);
|
||||
GetClientRect(win.platform_window(), &bounds);
|
||||
|
||||
// compute width/height/pitch of target
|
||||
osd_dim const dimensions = window().get_size();
|
||||
osd_dim const dimensions = win.get_size();
|
||||
int const width = dimensions.width();
|
||||
int const height = dimensions.height();
|
||||
int const pitch = (width + 3) & ~3;
|
||||
@ -113,9 +115,9 @@ int renderer_gdi::draw(const int update)
|
||||
}
|
||||
|
||||
// draw the primitives to the bitmap
|
||||
window().m_primlist->acquire_lock();
|
||||
software_renderer<uint32_t, 0,0,0, 16,8,0>::draw_primitives(*window().m_primlist, m_bmdata.get(), width, height, pitch);
|
||||
window().m_primlist->release_lock();
|
||||
win.m_primlist->acquire_lock();
|
||||
software_renderer<uint32_t, 0,0,0, 16,8,0>::draw_primitives(*win.m_primlist, m_bmdata.get(), width, height, pitch);
|
||||
win.m_primlist->release_lock();
|
||||
|
||||
// fill in bitmap-specific info
|
||||
m_bminfo.bmiHeader.biWidth = pitch;
|
||||
@ -123,7 +125,7 @@ int renderer_gdi::draw(const int update)
|
||||
|
||||
// blit to the screen
|
||||
StretchDIBits(
|
||||
window().m_dc, 0, 0, width, height,
|
||||
win.m_dc, 0, 0, width, height,
|
||||
0, 0, width, height,
|
||||
m_bmdata.get(), &m_bminfo, DIB_RGB_COLORS, SRCCOPY);
|
||||
|
||||
|
@ -212,6 +212,8 @@ win_window_info::win_window_info(
|
||||
, m_lastclickx(0)
|
||||
, m_lastclicky(0)
|
||||
, m_last_surrogate(0)
|
||||
, m_dc(nullptr)
|
||||
, m_resize_state(RESIZE_STATE_NORMAL)
|
||||
, m_main(nullptr)
|
||||
, m_attached_mode(false)
|
||||
{
|
||||
|
@ -33,9 +33,6 @@
|
||||
// CONSTANTS
|
||||
//============================================================
|
||||
|
||||
#define RESIZE_STATE_NORMAL 0
|
||||
#define RESIZE_STATE_RESIZING 1
|
||||
#define RESIZE_STATE_PENDING 2
|
||||
|
||||
|
||||
|
||||
@ -54,6 +51,13 @@ enum class win_window_focus
|
||||
class win_window_info : public osd_window_t<HWND>
|
||||
{
|
||||
public:
|
||||
enum
|
||||
{
|
||||
RESIZE_STATE_NORMAL,
|
||||
RESIZE_STATE_RESIZING,
|
||||
RESIZE_STATE_PENDING
|
||||
};
|
||||
|
||||
win_window_info(running_machine &machine, render_module &renderprovider, int index, const std::shared_ptr<osd_monitor_info> &monitor, const osd_window_config *config);
|
||||
|
||||
bool attached_mode() const { return m_attached_mode; }
|
||||
@ -120,6 +124,9 @@ public:
|
||||
int m_lastclicky;
|
||||
char16_t m_last_surrogate;
|
||||
|
||||
HDC m_dc; // only used by GDI renderer!
|
||||
int m_resize_state;
|
||||
|
||||
private:
|
||||
void draw_video_contents(HDC dc, bool update);
|
||||
int complete_create();
|
||||
|
Loading…
Reference in New Issue
Block a user