📄 ddipu_sdc_blt.cpp
字号:
//-----------------------------------------------------------------------------
// Copyright (C) 2004-2005, MOTOROLA, INC. All Rights Reserved
// THIS SOURCE CODE IS CONFIDENTIAL AND PROPRIETARY AND MAY NOT
// BE USED OR DISTRIBUTED WITHOUT THE WRITTEN PERMISSION OF
// MOTOROLA, INC.
//------------------------------------------------------------------------------
//
// Copyright (C) 2005-2006, Freescale Semiconductor, Inc. All Rights Reserved.
// THIS SOURCE CODE, AND ITS USE AND DISTRIBUTION, IS SUBJECT TO THE TERMS
// AND CONDITIONS OF THE APPLICABLE LICENSE AGREEMENT
//
//------------------------------------------------------------------------------
//
// File: ddipu_sdc_blt.cpp
//
// Implementation of DDIPU_SDC bitblt operation functions.
//
//------------------------------------------------------------------------------
#include "precomp.h"
#ifdef PLAT_PMC
#include <fastblt.h>
#endif
//------------------------------------------------------------------------------
// External Functions
//------------------------------------------------------------------------------
// External Variables
//------------------------------------------------------------------------------
// Defines
#undef SWAP
#define SWAP(a,b,type) { type tmp=a; a=b; b=tmp; }
//------------------------------------------------------------------------------
// Types
//------------------------------------------------------------------------------
// Global Variables
//------------------------------------------------------------------------------
// Local Variables
//------------------------------------------------------------------------------
// Local Functions
static void dumpBltParms(GPEBltParms *pBltParms);
//------------------------------------------------------------------------------
//
// Function: BltPrepare
//
// This method identifies the appropriate functions
// needed to perform individual blits.
//
// Parameters:
// pBltParms
// [in] A pointer to a DDGPEBltParms structure.
//
// Returns:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE DDIPU_SDC::BltPrepare(GPEBltParms * pBltParms)
{
EnterCriticalSection(&m_csDrawLock);
// default to base EmulatedBlt routine
pBltParms->pBlt = (SCODE (GPE::*)(GPEBltParms *))WrapEmulatedBlt;
// see if we need to deal with cursor
PointerBltPrepare(pBltParms);
return S_OK;
}
SCODE DDIPU_SDC::WrapEmulatedBlt(GPEBltParms *blitParameters)
{
SCODE ret = S_OK;
// fall back on compatible blt
if (m_iRotate && ((blitParameters->pDst == m_pPrimarySurface) || // only care if dest is main display surface
(blitParameters->pSrc == m_pPrimarySurface))) // only care if src is main display surface
{
ret = EmulatedBltRotate(blitParameters);
}
else
{
#ifdef PLAT_PMC
// try software optimized blt
ret = FastBlt(blitParameters);
if(ret != S_OK)
// Note: This will execute the next statement. Isn't that weird?
#endif
ret = EmulatedBlt(blitParameters);
}
// handle the TV mode case for updates
if(m_bTVModeActive && ((blitParameters->pDst == m_pPrimarySurface) || // only care if dest is main display surface
(blitParameters->pSrc == m_pPrimarySurface))) // only care if src is main display surface
{
// Now, calculate the dirty-rect to refresh to the actual hardware
RECT bounds;
bounds.left = blitParameters->prclDst->left;
bounds.top = blitParameters->prclDst->top;
bounds.right = blitParameters->prclDst->right;
bounds.bottom = blitParameters->prclDst->bottom;
if(bounds.left > bounds.right) {
SWAP(bounds.left,bounds.right, int)
}
if( bounds.top > bounds.bottom) {
SWAP(bounds.top,bounds.bottom, int)
}
if(bounds.left < 0)
bounds.left = 0;
if(bounds.right > (m_rcWorkRect.right - m_rcWorkRect.left))
bounds.right = (m_rcWorkRect.right - m_rcWorkRect.left);
if(bounds.top < 0)
bounds.top = 0;
if(bounds.bottom > (m_rcWorkRect.bottom - m_rcWorkRect.top))
bounds.bottom = (m_rcWorkRect.bottom - m_rcWorkRect.top);
EnterCriticalSection(&m_csDirtyRect);
DEBUGCHK(m_pDirtyRect != NULL);
if(m_pDirtyRect)
m_pDirtyRect->SetDirtyRegion((LPRECT)&bounds);
// Signal to TV update thread that we can now be udpated.
SetEvent(m_hTVUpdateRequest);
LeaveCriticalSection(&m_csDirtyRect);
UINT32 time;
time = GetTickCount();
//DEBUGMSG(1, (TEXT("%s: TV Update request sent at time %d:%d\r\n"), __WFUNCTION__, time/60, time%60));
}
return ret;
}
//------------------------------------------------------------------------------
//
// Function: BltComplete
//
// This method executes to complete
// a blit sequence initiated by GPE::BltPrepare
//
// Parameters:
// pBltParms
// [in] A pointer to a DDGPEBltParms structure.
//
// Returns:
// S_OK successful
// others failed
//
//------------------------------------------------------------------------------
SCODE DDIPU_SDC::BltComplete(GPEBltParms * pBltParms)
{
// see if cursor was forced off because of overlap with source or destination and turn back on
if (m_CursorForcedOff)
{
m_CursorForcedOff = FALSE;
CursorOn();
}
LeaveCriticalSection(&m_csDrawLock);
return S_OK;
}
static void dumpBltParms(GPEBltParms *pBltParms)
{
DEBUGMSG(1, (TEXT("%s: Surface Width: %d\r\n"), __WFUNCTION__, pBltParms->pDst->Width()));
DEBUGMSG(1, (TEXT("%s: Surface Height: %d\r\n"), __WFUNCTION__, pBltParms->pDst->Height()));
DEBUGMSG(1, (TEXT("%s: Destination Top: %d\r\n"), __WFUNCTION__, pBltParms->prclDst->top));
DEBUGMSG(1, (TEXT("%s: Destination Bottom: %d\r\n"), __WFUNCTION__, pBltParms->prclDst->bottom));
DEBUGMSG(1, (TEXT("%s: Destination Left: %d\r\n"), __WFUNCTION__, pBltParms->prclDst->left));
DEBUGMSG(1, (TEXT("%s: Destination Right: %d\r\n"), __WFUNCTION__, pBltParms->prclDst->right));
DEBUGMSG(1, (TEXT("%s: Source Top: %d\r\n"), __WFUNCTION__, pBltParms->prclSrc->top));
DEBUGMSG(1, (TEXT("%s: Source Bottom: %d\r\n"), __WFUNCTION__, pBltParms->prclSrc->bottom));
DEBUGMSG(1, (TEXT("%s: Source Left: %d\r\n"), __WFUNCTION__, pBltParms->prclSrc->left));
DEBUGMSG(1, (TEXT("%s: Source Right: %d\r\n"), __WFUNCTION__, pBltParms->prclSrc->right));
return;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -