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

📄 cspslcdcclass.cpp

📁 i.mx27 soc for wince 6.0
💻 CPP
📖 第 1 页 / 共 2 页
字号:
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::SetMode\r\n")));

    // Mode already set
    if (m_pMode != NULL)
        goto cleanup;
	
	// Set mode in BSP
    BspSetMode(modeId, pPalette);
    
    // After set mode in BSP, get mode and set it in CSP
    mode = BspGetMode();

    // Pass mode information to protected variables
    m_pMode = &mode;
    m_nScreenWidth = mode.width;
    m_nScreenHeight = mode.height;
    stride = (m_nScreenWidth * m_pMode->Bpp) / 8;   

    // Create an instance of Node2D class to allocate memory as single rectangular blocks
    if(!(m_p2DVideoMemory = new Node2D(mode.width, mode.height)))
    {
        DEBUGMSG(GPE_ZONE_ERROR, (TEXT("SetMode:Create Node2D object failed\r\n")));    
        goto cleanup;
    }   

    // Allocate storage for surface pixels used by GPE
    result = AllocSurface(&m_pPrimarySurface, mode.width, mode.height, mode.format, 
        GPE_REQUIRE_VIDEO_MEMORY);
    if(result != S_OK)
    {
        DEBUGMSG(GPE_ZONE_ERROR, (TEXT("SetMode:Allocate storage for surface failed\r\n")));
        goto cleanup;
    }
        
cleanup:
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::SetMode\r\n")));
    return (result);
}

//------------------------------------------------------------------------------
// CSP GPE Class GetModeInfo method populates a GPEMode structure 
// with data for the requested mode.
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::GetModeInfo(GPEMode *pMode, int modeNo)
{
    return (BspGetModeInfo(pMode, modeNo));
}

//------------------------------------------------------------------------------
// CSP GPE Class InVBlank method is not supported by SLCDC
//------------------------------------------------------------------------------
int CSPSlcdcClass::InVBlank(void)
{
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::InVBlank\r\n")));
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::InVBlank\r\n")));
    // SLCD doesn't support this
    return (S_FALSE);
}

//------------------------------------------------------------------------------
// CSP GPE Class SetPalette method
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::SetPalette(const PALETTEENTRY *src, unsigned short firstEntry, 
    unsigned short numEntries)
{
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::SetPalette\r\n")));
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::SetPalette\r\n")));
    // In 16bpp display mode, 
    // SLCDC supports pallette change, however unimplemented
    return S_OK;    
}

//------------------------------------------------------------------------------
// CSP GPE Class ContrastControl method is not supported by SLCDC
//------------------------------------------------------------------------------
BOOL CSPSlcdcClass::ContrastControl(ULONG cmd, ULONG *pValue)
{
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::ContrastControl\r\n")));
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::ContrastControl\r\n")));
    return (FALSE);
}

//------------------------------------------------------------------------------
// CSP GPE Class SetPointerShape method is not supported by SLCDC
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::SetPointerShape(GPESurf *pMask, GPESurf *pColorSurf, int xHot, int yHot, 
        int cx, int cy)
{
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::SetPointerShape\r\n")));
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::SetPointerShape\r\n")));
    return (S_FALSE);
}

//------------------------------------------------------------------------------
// CSP GPE Class MovePointer method is not supported by SLCDC
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::MovePointer(int x, int y )
{
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::MovePointer\r\n")));
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::MovePointer\r\n")));
    return (S_FALSE);
}

//------------------------------------------------------------------------------
// CSP GPE Class SetCursorColor method is not supported by SLCDC
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::SetCursorColor(UINT8 red, UINT8 green, UINT8 blue)
{
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::SetCursorColor\r\n")));
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::SetCursorColor\r\n")));
    return (S_FALSE);
}

//------------------------------------------------------------------------------
// CSP GPE Class Line method executes before and after a sequence of 
// line segments, which are drawn as a path.
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::Line( GPELineParms *pLineParms, EGPEPhase phase)
{
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::Line\r\n")));

    // No hardware line support
    pLineParms->pLine = &GPE::EmulatedLine;
    
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::Line\r\n")));
    return (S_OK);
}

//------------------------------------------------------------------------------
// CSP GPE Class BltPrepare method dentifies the appropriate functions 
// needed to perform individual blits.
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::BltPrepare (GPEBltParms *pBltParms)
{
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::BltPrepare\r\n")));

    // Allow GPE to blit
    pBltParms->pBlt = &GPE::EmulatedBlt; 

    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::BltPrepare\r\n")));
    return (S_OK);
}

//------------------------------------------------------------------------------
// CSP GPE Class BltComplete method executes to complete 
// a blit sequence initiated by GPE::BltPrepare
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::BltComplete(GPEBltParms *pBltParms)
{
    return (BspBltComplete());
}

//------------------------------------------------------------------------------
// CSP GPE Class AllocSurface method executes when the driver 
// must allocate storage for surface pixels.
//------------------------------------------------------------------------------
SCODE CSPSlcdcClass::AllocSurface(GPESurf **ppSurf, int width, int height, EGPEFormat format, int surfaceFlags)
{
    SCODE result = S_OK;
    
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("++CSPSlcdcClass::AllocSurface\r\n")));

    // Video memory requested
    if(surfaceFlags & GPE_REQUIRE_VIDEO_MEMORY)
    {
        if(format != mode.format)
        {
            DEBUGMSG(GPE_ZONE_ERROR, (TEXT("AllocSurface - Invalid format value\n")));
            result = E_INVALIDARG;
            goto cleanup;
        }
        
        // Attempt to allocate from video memory
        {
            Node2D *pNode;
            unsigned long offset = 0;
            
            // Allocate the node
            if(!(pNode = m_p2DVideoMemory->Alloc(width, height)))
            {
                DEBUGMSG(GPE_ZONE_ERROR, (TEXT("AllocSurface - Cannot allcoate the node\n")));
                result = E_OUTOFMEMORY;
                goto cleanup;
            }                               

            // Allocate the surface
            if (!(*ppSurf = new SlcdcSurf(width, height, offset, (void *) (video_mem + offset),
                stride, format, pNode)))
            {
                pNode->Free();
                DEBUGMSG(GPE_ZONE_ERROR, (TEXT("AllocSurface - Out of Memory 1\n")));
                result = E_OUTOFMEMORY;
                goto cleanup;
            }
            
        }
    }

    // Allocate from system memory
    else
    {
        *ppSurf = new GPESurf( width, height, format);
        if (*ppSurf != NULL)
        {
            // check we allocated bits succesfully
            if (((*ppSurf)->Buffer()) == NULL)
            {
                delete *ppSurf;
                result = E_OUTOFMEMORY;
            }
            else
                result = S_OK;
        }
    }

cleanup:    
    DEBUGMSG(GPE_ZONE_ENTER, (TEXT("--CSPSlcdcClass::AllocSurface\r\n")));
    return (result);
}

//------------------------------------------------------------------------------
// CSP GPE Class DrvEscape method is not supported by SLCDC
//------------------------------------------------------------------------------
ULONG   CSPSlcdcClass::DrvEscape( SURFOBJ *pso,
                                ULONG    iEsc,
                                ULONG    cjIn,
                                PVOID    pvIn,
                                ULONG    cjOut,
                                PVOID    pvOut)
{
    return (0);
}


//------------------------------------------------------------------------------
// CSP GPE Class PowerHandler method Turn on/off SLCDC
//------------------------------------------------------------------------------
void CSPSlcdcClass::PowerHandler(BOOL bOff)
{   
    BspPowerHandler(bOff);
}

⌨️ 快捷键说明

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