restore verify_window_sizes

This commit is contained in:
David Rose 2003-01-13 18:22:27 +00:00
parent b58b1919ae
commit c1a04c4486
4 changed files with 74 additions and 12 deletions

View File

@ -931,11 +931,3 @@ do_determine_display_regions() {
}
}
}
void GraphicsWindow::
get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format) {
display_cat.warning() << "get_framebuffer_format() unimplemented by " << get_type() << endl;
fb_type = PixelBuffer::T_unsigned_byte;
fb_format = PixelBuffer::F_rgb;
}

View File

@ -104,12 +104,12 @@ public:
bool has_button_event(int device) const;
ButtonEvent get_button_event(int device);
virtual void get_framebuffer_format(PixelBuffer::Type &fb_type, PixelBuffer::Format &fb_format);
public:
virtual int verify_window_sizes(int numsizes, int *dimen);
PT(DisplayRegion) make_scratch_display_region(int x_size, int y_size) const;
public:
// These are not intended to be called directly by the user.
INLINE void win_display_regions_changed();
public:

View File

@ -199,8 +199,76 @@ release_gsg() {
if (_gsg != (GraphicsStateGuardian *)NULL) {
GraphicsWindow::release_gsg();
}
}
////////////////////////////////////////////////////////////////////
// Function: wdxGraphicsWindow8::verify_window_sizes
// Access: Public, Virtual
// Description: Determines which of the indicated window sizes are
// supported by available hardware (e.g. in fullscreen
// mode).
//
// On entry, dimen is an array containing contiguous x,y
// pairs specifying possible display sizes; it is
// numsizes*2 words long. The function will zero out
// any invalid x,y size pairs. The return value is the
// number of valid sizes that were found.
////////////////////////////////////////////////////////////////////
int wdxGraphicsWindow8::
verify_window_sizes(int numsizes, int *dimen) {
// unfortunately this only works AFTER you make the window
// initially, so its really mostly useful for resizes only
assert(IS_VALID_PTR(_dxgsg));
int num_valid_modes = 0;
// not requesting same refresh rate since changing res might not
// support same refresh rate at new size
int *pCurDim = dimen;
for (int i=0; i < numsizes; i++, pCurDim += 2) {
int x_size = pCurDim[0];
int y_size = pCurDim[1];
bool bIsGoodMode = false;
bool CouldntFindAnyValidZBuf;
D3DFORMAT newPixFmt = D3DFMT_UNKNOWN;
if (special_check_fullscreen_resolution(x_size, y_size)) {
// bypass the test below for certain cards we know have valid modes
bIsGoodMode=true;
} else {
if (_dxgsg->scrn.bIsLowVidMemCard) {
bIsGoodMode = ((x_size == 640) && (y_size == 480));
} else {
search_for_valid_displaymode(x_size, y_size, _dxgsg->scrn.PresParams.EnableAutoDepthStencil != false,
IS_STENCIL_FORMAT(_dxgsg->scrn.PresParams.AutoDepthStencilFormat),
&_dxgsg->scrn.SupportedScreenDepthsMask,
&CouldntFindAnyValidZBuf, &newPixFmt);
bIsGoodMode = (newPixFmt != D3DFMT_UNKNOWN);
}
}
if (bIsGoodMode) {
num_valid_modes++;
} else {
// tell caller the mode is invalid
pCurDim[0] = 0;
pCurDim[1] = 0;
}
if (wdxdisplay8_cat.is_spam()) {
wdxdisplay8_cat.spam()
<< "Fullscrn Mode (" << x_size << "," << y_size << ")\t"
<< (bIsGoodMode ? "V" : "Inv") <<"alid\n";
}
}
return num_valid_modes;
}
////////////////////////////////////////////////////////////////////
// Function: wdxGraphicsWindow8::begin_frame
// Access: Public, Virtual

View File

@ -45,6 +45,8 @@ public:
virtual void make_gsg();
virtual void release_gsg();
virtual int verify_window_sizes(int numsizes, int *dimen);
virtual bool begin_frame();
virtual void end_flip();