mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-15 10:54:18 +00:00
Compare commits
3 Commits
jpeg
...
window-siz
Author | SHA1 | Date | |
---|---|---|---|
76ee9975b7 | |||
eba0968808 | |||
f4b3a43026 |
@ -767,7 +767,7 @@ hsBool plClient::MsgReceive(plMessage* msg)
|
||||
{
|
||||
ISetGraphicsDefaults();
|
||||
ResetDisplayDevice(plPipeline::fDefaultPipeParams.Width, plPipeline::fDefaultPipeParams.Height, plPipeline::fDefaultPipeParams.ColorDepth, plPipeline::fDefaultPipeParams.Windowed,
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount, plPipeline::fDefaultPipeParams.AnisotropicLevel, plPipeline::fDefaultPipeParams.VSync, true);
|
||||
plPipeline::fDefaultPipeParams.AntiAliasingAmount, plPipeline::fDefaultPipeParams.AnisotropicLevel, plPipeline::fDefaultPipeParams.VSync);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -2164,55 +2164,61 @@ hsG3DDeviceModeRecord plClient::ILoadDevMode(const char* devModeFile)
|
||||
return dmr;
|
||||
}
|
||||
|
||||
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync, hsBool windowOnly)
|
||||
void plClient::ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync)
|
||||
{
|
||||
if(!fPipeline) return;
|
||||
int BorderWidth = 0, BorderHeight = 0, CaptionHeight = 0;
|
||||
|
||||
WindowActivate(false);
|
||||
int ActualWidth;
|
||||
int ActualHeight;
|
||||
|
||||
if( Windowed )
|
||||
{
|
||||
BorderWidth = GetSystemMetrics( SM_CXSIZEFRAME );
|
||||
BorderHeight = GetSystemMetrics( SM_CYSIZEFRAME );
|
||||
CaptionHeight = GetSystemMetrics( SM_CYCAPTION );
|
||||
ActualWidth = Width + BorderWidth * 2;
|
||||
ActualHeight = Height + BorderHeight * 2 + CaptionHeight;
|
||||
SetWindowLong( fWindowHndl, GWL_STYLE,
|
||||
WS_POPUP | WS_OVERLAPPEDWINDOW | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_VISIBLE);
|
||||
SetWindowLong(fWindowHndl, GWL_EXSTYLE, 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowLong(fWindowHndl, GWL_STYLE,
|
||||
WS_POPUP | WS_CLIPSIBLINGS | WS_CLIPCHILDREN | WS_MAXIMIZE | WS_VISIBLE);
|
||||
|
||||
SetWindowLong(fWindowHndl, GWL_EXSTYLE, WS_EX_APPWINDOW);
|
||||
}
|
||||
|
||||
if(!windowOnly)
|
||||
fPipeline->ResetDisplayDevice(Width, Height, ColorDepth, Windowed, NumAASamples, MaxAnisotropicSamples, VSync);
|
||||
|
||||
float aspectratio = (float)Width / (float)Height;
|
||||
plMouseDevice::Instance()->SetDisplayResolution((float)Width, (float)Height);
|
||||
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
|
||||
|
||||
UINT flags = SWP_NOCOPYBITS | SWP_NOMOVE | SWP_SHOWWINDOW;
|
||||
if(Windowed)
|
||||
{
|
||||
SetWindowPos( fWindowHndl, HWND_NOTOPMOST, 0, 0, ActualWidth, ActualHeight, flags );
|
||||
}
|
||||
else
|
||||
{
|
||||
SetWindowPos( fWindowHndl, HWND_TOP, 0, 0, Width, Height, flags );
|
||||
::ClipCursor(nil);
|
||||
}
|
||||
fPipeline->ResetDisplayDevice(Width, Height, ColorDepth, Windowed, NumAASamples, MaxAnisotropicSamples, VSync);
|
||||
|
||||
ResizeDisplayDevice(Width, Height, Windowed);
|
||||
|
||||
WindowActivate(true);
|
||||
}
|
||||
|
||||
void plClient::ResizeDisplayDevice(int Width, int Height, hsBool Windowed)
|
||||
{
|
||||
|
||||
if (plMouseDevice::Instance())
|
||||
plMouseDevice::Instance()->SetDisplayResolution((float)Width, (float)Height);
|
||||
|
||||
float aspectratio = (float)Width / (float)Height;
|
||||
if (pfGameGUIMgr::GetInstance())
|
||||
pfGameGUIMgr::GetInstance()->SetAspectRatio( aspectratio );
|
||||
|
||||
|
||||
UInt32 winStyle, winExStyle;
|
||||
if( Windowed )
|
||||
{
|
||||
// WS_VISIBLE appears necessary to avoid leaving behind framebuffer junk when going from windowed to a smaller window
|
||||
winStyle = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE;
|
||||
winExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE;
|
||||
} else {
|
||||
winStyle = WS_POPUP;
|
||||
winExStyle = WS_EX_APPWINDOW;
|
||||
}
|
||||
SetWindowLong(fWindowHndl, GWL_STYLE, winStyle);
|
||||
SetWindowLong(fWindowHndl, GWL_EXSTYLE, winExStyle);
|
||||
|
||||
|
||||
UInt32 flags = SWP_NOCOPYBITS | SWP_SHOWWINDOW | SWP_FRAMECHANGED;
|
||||
UInt32 OutsideWidth, OutsideHeight;
|
||||
HWND insertAfter;
|
||||
if( Windowed )
|
||||
{
|
||||
RECT winRect = { 0, 0, Width, Height };
|
||||
AdjustWindowRectEx(&winRect, winStyle, false, winExStyle);
|
||||
OutsideWidth = winRect.right - winRect.left;
|
||||
OutsideHeight = winRect.bottom - winRect.top;
|
||||
insertAfter = HWND_NOTOPMOST;
|
||||
} else {
|
||||
OutsideWidth = Width;
|
||||
OutsideHeight = Height;
|
||||
insertAfter = HWND_TOP;
|
||||
}
|
||||
SetWindowPos( fWindowHndl, insertAfter, 0, 0, OutsideWidth, OutsideHeight, flags );
|
||||
}
|
||||
|
||||
void WriteBool(hsStream *stream, char *name, hsBool on )
|
||||
{
|
||||
|
@ -292,7 +292,8 @@ public:
|
||||
virtual hsBool WindowActive() const { return fWindowActive; }
|
||||
|
||||
void SetMessagePumpProc( plMessagePumpProc proc ) { fMessagePumpProc = proc; }
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false, hsBool windowOnly = false);
|
||||
void ResetDisplayDevice(int Width, int Height, int ColorDepth, hsBool Windowed, int NumAASamples, int MaxAnisotropicSamples, hsBool VSync = false);
|
||||
void ResizeDisplayDevice(int Width, int Height, hsBool Windowed);
|
||||
void IDetectAudioVideoSettings();
|
||||
void IWriteDefaultGraphicsSettings(const wchar* destFile);
|
||||
|
||||
|
@ -785,11 +785,6 @@ bool InitClient( HWND hWnd )
|
||||
|
||||
#ifdef DETACH_EXE
|
||||
hInstance = ((LPCREATESTRUCT) lParam)->hInstance;
|
||||
#endif
|
||||
// If in fullscreen mode, get rid of the window borders. Note: this won't take
|
||||
// effect until the next SetWindowPos call
|
||||
|
||||
#ifdef DETACH_EXE
|
||||
|
||||
// This Function loads the EXE into Virtual memory...supposedly
|
||||
HRESULT hr = DetachFromMedium(hInstance, DMDFM_ALWAYS | DMDFM_ALLPAGES);
|
||||
@ -799,34 +794,7 @@ bool InitClient( HWND hWnd )
|
||||
gClient->SetDone(true);
|
||||
else
|
||||
{
|
||||
if( gClient->GetPipeline()->IsFullScreen() )
|
||||
{
|
||||
SetWindowLong(hWnd, GWL_STYLE, WS_POPUP);
|
||||
SetWindowLong(hWnd, GWL_EXSTYLE, WS_EX_TOPMOST);
|
||||
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
gWinBorderDX = gWinBorderDY = gWinMenuDY = 0;
|
||||
}
|
||||
else {
|
||||
SetWindowLong(hWnd, GWL_STYLE, WS_OVERLAPPED | WS_CAPTION);
|
||||
SetWindowPos(hWnd, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
|
||||
}
|
||||
|
||||
int goodWidth = gClient->GetPipeline()->Width() + gWinBorderDX * 2;
|
||||
int goodHeight = gClient->GetPipeline()->Height() + gWinBorderDY * 2 + gWinMenuDY;
|
||||
|
||||
SetWindowPos(
|
||||
hWnd,
|
||||
nil,
|
||||
0,
|
||||
0,
|
||||
goodWidth,
|
||||
goodHeight,
|
||||
SWP_NOCOPYBITS
|
||||
| SWP_NOMOVE
|
||||
| SWP_NOOWNERZORDER
|
||||
| SWP_NOZORDER
|
||||
| SWP_FRAMECHANGED
|
||||
);
|
||||
gClient->ResizeDisplayDevice(gClient->GetPipeline()->Width(), gClient->GetPipeline()->Height(), !gClient->GetPipeline()->IsFullScreen());
|
||||
}
|
||||
|
||||
if( gPendingActivate )
|
||||
|
@ -155,8 +155,7 @@ void ErrorMinimizeAppWindow () {
|
||||
// If the application's topmost window is a fullscreen
|
||||
// popup window, minimize it before displaying an error
|
||||
HWND appWindow = GetActiveWindow();
|
||||
if ( ((GetWindowLong(appWindow, GWL_STYLE) & WS_POPUP) != 0) &&
|
||||
((GetWindowLong(appWindow, GWL_EXSTYLE) & WS_EX_TOPMOST) != 0) )
|
||||
if ( ((GetWindowLong(appWindow, GWL_STYLE) & WS_POPUP) != 0) )
|
||||
SetWindowPos(
|
||||
appWindow,
|
||||
HWND_NOTOPMOST,
|
||||
|
@ -171,8 +171,6 @@ PyObject* pyVaultImageNode::Image_GetImage( void )
|
||||
else
|
||||
fMipmapKey->RefObject();
|
||||
}
|
||||
else
|
||||
PYTHON_RETURN_NONE;
|
||||
}
|
||||
|
||||
return pyImage::New(fMipmap);
|
||||
|
@ -328,25 +328,11 @@ plMipmap* plJPEG::ReadFromFile( const char *fileName )
|
||||
plMipmap* plJPEG::ReadFromFile( const wchar *fileName )
|
||||
{
|
||||
// we use a stream because the IJL can't handle unicode
|
||||
hsRAMStream tempstream;
|
||||
hsUNIXStream in;
|
||||
if (!in.Open(fileName, L"rb"))
|
||||
hsUNIXStream out;
|
||||
if (!out.Open(fileName, L"rb"))
|
||||
return false;
|
||||
|
||||
// The stream reader for JPEGs expects a 32-bit size at the start,
|
||||
// so insert that into the stream before passing it on
|
||||
in.FastFwd();
|
||||
UInt32 fsize = in.GetPosition();
|
||||
UInt8 *tempbuffer = TRACKED_NEW UInt8[fsize];
|
||||
in.Rewind();
|
||||
in.Read(fsize, tempbuffer);
|
||||
tempstream.WriteSwap32(fsize);
|
||||
tempstream.Write(fsize, tempbuffer);
|
||||
delete [] tempbuffer;
|
||||
tempstream.Rewind();
|
||||
|
||||
plMipmap* ret = IRead(&tempstream);
|
||||
in.Close();
|
||||
plMipmap* ret = IRead(&out);
|
||||
out.Close();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -433,7 +419,7 @@ hsBool plJPEG::IWrite( plMipmap *source, hsStream *outStream )
|
||||
jcProps.jquality = fWriteQuality;
|
||||
#else
|
||||
cinfo.jpeg_width = source->GetWidth(); // default
|
||||
cinfo.jpeg_height = source->GetHeight(); // default
|
||||
cinfo.jpeg_width = source->GetHeight(); // default
|
||||
cinfo.jpeg_color_space = JCS_YCbCr; // default
|
||||
// not sure how to set 4:1:1 but supposedly it's the default
|
||||
jpeg_set_quality( &cinfo, fWriteQuality, TRUE );
|
||||
@ -501,23 +487,10 @@ hsBool plJPEG::WriteToFile( const char *fileName, plMipmap *sourceData )
|
||||
hsBool plJPEG::WriteToFile( const wchar *fileName, plMipmap *sourceData )
|
||||
{
|
||||
// we use a stream because the IJL can't handle unicode
|
||||
hsRAMStream tempstream;
|
||||
hsUNIXStream out;
|
||||
if (!out.Open(fileName, L"wb"))
|
||||
return false;
|
||||
hsBool ret = IWrite(sourceData, &tempstream);
|
||||
if (ret)
|
||||
{
|
||||
// The stream writer for JPEGs prepends a 32-bit size,
|
||||
// so remove that from the stream before saving to a file
|
||||
tempstream.Rewind();
|
||||
UInt32 fsize = tempstream.ReadSwap32();
|
||||
UInt8 *tempbuffer = TRACKED_NEW UInt8[fsize];
|
||||
tempstream.Read(fsize, tempbuffer);
|
||||
out.Write(fsize, tempbuffer);
|
||||
|
||||
delete [] tempbuffer;
|
||||
}
|
||||
hsBool ret = IWrite(sourceData, &out);
|
||||
out.Close();
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user