diff --git a/reactos/drivers/video/displays/framebuf/ddenable.c b/reactos/drivers/video/displays/framebuf/ddenable.c index d384483983e..ec3a5eb9ab5 100644 --- a/reactos/drivers/video/displays/framebuf/ddenable.c +++ b/reactos/drivers/video/displays/framebuf/ddenable.c @@ -51,16 +51,17 @@ DrvEnableDirectDraw( ppdev->ddpfDisplay.dwGBitMask = ppdev->GreenMask; ppdev->ddpfDisplay.dwBBitMask = ppdev->BlueMask; - switch(ppdev->BitsPerPixel) + ppdev->ddpfDisplay.dwRGBBitCount=ppdev->BitsPerPixel; + ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0; + ppdev->ddpfDisplay.dwFlags = DDPF_RGB; + + switch(ppdev->iDitherFormat) { - case BMF_8BPP: - ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0; - ppdev->ddpfDisplay.dwRGBBitCount=8; - ppdev->ddpfDisplay.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8; + case BMF_8BPP: + ppdev->ddpfDisplay.dwFlags |= DDPF_PALETTEINDEXED8; break; - case BMF_16BPP: - ppdev->ddpfDisplay.dwRGBBitCount=16; + case BMF_16BPP: switch(ppdev->RedMask) { case 0x7C00: @@ -68,28 +69,23 @@ DrvEnableDirectDraw( break; default: - ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0; + break; } break; - case BMF_24BPP: - ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0; - ppdev->ddpfDisplay.dwRGBBitCount=24; + case BMF_24BPP: break; case BMF_32BPP: - ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0xff000000; - ppdev->ddpfDisplay.dwRGBBitCount=32; + ppdev->ddpfDisplay.dwRGBAlphaBitMask = 0xff000000; break; + default: - /* FIXME unknown pixelformat */ + /* FIXME unknown pixel bits */ + ppdev->ddpfDisplay.dwRGBBitCount=0; break; } - - - //InitDDHAL(ppdev); - - + if (pCallBacks !=NULL) { memset(pCallBacks,0,sizeof(DD_CALLBACKS)); @@ -138,6 +134,52 @@ DrvGetDirectDrawInfo( OUT DWORD *pdwNumFourCCCodes, OUT DWORD *pdwFourCC) { - return FALSE; + PPDEV ppdev = (PPDEV)dhpdev; + + /* rest some data */ + *pdwNumFourCCCodes = 0; + *pdwNumHeaps = 0; + + + + /* + check see if pvmList and pdwFourCC are second call + or frist. Secon call we fill in pHalInfo info + */ + + if(!(pvmList && pdwFourCC)) + { + + /* Calc how much memmory is left on the video cards memmory */ + pHalInfo->ddCaps.dwVidMemTotal = (ppdev->MemHeight - ppdev->ScreenHeight) * ppdev->ScreenDelta; + + /* fill in some basic info that we need */ + pHalInfo->vmiData.pvPrimary = ppdev->ScreenPtr; + pHalInfo->vmiData.fpPrimary = 0; + pHalInfo->vmiData.dwDisplayWidth = ppdev->ScreenWidth; + pHalInfo->vmiData.dwDisplayHeight = ppdev->ScreenHeight; + pHalInfo->vmiData.lDisplayPitch = ppdev->ScreenDelta; + pHalInfo->vmiData.ddpfDisplay.dwSize = sizeof(DDPIXELFORMAT); + pHalInfo->vmiData.ddpfDisplay.dwFlags = DDPF_RGB; + pHalInfo->vmiData.ddpfDisplay.dwRGBBitCount = ppdev->BitsPerPixel; + pHalInfo->vmiData.ddpfDisplay.dwRBitMask = ppdev->RedMask; + pHalInfo->vmiData.ddpfDisplay.dwGBitMask = ppdev->GreenMask; + pHalInfo->vmiData.ddpfDisplay.dwBBitMask = ppdev->BlueMask; + pHalInfo->vmiData.dwOffscreenAlign = 4; + pHalInfo->vmiData.dwZBufferAlign = 4; + pHalInfo->vmiData.dwTextureAlign = 4; + + if ( ppdev->BitsPerPixel == 8 ) + { + pHalInfo->vmiData.ddpfDisplay.dwFlags |= DDPF_PALETTEINDEXED8; + } + + + + + + } + + return TRUE; } diff --git a/reactos/drivers/video/displays/framebuf/framebuf.h b/reactos/drivers/video/displays/framebuf/framebuf.h index bd69709f76a..fa37a157524 100644 --- a/reactos/drivers/video/displays/framebuf/framebuf.h +++ b/reactos/drivers/video/displays/framebuf/framebuf.h @@ -63,6 +63,8 @@ typedef struct _PDEV #endif /* DirectX Support */ + DWORD iDitherFormat; + ULONG MemHeight; BOOL bDDInitialized; DDPIXELFORMAT ddpfDisplay; DDHALINFO dxHalInfo; diff --git a/reactos/drivers/video/displays/framebuf/screen.c b/reactos/drivers/video/displays/framebuf/screen.c index 6b8557f2a41..fe2e30c087b 100644 --- a/reactos/drivers/video/displays/framebuf/screen.c +++ b/reactos/drivers/video/displays/framebuf/screen.c @@ -191,6 +191,8 @@ IntInitScreenInfo( ppdev->ScreenDelta = SelectedMode->ScreenStride; ppdev->BitsPerPixel = SelectedMode->BitsPerPlane * SelectedMode->NumberOfPlanes; + ppdev->MemHeight = SelectedMode->VideoMemoryBitmapHeight; + ppdev->RedMask = SelectedMode->RedMask; ppdev->GreenMask = SelectedMode->GreenMask; ppdev->BlueMask = SelectedMode->BlueMask; diff --git a/reactos/drivers/video/displays/framebuf/surface.c b/reactos/drivers/video/displays/framebuf/surface.c index c9cedf60df3..abcfb95900f 100644 --- a/reactos/drivers/video/displays/framebuf/surface.c +++ b/reactos/drivers/video/displays/framebuf/surface.c @@ -91,6 +91,8 @@ DrvEnableSurface( return FALSE; } + ppdev->iDitherFormat = BitmapType; + ScreenSize.cx = ppdev->ScreenWidth; ScreenSize.cy = ppdev->ScreenHeight; @@ -181,8 +183,9 @@ DrvAssertMode( &ulTemp); if (ppdev->BitsPerPixel == 8) { - IntSetPalette(dhpdev, ppdev->PaletteEntries, 0, 256); + IntSetPalette(dhpdev, ppdev->PaletteEntries, 0, 256); } + return Result; }