MAMEWorld >> EmuChat
View all threads Index   Flat Mode Flat  

haynor666
Reged: 05/06/06
Posts: 101
Loc: Tarnobrzeg/Poland
Send PM
Re: ddraw is no more.
02/20/16 04:02 PM


ArcadeVGA cards can still work as expected also integer aspect ration can be as well maintained. All You have to do is use cleanstretch hack from cabmame and/or apply/fix code from ddraw part:


Code:

-//============================================================
// compute_blit_surface_size
//============================================================

void renderer_dd::compute_blit_surface_size()
{
INT32 newwidth, newheight;
int xscale, yscale;
RECT client;

// start with the minimum size
window().target()->compute_minimum_size(newwidth, newheight);

// get the window's client rectangle
GetClientRect(window().m_hwnd, &client);

// hardware stretch case: apply prescale
if (video_config.hwstretch)
{
int prescale = (window().prescale() < 1) ? 1 : window().prescale();

// clamp the prescale to something smaller than the target bounds
xscale = prescale;
while (xscale > 1 && newwidth * xscale > rect_width(&client))
xscale--;
yscale = prescale;
while (yscale > 1 && newheight * yscale > rect_height(&client))
yscale--;
}

// non stretch case
else
{
INT32 target_width = rect_width(&client);
INT32 target_height = rect_height(&client);
float desired_aspect = 1.0f;

// compute the appropriate visible area if we're trying to keepaspect
if (video_config.keepaspect)
{
osd_monitor_info *monitor = window().winwindow_video_window_monitor(NULL);
window().target()->compute_visible_area(target_width, target_height, monitor->aspect(), window().target()->orientation(), target_width, target_height);
desired_aspect = (float)target_width / (float)target_height;
}

// compute maximum integral scaling to fit the window
xscale = (target_width + 2) / newwidth;
yscale = (target_height + 2) / newheight;

// try a little harder to keep the aspect ratio if desired
if (video_config.keepaspect)
{
// if we could stretch more in the X direction, and that makes a better fit, bump the xscale
while (newwidth * (xscale + 1) <= rect_width(&client) &&
better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale + 1), newheight * yscale, desired_aspect))
xscale++;

// if we could stretch more in the Y direction, and that makes a better fit, bump the yscale
while (newheight * (yscale + 1) <= rect_height(&client) &&
better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale + 1), desired_aspect))
yscale++;

// now that we've maxed out, see if backing off the maximally stretched one makes a better fit
if (rect_width(&client) - newwidth * xscale < rect_height(&client) - newheight * yscale)
{
while (xscale > 1 && better_mode(newwidth * xscale, newheight * yscale, newwidth * (xscale - 1), newheight * yscale, desired_aspect))
xscale--;
}
else
{
while (yscale > 1 && better_mode(newwidth * xscale, newheight * yscale, newwidth * xscale, newheight * (yscale - 1), desired_aspect))
yscale--;
}
}
}

// ensure at least a scale factor of 1
if (xscale == 0) xscale = 1;
if (yscale == 0) yscale = 1;

// apply the final scale
newwidth *= xscale;
newheight *= yscale;
if (newwidth != blitwidth || newheight != blitheight)
{
// force some updates
update_outer_rects();
osd_printf_verbose("DirectDraw: New blit size = %dx%d\n", newwidth, newheight);
}
blitwidth = newwidth;
blitheight = newheight;
}



Edited by haynor666 (02/20/16 04:05 PM)







Entire thread
Subject Posted by Posted on
* ddraw is no more. Robbbert 02/17/16 04:01 PM
. * It all works here..... Traso  02/21/16 06:08 AM
. * Re: It all works here..... joey35car  02/21/16 05:40 PM
. * Re: It all works here..... Traso  03/08/16 06:40 AM
. * Re: It all works here..... Andy Warne  03/26/16 11:18 AM
. * Re: It all works here..... Vas Crabb  03/26/16 11:44 AM
. * Re: It all works here..... StilettoAdministrator  03/26/16 05:05 PM
. * Re: It all works here..... LensLarque  02/21/16 12:47 PM
. * Re: ddraw is no more. edcosta  02/19/16 11:14 PM
. * Re: ddraw is no more. Andy Warne  02/19/16 06:13 PM
. * Re: ddraw is no more. R. Belmont  02/19/16 08:53 PM
. * Re: ddraw is no more. HowardC  02/20/16 09:28 AM
. * Re: ddraw is no more. Calamity  02/20/16 12:44 PM
. * Re: ddraw is no more. haynor666  02/20/16 04:02 PM
. * Re: ddraw is no more. Andy Warne  02/21/16 01:38 PM
. * Re: ddraw is no more. haynor666  02/21/16 04:51 PM
. * Re: ddraw is no more. R. Belmont  02/21/16 04:08 AM
. * Re: ddraw is no more. grog  02/21/16 05:16 PM
. * Re: ddraw is no more. Andy Warne  02/21/16 10:27 PM
. * Re: ddraw is no more. haynor666  02/22/16 10:06 AM
. * Re: ddraw is no more. MooglyGuy  02/22/16 01:28 PM
. * Re: ddraw is no more. Calamity  02/22/16 03:23 PM
. * Re: ddraw is no more. R.Coltrane  02/22/16 01:50 PM
. * Re: ddraw is no more. R. Belmont  02/22/16 07:11 PM
. * Re: ddraw is no more. CiroConsentino  02/18/16 12:36 PM
. * Re: ddraw is no more. uman  02/18/16 01:33 PM
. * Re: ddraw is no more. Calamity  02/19/16 12:38 AM
. * Re: ddraw is no more. MattR  02/27/16 10:00 PM
. * Re: ddraw is no more. R. Belmont  02/18/16 05:21 PM
. * Re: ddraw is no more. Vas Crabb  02/18/16 05:19 PM
. * Re: ddraw is no more. MooglyGuy  02/18/16 04:24 PM
. * Re: ddraw is no more. Dullaron  02/17/16 11:28 PM
. * Re: ddraw is no more. Mamesick  02/17/16 04:23 PM
. * Re: ddraw is no more. krick  02/18/16 05:54 AM
. * Re: ddraw is no more. Firehawke  02/21/16 05:02 AM
. * Re: ddraw is no more. Mamesick  02/18/16 07:26 AM
. * Re: ddraw is no more. krick  02/18/16 08:09 AM
. * Re: ddraw is no more. uman  02/17/16 05:59 PM
. * Re: ddraw is no more. Dr. Spankenstein  02/18/16 10:59 AM
. * Re: ddraw is no more. Mamesick  02/17/16 09:47 PM

Extra information Permissions
Moderator:  Robbbert, Tafoid 
0 registered and 184 anonymous users are browsing this forum.
You cannot start new topics
You cannot reply to topics
HTML is enabled
UBBCode is enabled
Thread views: 5647