Fixed the savety check to actually work.

Made sure that fDisplayMode is not modified if fAccSetDisplayMode failes,
as on my system fAccGetDisplayMode did return values that would crash 
because of a virtual_width beeing 0.
Generally, this whole class is pretty broken, as the functions modify *some*
class member variables before eventually failing.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@17352 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen 2006-05-07 09:33:59 +00:00
parent 84123592e9
commit cb9f2e8d34
1 changed files with 6 additions and 10 deletions

View File

@ -377,22 +377,18 @@ AccelerantHWInterface::SetMode(const display_mode &mode)
// some safety checks
// TODO: more of those!
if (fDisplayMode.virtual_width < 320
|| fDisplayMode.virtual_height < 200)
if (mode.virtual_width < 320
|| mode.virtual_height < 200)
return B_BAD_VALUE;
// just try to set the mode - we let the graphics driver
// approve or deny the request, as it should know best
fDisplayMode = mode;
if (fAccSetDisplayMode(&fDisplayMode) != B_OK) {
display_mode new_mode = mode;
if (fAccSetDisplayMode(&new_mode) != B_OK) {
ATRACE(("setting display mode failed\n"));
fAccGetDisplayMode(&fDisplayMode);
// We just keep the current mode and continue.
// Note, on startup, this may be different from
// what we think is the current display mode
return B_ERROR;
}
fDisplayMode = new_mode;
// update frontbuffer
fFrontBuffer->SetDisplayMode(fDisplayMode);