HRESULT DepthSurface::GetSurfaceDesc( LPDDSURFACEDESC lpDDSurfaceDesc ) { #if LOGGER std::ostringstream str; str << this << " " << __FUNCTION__; LogText(str.str()); #endif if (lpDDSurfaceDesc == nullptr) { #if LOGGER str.str("\tDDERR_INVALIDPARAMS"); LogText(str.str()); #endif return DDERR_INVALIDPARAMS; } *lpDDSurfaceDesc = {}; lpDDSurfaceDesc->dwSize = sizeof(DDSURFACEDESC); lpDDSurfaceDesc->dwFlags = DDSD_CAPS; lpDDSurfaceDesc->ddsCaps.dwCaps = DDSCAPS_ZBUFFER | DDSCAPS_VIDEOMEMORY; #if LOGGER str.str(""); str << "\t" << tostr_DDSURFACEDESC(lpDDSurfaceDesc); LogText(str.str()); #endif return DD_OK; }
HRESULT DirectDraw2::CreateSurface( LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *lplpDDSurface, IUnknown FAR *pUnkOuter ) { std::ostringstream str; str << this << " " << __FUNCTION__; str << tostr_DDSURFACEDESC(lpDDSurfaceDesc); HRESULT hr = this->_original->CreateSurface(lpDDSurfaceDesc, lplpDDSurface, pUnkOuter); if (SUCCEEDED(hr)) { *lplpDDSurface = CreateWrapperT(DirectDrawSurface, *lplpDDSurface); } str << std::endl; str << tostr_HR(hr); if (lplpDDSurface) { str << " " << *lplpDDSurface; } LogText(str.str()); return hr; }
static HRESULT CALLBACK EnumModesCallback(LPDDSURFACEDESC lpDDSurfaceDesc, LPVOID lpContext) { std::ostringstream str; str << "\t" << lpContext; str << tostr_DDSURFACEDESC(lpDDSurfaceDesc); LogText(str.str()); return s_lpEnumModesCallback(lpDDSurfaceDesc, lpContext); }
HRESULT DirectDraw::CreateSurface( LPDDSURFACEDESC lpDDSurfaceDesc, LPDIRECTDRAWSURFACE FAR *lplpDDSurface, IUnknown FAR *pUnkOuter ) { std::ostringstream str; str << this << " " << __FUNCTION__; str << tostr_DDSURFACEDESC(lpDDSurfaceDesc); if (lpDDSurfaceDesc) { if (lpDDSurfaceDesc->ddsCaps.dwCaps & DDSCAPS_ZBUFFER) { lpDDSurfaceDesc->dwWidth = GetSystemMetrics(SM_CXSCREEN); lpDDSurfaceDesc->dwHeight = GetSystemMetrics(SM_CYSCREEN); str << std::endl; str << "\tMODIFIED"; str << tostr_DDSURFACEDESC(lpDDSurfaceDesc); } } HRESULT hr = this->_original->CreateSurface(lpDDSurfaceDesc, lplpDDSurface, pUnkOuter); if (SUCCEEDED(hr)) { *lplpDDSurface = CreateWrapperT(DirectDrawSurface, *lplpDDSurface); } str << std::endl; str << tostr_HR(hr); if (lplpDDSurface) { str << " " << *lplpDDSurface; } LogText(str.str()); return hr; }
HRESULT BackbufferSurface::GetSurfaceDesc( LPDDSURFACEDESC lpDDSurfaceDesc ) { #if LOGGER std::ostringstream str; str << this << " " << __FUNCTION__; LogText(str.str()); #endif if (lpDDSurfaceDesc == nullptr) { #if LOGGER str.str("\tDDERR_INVALIDPARAMS"); LogText(str.str()); #endif return DDERR_INVALIDPARAMS; } memset(lpDDSurfaceDesc, 0, sizeof(DDSURFACEDESC)); lpDDSurfaceDesc->dwSize = sizeof(DDSURFACEDESC); lpDDSurfaceDesc->dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH; lpDDSurfaceDesc->ddsCaps.dwCaps = DDSCAPS_BACKBUFFER | DDSCAPS_VIDEOMEMORY; lpDDSurfaceDesc->ddpfPixelFormat.dwSize = sizeof(DDPIXELFORMAT); lpDDSurfaceDesc->ddpfPixelFormat.dwFlags = DDPF_RGB; lpDDSurfaceDesc->ddpfPixelFormat.dwRGBBitCount = 16; lpDDSurfaceDesc->ddpfPixelFormat.dwRBitMask = 0xF800; lpDDSurfaceDesc->ddpfPixelFormat.dwGBitMask = 0x7E0; lpDDSurfaceDesc->ddpfPixelFormat.dwBBitMask = 0x1F; lpDDSurfaceDesc->dwHeight = this->_deviceResources->_displayHeight; lpDDSurfaceDesc->dwWidth = this->_deviceResources->_displayWidth; lpDDSurfaceDesc->lPitch = this->_deviceResources->_displayWidth * this->_deviceResources->_displayBpp; if (this->_deviceResources->_frontbufferSurface) { lpDDSurfaceDesc->lPitch = this->_deviceResources->_displayWidth * 2; } #if LOGGER str.str(""); str << "\t" << tostr_DDSURFACEDESC(lpDDSurfaceDesc); LogText(str.str()); #endif return DD_OK; }
HRESULT TextureSurface::GetSurfaceDesc( LPDDSURFACEDESC lpDDSurfaceDesc ) { #if LOGGER std::ostringstream str; str << this << " " << __FUNCTION__; LogText(str.str()); #endif if (lpDDSurfaceDesc == nullptr) { #if LOGGER str.str("\tDDERR_INVALIDPARAMS"); LogText(str.str()); #endif return DDERR_INVALIDPARAMS; } *lpDDSurfaceDesc = {}; lpDDSurfaceDesc->dwSize = sizeof(DDSURFACEDESC); lpDDSurfaceDesc->dwFlags = DDSD_CAPS | DDSD_PIXELFORMAT | DDSD_HEIGHT | DDSD_WIDTH | DDSD_PITCH | DDSD_MIPMAPCOUNT; lpDDSurfaceDesc->ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_MIPMAP | DDSCAPS_SYSTEMMEMORY; lpDDSurfaceDesc->ddpfPixelFormat = this->_pixelFormat; lpDDSurfaceDesc->dwHeight = this->_height; lpDDSurfaceDesc->dwWidth = this->_width; lpDDSurfaceDesc->lPitch = this->_width * this->_pixelFormat.dwRGBBitCount / 8; lpDDSurfaceDesc->dwMipMapCount = this->_mipmapCount; #if LOGGER str.str(""); str << "\t" << tostr_DDSURFACEDESC(lpDDSurfaceDesc); LogText(str.str()); #endif return DD_OK; }