Пример #1
0
BOOL CLCDOutput::OnDraw(void)
{
    DWORD dwPriorityToUse = LGLCD_ASYNC_UPDATE(m_nPriority);

    if ( (NULL == m_pActivePage) ||
        (LGLCD_INVALID_DEVICE == m_hDevice) ||
        (LGLCD_PRIORITY_IDLE_NO_SHOW == dwPriorityToUse) )
    {
        // don't submit the bitmap
        return TRUE;
    }

    // Render the active screen
    m_pGfx->BeginDraw();
    m_pGfx->ClearScreen();
    m_pActivePage->OnDraw(*m_pGfx);
    m_pGfx->EndDraw(); 

    // Get the active bitmap
    lgLcdBitmap* pBitmap = m_pGfx->GetLCDScreen();

    // Only submit if the bitmap needs to be updated
    // (If the priority or bitmap have changed)
    DWORD res = ERROR_SUCCESS;
    if (DoesBitmapNeedUpdate(pBitmap))
    {
        res = lgLcdUpdateBitmap(m_hDevice, &pBitmap->bmp_mono.hdr, dwPriorityToUse);
        HandleErrorFromAPI(res);
    }

    return (LGLCD_INVALID_DEVICE != m_hDevice);
}
Пример #2
0
HRESULT CLCDOutput::Draw()
{
    DWORD dwPriorityToUse = LGLCD_ASYNC_UPDATE(m_nPriority);
    
    if ( (NULL == m_pActiveScreen)              ||
         (LGLCD_INVALID_DEVICE == m_hDevice)    ||
         (LGLCD_PRIORITY_IDLE_NO_SHOW == dwPriorityToUse) )
    {
        // don't submit the bitmap
        return S_OK;
    }

    // Render the active screen
    m_pActiveScreen->Draw();
    
    // Get the active bitmap
    lgLcdBitmap160x43x1* pScreen = m_pActiveScreen->GetLCDScreen();

    // Only submit if the bitmap needs to be updated
    // (If the priority or bitmap have changed)
    DWORD res = ERROR_SUCCESS;
    if (DoesBitmapNeedUpdate(pScreen))
    {
        res = lgLcdUpdateBitmap(m_hDevice, &pScreen->hdr, dwPriorityToUse);
        HandleErrorFromAPI(res);
    }

    // read the soft buttons
    ReadButtons();

    return S_OK;
}