?? hwblt.cpp
字號:
RETAILMSG(DISP_ZONE_WARNING,(TEXT("try to redirect to SW Emulated Bitblt\r\n")));
return FALSE;
}
/// Set Scratch Surface Information
descScratch.dwBaseaddr = (m_VideoMemoryPhysicalBase + ScratchSurf->OffsetInVideoMemory());
RETAILMSG(DISP_ZONE_TEMP,(TEXT("ScratchBaseAddr : 0x%x, Offset:%d,SrcW:%d, SrcH:%d, Stride:%d, R:%d\n"), descScratch.dwBaseaddr, ScratchSurf->OffsetInVideoMemory(), dwSrcWidth, dwSrcHeight, ScratchSurf->Stride(), ScratchSurf->Rotate()));
descScratch.dwColorMode = GetHWColorFormat(pBltParms->pDst);
descScratch.dwHoriRes = dwSrcWidth;
descScratch.dwVertRes = dwSrcHeight;
/// Set Destination Surface to Scratch Surface
m_oG2D->SetDstSurface(&descScratch);
/// Set Destination Clipping window Rect
m_oG2D->SetClipWindow(&t_rect);
/// Set X-axis flip flag
EnterCriticalSection(&m_cs2D);
m_oG2D->FlipBlt( prclSrc, &t_rect, FLIP_X );
LeaveCriticalSection(&m_cs2D);
/// Set Source Address to Scratch Memory
m_oG2D->SetSrcSurface(&descScratch);
/// X-axis mirror case. up-down inversion
/// Swap left, right coordinate when 90 and 270 degree
RETAILMSG(DISP_ZONE_TEMP,(TEXT("S LRSWAP:%d,%d,%d,%d,%d,%d\n"),pBltParms->prclDst->left,pBltParms->prclDst->top,pBltParms->prclDst->right,pBltParms->prclDst->bottom, iRotate, m_oG2D->GetRotType(iRotate)));
SWAP(prclDst->left, prclDst->right, LONG);
#if (G2D_STRETCH_ALGORITHM==G2D_QUARTERED_ADJUSTING)
/// Adjust Coordinate from (x1,y1)~(x2,y2) to (0,0)~(x2-x1,y2-y1)
/// and Recalculate BaseAddress
m_oG2D->TranslateCoordinateToZero(pdescDstSurface, prclDst, pBltParms->prclClip);
#endif
/// Set Destination Surface to real Framebuffer Surface
m_oG2D->SetDstSurface(pdescDstSurface);
/// Set Destination Clipping window Rect
if(pBltParms->prclClip)
{
m_oG2D->SetClipWindow(pBltParms->prclClip);
}
else
{
m_oG2D->SetClipWindow(prclDst);
}
EnterCriticalSection(&m_cs2D);
#if (G2D_STRETCH_ALGORITHM==G2D_QUARTERED_ADJUSTING)
m_oG2D->StretchBlt_Bilinear( &t_rect, prclDst, m_oG2D->GetRotType(iRotate));
#else
m_oG2D->StretchBlt( &t_rect, prclDst, m_oG2D->GetRotType(iRotate));
#endif
LeaveCriticalSection(&m_cs2D);
/// recover top, bottom coordinate
SWAP(prclDst->left, prclDst->right, LONG);
/// Disallocate Scratch Surface
delete ScratchSurf;
RETAILMSG(DISP_ZONE_TEMP, (TEXT("Stretch X-axis flip: R:%d\r\n"),pBltParms->pDst->Rotate()));
return TRUE;
}
RotateRectl(prclDst);
/// Non flip but rotated.
}
else //< DMDO_0 and DMDO_180 does not need to modify prclDst region
{
RotateRectlBack(prclDst);
/// Check Left-Right flip, when stretching is needed.
if(prclDst->right < prclDst->left)
{
RotateRectl(prclDst);
/// Allocation Scratch Framebuffer for Flip Operation.
DDGPESurf *ScratchSurf;
AllocSurface(&ScratchSurf, dwSrcWidth, dwSrcHeight, pBltParms->pDst->Format(), EGPEFormatToEDDGPEPixelFormat[pBltParms->pDst->Format()], GPE_REQUIRE_VIDEO_MEMORY);
if(ScratchSurf == NULL)
{
RETAILMSG(DISP_ZONE_WARNING,(TEXT("Scratch Surface Allocation is failed. %d\n"), __LINE__));
#if 0//USE_PACSURF, To increase video memory is better than to use system memory as Video Surface
RETAILMSG(TRUE,(TEXT("try to allocate surface usign PA Surface\r\n")));
PACSurf *ScratchSurf;
#endif
RETAILMSG(DISP_ZONE_WARNING,(TEXT("Maybe There's no sufficient video memory. please increase video memory\r\n")));
RETAILMSG(DISP_ZONE_WARNING,(TEXT("try to redirect to SW Emulated Bitblt\r\n")));
return FALSE;
}
/// Set Scratch Surface Information
descScratch.dwBaseaddr = (m_VideoMemoryPhysicalBase + ScratchSurf->OffsetInVideoMemory());
descScratch.dwColorMode = GetHWColorFormat(pBltParms->pDst);
descScratch.dwHoriRes = dwSrcWidth;
descScratch.dwVertRes = dwSrcHeight;
/// Set Destination Surface to Scratch Surface
m_oG2D->SetDstSurface(&descScratch);
/// Set Destination Clipping window Rect
m_oG2D->SetClipWindow(&t_rect);
/// Set Y-axis flip flag
EnterCriticalSection(&m_cs2D);
m_oG2D->FlipBlt( prclSrc, &t_rect, FLIP_Y );
LeaveCriticalSection(&m_cs2D);
/// Y-axis mirror case. left-right inversion
/// Set Source Address to Scratch Memory
m_oG2D->SetSrcSurface(&descScratch);
/// Swap left, right coordinate
RETAILMSG(DISP_ZONE_TEMP,(TEXT("S 0,180 BSWAP : %d,%d,%d,%d\n"),pBltParms->prclDst->left,pBltParms->prclDst->top,pBltParms->prclDst->right,pBltParms->prclDst->bottom));
SWAP(prclDst->right, prclDst->left, LONG);
#if (G2D_STRETCH_ALGORITHM==G2D_QUARTERED_ADJUSTING)
/// Adjust Coordinate from (x1,y1)~(x2,y2) to (0,0)~(x2-x1,y2-y1)
/// and Recalculate BaseAddress
m_oG2D->TranslateCoordinateToZero(pdescDstSurface, prclDst, pBltParms->prclClip);
#endif
/// Set Destination Surface to real Framebuffer Surface
m_oG2D->SetDstSurface(pdescDstSurface);
/// Set Destination Clipping window Rect
if(pBltParms->prclClip)
{
m_oG2D->SetClipWindow(pBltParms->prclClip);
}
else
{
m_oG2D->SetClipWindow(prclDst);
}
RETAILMSG(DISP_ZONE_TEMP,(TEXT("S 0,180 ASWAP : %d,%d,%d,%d\n"),pBltParms->prclDst->left,pBltParms->prclDst->top,pBltParms->prclDst->right,pBltParms->prclDst->bottom));
EnterCriticalSection(&m_cs2D);
#if (G2D_STRETCH_ALGORITHM==G2D_QUARTERED_ADJUSTING)
m_oG2D->StretchBlt( &t_rect, prclDst, m_oG2D->GetRotType(iRotate));
#else
m_oG2D->StretchBlt( &t_rect, prclDst, m_oG2D->GetRotType(iRotate));
#endif
LeaveCriticalSection(&m_cs2D);
/// recover left, right coordinate
SWAP(prclDst->right, prclDst->left, LONG);
/// Disallocate Scratch Surface
delete ScratchSurf;
RETAILMSG(DISP_ZONE_TEMP, (TEXT("Stretch Y-axis flip: R:%d\r\n"),pBltParms->pDst->Rotate()));
return TRUE;
}
/// Check Up-Down flip, when stretching is needed.
if(prclDst->bottom < prclDst->top)
{
RotateRectl(prclDst);
/// Allocation Scratch Framebuffer for Flip Operation.
DDGPESurf *ScratchSurf;
AllocSurface(&ScratchSurf, dwSrcWidth, dwSrcHeight, pBltParms->pDst->Format(), EGPEFormatToEDDGPEPixelFormat[pBltParms->pDst->Format()], GPE_REQUIRE_VIDEO_MEMORY);
if(ScratchSurf == NULL)
{
RETAILMSG(DISP_ZONE_WARNING,(TEXT("Scratch Surface Allocation is failed. %d\n"), __LINE__));
#if 0//USE_PACSURF, To increase video memory is better than to use system memory as Video Surface
RETAILMSG(TRUE,(TEXT("try to allocate surface usign PA Surface\r\n")));
PACSurf *ScratchSurf;
#endif
RETAILMSG(DISP_ZONE_WARNING,(TEXT("Maybe There's no sufficient video memory. please increase video memory\r\n")));
RETAILMSG(DISP_ZONE_WARNING,(TEXT("try to redirect to SW Emulated Bitblt\r\n")));
return FALSE;
}
/// Set Scratch Surface Information
descScratch.dwBaseaddr = (m_VideoMemoryPhysicalBase + ScratchSurf->OffsetInVideoMemory());
descScratch.dwColorMode = GetHWColorFormat(pBltParms->pDst);
descScratch.dwHoriRes = dwSrcWidth;
descScratch.dwVertRes = dwSrcHeight;
/// Set Destination Surface to Scratch Surface
m_oG2D->SetDstSurface(&descScratch);
/// Set Destination Clipping window Rect
m_oG2D->SetClipWindow(&t_rect);
/// Set X-axis flip flag
EnterCriticalSection(&m_cs2D);
m_oG2D->FlipBlt( prclSrc, &t_rect, FLIP_X );
LeaveCriticalSection(&m_cs2D);
/// Set Source Address to Scratch Memory
m_oG2D->SetSrcSurface(&descScratch);
/// X-axis mirror case. up-down inversion
/// Swap top, bottom coordinate
SWAP(prclDst->top, prclDst->bottom, LONG);
#if (G2D_STRETCH_ALGORITHM==G2D_QUARTERED_ADJUSTING)
/// Adjust Coordinate from (x1,y1)~(x2,y2) to (0,0)~(x2-x1,y2-y1)
/// and Recalculate BaseAddress
m_oG2D->TranslateCoordinateToZero(pdescDstSurface, prclDst, pBltParms->prclClip);
#endif
/// Set Destination Surface to real Framebuffer Surface
m_oG2D->SetDstSurface(pdescDstSurface);
/// Set Destination Clipping window Rect
if(pBltParms->prclClip)
{
m_oG2D->SetClipWindow(pBltParms->prclClip);
}
else
{
m_oG2D->SetClipWindow(prclDst);
}
EnterCriticalSection(&m_cs2D);
#if (G2D_STRETCH_ALGORITHM==G2D_QUARTERED_ADJUSTING)
m_oG2D->StretchBlt_Bilinear( &t_rect, prclDst, m_oG2D->GetRotType(iRotate));
#else
m_oG2D->StretchBlt( &t_rect, prclDst, m_oG2D->GetRotType(iRotate));
#endif
LeaveCriticalSection(&m_cs2D);
/// recover top, bottom coordinate
SWAP(prclDst->top, prclDst->bottom, LONG);
/// Disallocate Scratch Surface
delete ScratchSurf;
RETAILMSG(DISP_ZONE_TEMP, (TEXT("Stretch X-axis flip: R:%d\r\n"),pBltParms->pDst->Rotate()));
return TRUE;
}
RotateRectl(prclDst);
}
/// cover 0, 90, 180, 270 but no flip
RETAILMSG(DISP_ZONE_TEMP,(TEXT("S BRNONSWAP:%d,%d,%d,%d,%d,%d\n"),pBltParms->prclDst->left,pBltParms->prclDst->top,pBltParms->prclDst->right,pBltParms->prclDst->bottom, iRotate, m_oG2D->GetRotType(iRotate)));
// if(pBltParms->pDst->Rotate() == DMDO_90 || pBltParms->pDst->Rotate() == DMDO_270)
// {
// RotateRectl(prclDst);
// RotateRectl(prclDst);
// }
RETAILMSG(DISP_ZONE_TEMP,(TEXT("S BZNONSWAP:%d,%d,%d,%d,%d,%d\n"),pBltParms->prclDst->left,pBltParms->prclDst->top,pBltParms->prclDst->right,pBltParms->prclDst->bottom, iRotate, m_oG2D->GetRotType(iRotate)));
/// This case does not need to flip.
#if (G2D_STRETCH_ALGORITHM==G2D_QUARTERED_ADJUSTING)
/// Adjust Coordinate from (x1,y1)~(x2,y2) to (0,0)~(x2-x1,y2-y1)
/// and Recalculate BaseAddress
m_oG2D->TranslateCoordinateToZero(pdescDstSurface, prclDst, pBltParms->prclClip);
#endif
RETAILMSG(DISP_ZONE_TEMP,(TEXT("S NONSWAP:%d,%d,%d,%d,%d,%d\n"),pBltParms->prclDst->left,pBltParms->prclDst->top,pBltParms->prclDst->right,pBltParms->prclDst->bottom, iRotate, m_oG2D->GetRotType(iRotate)));
/// Set Destination Surface to real Framebuffer Surface
m_oG2D->SetDstSurface(pdescDstSurface);
/// Set Destination Clipping window Rect
if(pBltParms->prclClip)
{
m_oG2D->SetClipWindow(pBltParms->prclClip);
}
else
{
m_oG2D->SetClipWindow(prclDst);
}
EnterCriticalSection(&m_cs2D);
#if (G2D_STRETCH_ALGORITHM==G2D_QUARTERED_ADJUSTING)
m_oG2D->StretchBlt_Bilinear( prclSrc, prclDst, m_oG2D->GetRotType(iRotate));
#else
m_oG2D->StretchBlt( prclSrc, prclDst, m_oG2D->GetRotType(iRotate));
#endif
LeaveCriticalSection(&m_cs2D);
RETAILMSG(DISP_ZONE_TEMP, (TEXT("\nStretch no flip: R:%d\r\n"),pBltParms->pDst->Rotate()));
}
else // Do not stretch.
{
/// Set Source Surface Descriptor
m_oG2D->SetSrcSurface(pdescSrcSurface);
/// Check whether XY flip or not,
///if XY flip is requested, just Rotation 180 degree
RotateRectlBack(prclDst);
if( ((pBltParms->bltFlags & BLT_STRETCH) == BLT_STRETCH)
&& (prclDst->right < prclDst->left) && (prclDst->bottom < prclDst->top) )
{
RotateRectl(prclDst);
switch(iRotate)
{
case DMDO_0:
iRotate = DMDO_180;
break;
case DMDO_90:
iRotate = DMDO_270;
break;
case DMDO_180:
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -