⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 user.c

📁 Wine-20031016
💻 C
📖 第 1 页 / 共 2 页
字号:
 * * The depths are whatever DIBsections support on the client side. * Should they be limited by screen depth? */HRESULT WINAPIUser_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,				 LPDDSURFACEDESC2 pDDSD, LPVOID context,				 LPDDENUMMODESCALLBACK2 callback){    DDSURFACEDESC2 callback_sd;    DEVMODEW DevModeW;    const DDPIXELFORMAT* pixelformat;    int i;    TRACE("(%p)->(0x%08lx,%p,%p,%p)\n",iface,dwFlags,pDDSD,context,callback);    ZeroMemory(&callback_sd, sizeof(callback_sd));    callback_sd.dwSize = sizeof(callback_sd);    callback_sd.dwFlags = DDSD_HEIGHT|DDSD_WIDTH|DDSD_PIXELFORMAT|DDSD_CAPS	| DDSD_PITCH;    if (dwFlags & DDEDM_REFRESHRATES)	callback_sd.dwFlags |= DDSD_REFRESHRATE;    callback_sd.u2.dwRefreshRate = 60.0;    i = 0;    while (EnumDisplaySettingsExW(NULL, i, &DevModeW, 0))    {	callback_sd.dwHeight = DevModeW.dmPelsHeight;	callback_sd.dwWidth = DevModeW.dmPelsWidth;        if (DevModeW.dmFields&DM_DISPLAYFREQUENCY)        {            callback_sd.u2.dwRefreshRate = DevModeW.dmDisplayFrequency;        }	TRACE("- mode: %ldx%ld\n", callback_sd.dwWidth, callback_sd.dwHeight);                pixelformat = pixelformat_for_depth(DevModeW.dmBitsPerPel);        callback_sd.u1.lPitch            = DDRAW_width_bpp_to_pitch(DevModeW.dmPelsWidth,                                       pixelformat->u1.dwRGBBitCount);        callback_sd.u4.ddpfPixelFormat = *pixelformat;        callback_sd.ddsCaps.dwCaps = 0;        if (pixelformat->dwFlags & DDPF_PALETTEINDEXED8) /* ick */            callback_sd.ddsCaps.dwCaps |= DDSCAPS_PALETTE;        TRACE(" - %2ld bpp, R=%08lx G=%08lx B=%08lx\n",            callback_sd.u4.ddpfPixelFormat.u1.dwRGBBitCount,            callback_sd.u4.ddpfPixelFormat.u2.dwRBitMask,            callback_sd.u4.ddpfPixelFormat.u3.dwGBitMask,            callback_sd.u4.ddpfPixelFormat.u4.dwBBitMask);        if (callback(&callback_sd, context) == DDENUMRET_CANCEL)            return DD_OK;        i++;    }    return DD_OK;}/* EnumSurfaces: generic *//* FlipToGDISurface: ??? */#if 0HRESULT WINAPIUser_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,			LPDDCAPS pHELCaps){/* Based on my guesses for what is appropriate with some clues from the * NVidia driver. Not everything is actually implemented yet. * NV has but we don't: Overlays, Video Ports, DDCAPS_READSCANLINE, * DDCAPS2_CERTIFIED (heh), DDSCAPS2_NONLOCALVIDMEM, DDSCAPS2_COPYFOURCC. * It actually has no FX alpha caps. * Oddly, it doesn't list DDPCAPS_PRIMARYSURFACE. * And the HEL caps make little sense. */#define BLIT_CAPS (DDCAPS_BLT | DDCAPS_BLTCOLORFILL | DDCAPS_BLTDEPTHFILL \	  | DDCAPS_BLTSTRETCH | DDCAPS_CANBLTSYSMEM | DDCAPS_CANCLIP	  \	  | DDCAPS_CANCLIPSTRETCHED | DDCAPS_COLORKEY			  \	  | DDCAPS_COLORKEYHWASSIST)#define CKEY_CAPS (DDCKEYCAPS_DESTBLT | DDCKEYCAPS_SRCBLT)#define FX_CAPS (DDFXCAPS_BLTALPHA | DDFXCAPS_BLTMIRRORLEFTRIGHT	\		| DDFXCAPS_BLTMIRRORUPDOWN | DDFXCAPS_BLTROTATION90	\		| DDFXCAPS_BLTSHRINKX | DDFXCAPS_BLTSHRINKXN		\		| DDFXCAPS_BLTSHRINKY | DDFXCAPS_BLTSHRINKXN		\		| DDFXCAPS_BLTSTRETCHX | DDFXCAPS_BLTSTRETCHXN		\		| DDFXCAPS_BLTSTRETCHY | DDFXCAPS_BLTSTRETCHYN)#if 0#define ROPS { SRCCOPY, SRCPAINT, SRCAND, SRCINVERT, SRCERASE, NOTSRCCOPY, \	NOTSRCERASE, MERGEPAINT, BLACKNESS, WHITENESS, }#else#define ROPS { 0, }#endif    static const DDCAPS caps =    { sizeof(DDCAPS),      DDCAPS_3D | DDCAPS_GDI | DDCAPS_PALETTE | BLIT_CAPS,      DDCAPS2_CANMANAGETEXTURE | DDCAPS2_CANRENDERWINDOWED | DDCAPS2_CERTIFIED      | DDCAPS2_NOPAGELOCKREQUIRED | DDCAPS2_PRIMARYGAMMA      | DDCAPS2_WIDESURFACES,      CKEY_CAPS,      FX_CAPS,      0, /* dwFXAlphaCaps */      DDPCAPS_8BIT | DDPCAPS_PRIMARYSURFACE,      0, /* dwSVCaps */      0, /* ? dwAlphaBitConstBitDepths */      0, /* ? dwAlphaBitPixelPitDepths */      0, /* ? dwAlphaBltSurfaceBitDepths */      0, /* ? dwAlphaOverlayConstBitDepths */      0, /* ? dwAlphaOverlayPixelBitDepths */      0, /* ? dwAlphaOverlaySurfaceBitDepths */      DDBD_16, /* ? dwZBufferBitDepths */      16*1024*1024, /* dwVidMemTotal */      16*1024*1024, /* dwVidMemFree */      0, /* dwMaxVisibleOverlays */      0, /* dwCurrVisibleOverlays */      0, /* dwNumFourCCCodes */      0, /* dwAlignBoundarySrc */      0, /* dwAlignSizeSrc */      0, /* dwAlignBoundaryDest */      0, /* dwAlignSizeDest */      0, /* dwAlignStrideAlign */      ROPS, /* XXX dwRops[DD_ROP_SPACE] */      { 0, }, /* XXX ddsOldCaps */      1000, /* dwMinOverlayStretch */      1000, /* dwMaxOverlayStretch */      1000, /* dwMinLiveVideoStretch */      1000, /* dwMaxLiveVideoStretch */      1000, /* dwMinHwCodecStretch */      1000, /* dwMaxHwCodecStretch */      0, 0, 0, /* dwReserved1, 2, 3 */      BLIT_CAPS, /* dwSVBCaps */      CKEY_CAPS, /* dwSVBCKeyCaps */      FX_CAPS, /* dwSVBFXCaps */      ROPS, /* dwSVBRops */      BLIT_CAPS, /* dwVSBCaps */      CKEY_CAPS, /* dwVSBCKeyCaps */      FX_CAPS, /* dwVSBFXCaps */      ROPS, /* dwVSBRops */      BLIT_CAPS, /* dwSSBCaps */      CKEY_CAPS, /* dwSSBCKeyCaps */      FX_CAPS, /* dwSSBFXCaps */      ROPS, /* dwSSBRops */      0, /* dwMaxVideoPorts */      0, /* dwCurrVideoPorts */      0, /* ? dwSVBCaps2 */      BLIT_CAPS, /* ? dwNLVBCaps */      0, /* ? dwNLVBCaps2 */      CKEY_CAPS, /* dwNLVBCKeyCaps */      FX_CAPS, /* dwNLVBFXCaps */      ROPS, /* dwNLVBRops */      { /* ddsCaps */	  DDSCAPS_3DDEVICE | DDSCAPS_ALPHA | DDSCAPS_BACKBUFFER | DDSCAPS_FLIP	  | DDSCAPS_FRONTBUFFER | DDSCAPS_MIPMAP | DDSCAPS_OFFSCREENPLAIN	  | DDSCAPS_PALETTE | DDSCAPS_PRIMARYSURFACE | DDSCAPS_SYSTEMMEMORY	  | DDSCAPS_TEXTURE | DDSCAPS_VIDEOMEMORY | DDSCAPS_VISIBLE	  | DDSCAPS_ZBUFFER,	  DDSCAPS2_CUBEMAP,	  0,	  0      }    };#undef BLIT_CAPS#undef CKEY_CAPS#undef FX_CAPS#undef ROPS    ICOM_THIS(IDirectDrawImpl, iface);    TRACE("(%p)->(%p,%p)\n",This,pDriverCaps,pHELCaps);    if (pDriverCaps != NULL)	DD_STRUCT_COPY_BYSIZE(pDriverCaps,&caps);    if (pHELCaps != NULL)	DD_STRUCT_COPY_BYSIZE(pHELCaps,&caps);    return DD_OK;}#endifHRESULT WINAPIUser_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,				    LPDDDEVICEIDENTIFIER2 pDDDI,				    DWORD dwFlags){    TRACE("(%p)->(%p,%08lx)\n",iface,pDDDI,dwFlags);    *pDDDI = user_device;    return DD_OK;}/* GetDisplayMode: generic *//* GetFourCCCodes: generic *//* GetGDISurface: ??? *//* GetMonitorFrequency: generic *//* GetScanLine: generic *//* GetSurfaceFromDC: generic *//* GetVerticalBlankStatus: generic *//* Initialize: generic *//* RestoreAllSurfaces: generic *//* RestoreDisplayMode: generic *//* SetCooperativeLevel: ??? */HRESULT WINAPIUser_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,			       DWORD dwHeight, DWORD dwBPP,			       DWORD dwRefreshRate, DWORD dwFlags){    ICOM_THIS(IDirectDrawImpl, iface);    const DDPIXELFORMAT* pixelformat;    DEVMODEW devmode;    LONG pitch;    TRACE("(%p)->(%ldx%ldx%ld,%ld Hz,%08lx)\n",This,dwWidth,dwHeight,dwBPP,dwRefreshRate,dwFlags);    devmode.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT;    devmode.dmBitsPerPel = dwBPP;    devmode.dmPelsWidth  = dwWidth;    devmode.dmPelsHeight = dwHeight;    if (ChangeDisplaySettingsExW(NULL, &devmode, NULL, CDS_FULLSCREEN, NULL) != DISP_CHANGE_SUCCESSFUL)	return DDERR_INVALIDMODE;    pixelformat = pixelformat_for_depth(dwBPP);    if (pixelformat == NULL)    {	assert(0);	return DDERR_GENERIC;    }    pitch = DDRAW_width_bpp_to_pitch(dwWidth, dwBPP);    return Main_DirectDraw_SetDisplayMode(iface, dwWidth, dwHeight, pitch,					  dwRefreshRate, dwFlags, pixelformat);}/* StartModeTest: ??? *//* TestCooperativeLevel: generic? *//* WaitForVerticalBlank: ??? */static ICOM_VTABLE(IDirectDraw7) User_DirectDraw_VTable ={    ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE    Main_DirectDraw_QueryInterface,    Main_DirectDraw_AddRef,    Main_DirectDraw_Release,    Main_DirectDraw_Compact,    Main_DirectDraw_CreateClipper,    Main_DirectDraw_CreatePalette,    Main_DirectDraw_CreateSurface,    Main_DirectDraw_DuplicateSurface,    User_DirectDraw_EnumDisplayModes,    Main_DirectDraw_EnumSurfaces,    Main_DirectDraw_FlipToGDISurface,    Main_DirectDraw_GetCaps,    Main_DirectDraw_GetDisplayMode,    Main_DirectDraw_GetFourCCCodes,    Main_DirectDraw_GetGDISurface,    Main_DirectDraw_GetMonitorFrequency,    Main_DirectDraw_GetScanLine,    Main_DirectDraw_GetVerticalBlankStatus,    Main_DirectDraw_Initialize,    Main_DirectDraw_RestoreDisplayMode,    Main_DirectDraw_SetCooperativeLevel,    User_DirectDraw_SetDisplayMode,    Main_DirectDraw_WaitForVerticalBlank,    Main_DirectDraw_GetAvailableVidMem,    Main_DirectDraw_GetSurfaceFromDC,    Main_DirectDraw_RestoreAllSurfaces,    Main_DirectDraw_TestCooperativeLevel,    User_DirectDraw_GetDeviceIdentifier,    Main_DirectDraw_StartModeTest,    Main_DirectDraw_EvaluateMode};

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -