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

📄 halcaps.cpp

📁 IMX31开发板
💻 CPP
📖 第 1 页 / 共 3 页
字号:


const DDKERNELCAPS KernelCaps =
{
    sizeof(DDKERNELCAPS),
    0,
};

// set up by HalInit
// This global pointer is to be recorded in the DirectDraw structure
DDGPE*            g_pGPE                    = (DDGPE*)NULL;
DDGPESurf*        g_pDDrawPrimarySurface    = NULL;

#endif // PLAT_WPC || PLAT_SMARTPHONE

// InitDDHALInfo must set up this information
unsigned long    g_nVideoMemorySize        = 0L;
unsigned char *  g_pVideoMemory            = NULL;    // virtual address of video memory from client's side
#ifndef PLAT_WPC
#ifndef PLAT_SMARTPHONE
DDHALMODEINFO    g_ModeInfo;
#endif
#endif


//------------------------------------------------------------------------------
// Local Variables


//------------------------------------------------------------------------------
// Local Functions


//------------------------------------------------------------------------------
//
// Function: buildDDHALInfo
//
// This function sets up the global variables that DDGPE requires.
// The buildDDHALInfo function then populates the specified DDHALINFO
// structure with the appropriate DirectDraw callbacks, caps, and
// other driver-specific parameters. These are filled out both at
// initialization time and during mode changes.
//
// Parameters:
//      lpddhi
//          [out] A pointer to a DDHALINFO structure that should be
//          populated with the appropriate settings.
//
//      modeIndex
//          [in] A DWORD indicating the current mode.
//
// Returns:
//      None.
//
//------------------------------------------------------------------------------
EXTERN_C void buildDDHALInfo( LPDDHALINFO lpddhi, DWORD modeidx )
{
    DEBUGMSG(GPE_ZONE_INIT, (TEXT("MX21DDLcdc buildDDHALInfo: ==>\r\n")));
    memset( lpddhi, 0, sizeof(DDHALINFO) );        // Clear the DDHALINFO structure

#if defined(PLAT_WPC) || defined(PLAT_SMARTPHONE)
    DDIPU_SDC *pGPE = (DDIPU_SDC *)GetDDGPE();
#else
    DDIPU_SDC *pGPE = (DDIPU_SDC *)g_pGPE;

    DDHALMODEINFO *pModeTable = &g_ModeInfo;

    pModeTable->dwWidth = pGPE->m_pMode->width;
    pModeTable->dwHeight = pGPE->m_pMode->height;
    pModeTable->dwBPP = pGPE->m_pMode->Bpp;

    if (pModeTable->dwBPP <= 8)
    {
        pModeTable->wFlags = DDMODEINFO_PALETTIZED;
    }
    else
    {
        pModeTable->wFlags = 0;
    }

    pModeTable->wRefreshRate = pGPE->m_pMode->frequency;
    pModeTable->lPitch = pGPE->m_pModeEx->lPitch;
    pModeTable->dwRBitMask = pGPE->m_pModeEx->dwRBitMask;
    pModeTable->dwGBitMask = pGPE->m_pModeEx->dwGBitMask;
    pModeTable->dwBBitMask = pGPE->m_pModeEx->dwBBitMask;
    pModeTable->dwAlphaBitMask = pGPE->m_pModeEx->dwAlphaBitMask;

#endif

    if( !g_pVideoMemory )    // in case this is called more than once...
    {
        // g_pGPE and g_pDDrawPrimarySurface were already set up by HalInit
        unsigned long physicalVideoMemoryStart;
#if defined(PLAT_WPC) || defined(PLAT_SMARTPHONE)
        pGPE->GetPhysicalVideoMemory( &physicalVideoMemoryStart, &g_nVideoMemorySize );
#else
        g_pGPE->GetPhysicalVideoMemory( &physicalVideoMemoryStart, &g_nVideoMemorySize );
#endif
        DEBUGMSG( GPE_ZONE_INIT,(TEXT("GetPhysicalVideoMemory returned phys=0x%08x size=%d\r\n"),
            physicalVideoMemoryStart, g_nVideoMemorySize));

        g_pVideoMemory = (BYTE*)physicalVideoMemoryStart;

        DEBUGMSG( GPE_ZONE_INIT,(TEXT("gpVidMem=%08x\r\n"), g_pVideoMemory ));
    }

    // Populate the rest of the DDHALINFO structure:
    lpddhi->dwSize = sizeof(DDHALINFO);
    lpddhi->lpDDCallbacks = &cbDDCallbacks;
    lpddhi->lpDDSurfaceCallbacks = &cbDDSurfaceCallbacks;
    lpddhi->GetDriverInfo = HalGetDriverInfo;

#ifndef PLAT_WPC
#ifndef PLAT_SMARTPHONE
    lpddhi->lpDDPaletteCallbacks = &cbDDPaletteCallbacks;
    lpddhi->lpDDExeBufCallbacks = &cbDDExeBufCallbacks;

    // Video memory infomations
    lpddhi->vmiData.fpPrimary = (unsigned long)(g_pVideoMemory) + g_pDDrawPrimarySurface->OffsetInVideoMemory();    // pointer to primary surface

    lpddhi->vmiData.dwFlags = 0;                           // flags
    lpddhi->vmiData.dwDisplayWidth = SCREEN_WIDTH;         // current display width
    lpddhi->vmiData.dwDisplayHeight = SCREEN_HEIGHT;       // current display height
    lpddhi->vmiData.lDisplayPitch = pModeTable->lPitch;    // current display pitch
    lpddhi->vmiData.ddpfDisplay.dwSize = sizeof(DDPIXELFORMAT);
                                                           // ... = 8bit/pixel palettized
    lpddhi->vmiData.ddpfDisplay.dwFourCC = 0;              // (FOURCC code)

     if (pModeTable->wFlags & DDMODEINFO_PALETTIZED)
        lpddhi->vmiData.ddpfDisplay.dwFlags = DDPF_RGB | DDPF_PALETTEINDEXED8;
    else
        lpddhi->vmiData.ddpfDisplay.dwFlags = DDPF_RGB;

    lpddhi->vmiData.ddpfDisplay.dwRBitMask = pModeTable->dwRBitMask;
    lpddhi->vmiData.ddpfDisplay.dwGBitMask = pModeTable->dwGBitMask;
    lpddhi->vmiData.ddpfDisplay.dwBBitMask = pModeTable->dwBBitMask;
    lpddhi->vmiData.ddpfDisplay.dwRGBBitCount = pModeTable->dwBPP;
                                                   // how many bits per pixel (BD_4,8,16,24,32)
    lpddhi->vmiData.dwOffscreenAlign = 8;         // byte alignment for offscreen surfaces
    lpddhi->vmiData.dwOverlayAlign = 16;            // byte alignment for overlays
    lpddhi->vmiData.dwTextureAlign = 128;          // byte alignment for textures
    lpddhi->vmiData.dwZBufferAlign = 16;           // byte alignment for z buffers
    lpddhi->vmiData.dwAlphaAlign = 4;              // byte alignment for alpha
    lpddhi->vmiData.dwNumHeaps = 0;                // number of memory heaps in vmList
    lpddhi->vmiData.pvmList = (LPVIDMEM)NULL;      // array of heaps
#endif
#endif

    // hw specific caps:
    lpddhi->ddCaps.dwSize = sizeof(DDCAPS);     // size of the DDDRIVERCAPS structure

#if defined(PLAT_WPC) || defined(PLAT_SMARTPHONE)
    lpddhi->ddCaps.dwCKeyCaps =                    // color key capabilities
        // DDCKEYCAPS_BOTHBLT |                       // Supports transparent blitting with for both source and destination surfaces.
        // DDCKEYCAPS_DESTBLT |                       // Supports transparent blitting with a color key that identifies the replaceable bits of the destination surface for RGB colors.
        // DDCKEYCAPS_DESTBLTCLRSPACE |               // Supports transparent blitting with a color space that identifies the replaceable bits of the destination surface for RGB colors.
        // DDCKEYCAPS_DESTBLTCLRSPACEYUV |            // Supports transparent blitting with a color space that identifies the replaceable bits of the destination surface for YUV colors.
        // DDCKEYCAPS_SRCBLT |                        // Supports transparent blitting using the color key for the source with this surface for RGB colors.
        // DDCKEYCAPS_SRCBLTCLRSPACE |                // Supports transparent blitting using a color space for the source with this surface for RGB colors.
        // DDCKEYCAPS_SRCBLTCLRSPACEYUV |             // Supports transparent blitting using a color space for the source with this surface for YUV colors.
        0;

    lpddhi->ddCaps.dwPalCaps  =                    //Palette capabilities.
        // DDPCAPS_ALPHA |                         // Supports palettes that include an alpha component.
        DDPCAPS_PRIMARYSURFACE |                // Indicates that the palette is attached to the primary surface.
        0;

    lpddhi->ddCaps.dwBltCaps =                     // Driver specific blitting capabilities.
        DDBLTCAPS_READSYSMEM |                  // Supports blitting from system memory.
        DDBLTCAPS_WRITESYSMEM |                 // Supports blitting to system memory.
        // DDBLTCAPS_FOURCCTORGB |                 // Supports blitting from a surface with a FOURCC pixel format to a surface with an RGB pixel format.
        // DDBLTCAPS_COPYFOURCC |                  // Supports blitting from a surface with a FOURCC pixel format to another surface with the same pixel format, or to the same surface.
        // DDBLTCAPS_FILLFOURCC |                  // Supports color-fill blitting to a surface with a FOURCC pixel format.
        0;

    lpddhi->ddCaps.dwAlphaCaps =                   // Alpha blitting capabilities.
        // DDALPHACAPS_ALPHAPIXELS |               // Supports per-pixel alpha values specified alongside with the RGB values in the pixel structure.
        // DDALPHACAPS_PREMULT  |                  // Supports pixel formats with premultiplied alpha values.
        // DDALPHACAPS_NONPREMULT  |               // Supports pixel formats with non-premultiplied alpha values.
        // DDALPHACAPS_ALPHAFILL  |                // Supports color-fill blitting using an alpha value.
        // DDALPHACAPS_ALPHANEG  |                 // Supports inverted-alpha pixel formats, where 0 indicates fully opaque and 255 indicates fully transparent.
        0;

    lpddhi->ddCaps.dwOverlayCaps =                 // General overlay capabilities.
        DDOVERLAYCAPS_FLIP |                    // Supports surface flipping with overlays.
        DDOVERLAYCAPS_FOURCC |                  // Supports FOURCC pixel formats with overlays. Use IDirectDraw::GetFourCCCodes to determine which FOURCC formats are supported.
        // DDOVERLAYCAPS_ZORDER |                  // Supports changing Z order of overlays.
        // DDOVERLAYCAPS_MIRRORLEFTRIGHT |         // Supports surface mirroring in the left-to-right direction for overlays.
        DDOVERLAYCAPS_MIRRORUPDOWN |            // Supports surface mirroring in the up-to-down direction for overlays.
        DDOVERLAYCAPS_CKEYSRC |                 // Supports source color keying for overlays.
        // DDOVERLAYCAPS_CKEYSRCCLRSPACE |         // Supports source color-space keying for overlays.
        // DDOVERLAYCAPS_CKEYSRCCLRSPACEYUV |      // Supports source color-space keying for overlays with FOURCC pixel formats.
        DDOVERLAYCAPS_CKEYDEST |                // Supports destination color keying for overlays.
        // DDOVERLAYCAPS_CKEYDESTCLRSPACE |        // Supports destination colo-space keying for overlays.
        // DDOVERLAYCAPS_CKEYDESTCLRSPACEYUV |     // Supports destination color-space keying for overlays with FOURCC pixel formats.
        // DDOVERLAYCAPS_CKEYBOTH |                // Supports simultaneous source and destination color keying for overlays.
        // DDOVERLAYCAPS_ALPHADEST |               // Supports destination alpha blending for overlays.
        // DDOVERLAYCAPS_ALPHASRC |                // Supports source alpha blending for overlays.
        // DDOVERLAYCAPS_ALPHADESTNEG |            // Supports inverted destination alpha blending for overlays.
        // DDOVERLAYCAPS_ALPHASRCNEG |             // Supports inverted source alpha blending for overlays.
        // DDOVERLAYCAPS_ALPHACONSTANT |           // Supports constant alpha blending for overlays (specified in the DDOVERLAYFX structure).
        // DDOVERLAYCAPS_ALPHAPREMULT |            // Supports premultiplied alpha pixel formats for overlay alpha blending.
        // DDOVERLAYCAPS_ALPHANONPREMULT |         // Supports non-premultiplied alpha pixel formats for overlay alpha blending.
        // DDOVERLAYCAPS_ALPHAANDKEYDEST |         // Supports simultaneous source alpha blending with a destination color key for overlays.
        DDOVERLAYCAPS_OVERLAYSUPPORT |          // Supports overlay surfaces.
        0;

    lpddhi->ddCaps.dwMiscCaps =                    // Miscellaneous video capabilities.
        // DDMISCCAPS_READSCANLINE |               // Supports reading the current scanline being drawn.
        // DDMISCCAPS_READMONITORFREQ |            // Unsupported.
        // DDMISCCAPS_READVBLANKSTATUS |           // Supports reading the current V-Blank status of the hardware.
        // DDMISCCAPS_FLIPINTERVAL |               // Supports interval flipping.
        // DDMISCCAPS_FLIPODDEVEN |                // Supports Even/Odd flipping.
        // DDMISCCAPS_FLIPVSYNCWITHVBI |           // Supports V-Sync-coordinated flipping.
        // DDMISCCAPS_COLORCONTROLOVERLAY |        // Supports color controls on overlay surfaces.
        // DDMISCCAPS_COLORCONTROLPRIMARY |        // Supports color controls on primary surfaces.
        // DDMISCCAPS_GAMMACONTROLOVERLAY |        // Supports gamma controls on overlay surfaces.
        // DDMISCCAPS_GAMMACONTROLPRIMARY |        // Supports gamma controls on primary surfaces.
        0;

    lpddhi->ddCaps.ddsCaps.dwCaps =                // Capabilities of the surface.
        // DDSCAPS_ALPHA |                         // Indicates that this surface contains alpha-only information.
        DDSCAPS_BACKBUFFER |                    // Indicates that this surface is the back buffer of a surface flipping structure.
        DDSCAPS_FLIP |                          // Indicates that this surface is a part of a surface flipping structure.
        DDSCAPS_FRONTBUFFER |                   // Indicates that this surface is the front buffer of a surface flipping structure.

⌨️ 快捷键说明

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