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

📄 ddhdd.cpp

📁 WinCE 3.0 BSP, 包含Inter SA1110, Intel_815E, Advantech_PCM9574 等
💻 CPP
字号:
#include "precomp.h"


EXTERN_C DWORD WINAPI DDGPESetMode( LPDDHAL_SETMODEDATA pd )
{
	/*
	typedef struct _DDHAL_SETMODEDATA
	{
	    LPDDRAWI_DIRECTDRAW_GBL lpDD;               // driver struct
	    DWORD               dwModeIndex;    		// new mode
	    HRESULT             ddRVal;         		// return value
	    LPDDHAL_SETMODE     SetMode;        		// PRIVATE: ptr to callback
	    BOOL                inexcl;         		// in exclusive mode
	} DDHAL_SETMODEDATA;
	*/

	HRESULT	ddr = DDHAL_DRIVER_HANDLED;

	DEBUGENTER( DDGPESetMode );

	// implementation
	pd->ddRVal = DD_OK;

	DDGPESurf*	pGDIPrimary = (DDGPESurf*)g_pGPE->PrimarySurface();

	if (pGDIPrimary == g_pDDrawPrimarySurface)
	{
		DEBUGMSG(HAL_ZONE_INIT, (TEXT("Setting mode to %d\r\n"), pd->dwModeIndex));

#if 0	// changing GDI primary is bad

		//g_pGPE->SetMode(pd->dwModeIndex, NULL, TRUE); // change GDI mode

		// Now call buildDDHALInfo to update the device caps
		// This call might already happen from within DDRAW and will therefore
		// be unnecessary.

		//UpdateHALInit(pd->lpDD, pd->dwModeIndex);
#else


		// we want to remember this so CreateSurface can know we want to split the primary
		// for a new mode

		// we can set the physical mode here and detect in CreateSurface that the physical mode
		// has changed... then we know we have to split the primary.

		g_pGPE->SetMode(pd->dwModeIndex, NULL, FALSE); // change GDI mode

#endif

	}
	else
	{
		// do nothing if we've split the mode

		ddr = DDHAL_DRIVER_NOTHANDLED;
	}

	DEBUGLEAVE( DDGPESetMode );
	return ddr;
}


DWORD WINAPI DDGPEWaitForVerticalBlank( LPDDHAL_WAITFORVERTICALBLANKDATA lpWaitForVerticalBlank )
{
	DEBUGENTER( DDGPEWaitForVerticalBlank );
	/*
	typedef struct _DDHAL_WAITFORVERTICALBLANKDATA
	{
	    LPDDRAWI_DIRECTDRAW_GBL	lpDD;           	// driver struct
	    DWORD					dwFlags;        	// flags
	    DWORD					bIsInVB;        	// is in vertical blank
	    DWORD					hEvent;         	// event
	    HRESUL					ddRVal;				// return value
	    LPDDHAL_WAITFORVERTICALBLANK WaitForVerticalBlank;
	    											// PRIVATE: ptr to callback
	} DDHAL_WAITFORVERTICALBLANKDATA;
	*/

    switch( lpWaitForVerticalBlank->dwFlags )
    {
    case DDWAITVB_I_TESTVB:
        /* 
         * if testvb is just a request for the current vertical blank 
         * status
         */
        lpWaitForVerticalBlank->ddRVal = DD_OK;
                                    // we got the vertical blank status
        lpWaitForVerticalBlank->bIsInVB = g_pGPE->InVBlank(); 

                                    // are we in vertical blank?
        return DDHAL_DRIVER_HANDLED;// request dealt with

    case DDWAITVB_BLOCKBEGIN:
        /* 
         * if blockbegin is requested we wait until the vertical blank
         * is over, and then wait for the display period to end.
         */
        while(g_pGPE->InVBlank());     // wait until we are not in vertical blank
        while(g_pGPE->InDisplay());    // wait until we leave display
        lpWaitForVerticalBlank->ddRVal = DD_OK;

                              //we got waited until block begin
        return DDHAL_DRIVER_HANDLED;
                              // request dealt with

    case DDWAITVB_BLOCKEND:
        /* 
         * if blockend is requested we wait for the vblank interval to 
         * end.
         */
        if( g_pGPE->InVBlank() )
        {
            while( g_pGPE->InVBlank() );//wait until we are not in vertical blank
        }
        else
        {
            while(g_pGPE->InDisplay()); // wait until we are not in display

            while(g_pGPE->InVBlank());  // wait until we leave vertical blank
        }
        //flipRecord.bFlipFlag = FALSE;           
                               // no longer need to wait for flip
        lpWaitForVerticalBlank->ddRVal = DD_OK;
                               // we successfully reached blockend
        return DDHAL_DRIVER_HANDLED;// request handled
    }

    return DDHAL_DRIVER_NOTHANDLED; // unable to handle request


	lpWaitForVerticalBlank->ddRVal = DD_OK;
	DEBUGLEAVE( DDGPEWaitForVerticalBlank );
	return DDHAL_DRIVER_HANDLED;
}

⌨️ 快捷键说明

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