?? ude506.c
字號:
UGL_EPSON_DDB * pDdb;
/* First time through, pMode will be NULL */
if ( pDriver->pMode == UGL_NULL )
allocate = UGL_TRUE;
else
allocate = UGL_FALSE;
/* check if there is a rotation */
if (
(pEpsonModeTable->Flags) & mfR90 ||
(pEpsonModeTable->Flags) & mfR270
)
pDevModes->width = pEpsonModeTable->StridePixels;/* Virtual window width */
else
pDevModes->width = pEpsonModeTable->Width;
pDevModes->height = pEpsonModeTable->Height;
pDevModes->colorDepth = pEpsonModeTable->Bpp;
pDevModes->refreshRate = pEpsonModeTable->Frequency;
if ( ( pEpsonModeTable->Flags ) & mfLCD )
pDevModes->monitorType = UGL_MODE_FLAT_PANEL;
else
pDevModes->monitorType = UGL_MODE_CRT; /* for all other modes */
pDevModes->flags = UGL_MODE_DIRECT_COLOR;
index = uglGenericModeFind( modes, pMode, NELEMENTS(modes) );
if ( index > -1 )
pDriver->pMode = &modes[0];
else
return( UGL_STATUS_ERROR );
/* map frame buffer address */
pGenDriver->fbAddress = (UGL_UINT8 *) ( pciBaseAddress + FRAME_BUFFER_OFFSET );
/* initialize registers */
uglEpsonSetRegs();
/* Create pageZero (mandatory) */
if ( allocate == UGL_TRUE )
{
pDriver->pPageZero = (UGL_PAGE *) UGL_CALLOC(1, sizeof(UGL_PAGE));
pDdb = (UGL_EPSON_DDB *) UGL_CALLOC(1, sizeof(UGL_EPSON_DDB));
pDriver->pPageZero->pDdb = (UGL_DDB *) pDdb;
}
pDriver->pPageZero->pDdb->height = pDevModes->height;
pDriver->pPageZero->pDdb->width = pDevModes->width;
pDriver->pPageZero->pDdb->type = UGL_DDB_TYPE;
pGenDriver->pVisiblePage = pDriver->pPageZero;
pGenDriver->pDrawPage = pDriver->pPageZero;
((UGL_GEN_DDB *)pDriver->pPageZero->pDdb)->stride = pDevModes->width;
((UGL_GEN_DDB *)pDriver->pPageZero->pDdb)->colorDepth = pDevModes->colorDepth;
((UGL_EPSON_DDB *)pDriver->pPageZero->pDdb)->vram = UGL_TRUE;
((UGL_GEN_DDB *)pDriver->pPageZero->pDdb)->image = pGenDriver->fbAddress;
/* Make sure the graphics processor is ready to go*/
uglEpsonGpWait(pGenDriver);
return(UGL_STATUS_OK);
}
/*
* uglEpson16BitModeAvailGet - Get the available graphics modes from driver.
*/
UGL_STATUS uglEpson16BitModeAvailGet
(
UGL_UGI_DRIVER * pDriver,
UGL_UINT32 * pNumModes,
const UGL_MODE ** pModeArray
)
{
*pModeArray = pDevModes;
*pNumModes = NELEMENTS( modes );
return( UGL_STATUS_OK );
}
UGL_STATUS uglEpsonCursorShow
(
UGL_DEVICE_ID devId
)
{
UGL_GENERIC_DRIVER * pDriver = (UGL_GENERIC_DRIVER *)devId;
UGL_GEN_CURSOR_DATA * pCursorData = (UGL_GEN_CURSOR_DATA *)pDriver->pCursorData;
UGL_GEN_CDDB * pCursorImage;
UGL_DDB *pVisPage = pDriver->pVisiblePage->pDdb;
UGL_RECT cursorRect, displayRect, sourceRect, destRect;
if (pCursorData == UGL_NULL)
return (UGL_STATUS_ERROR);
if (!pCursorData->on || !pCursorData->hidden || devId->batchCount > 0)
return (UGL_STATUS_OK);
pCursorImage = pCursorData->imageBitmap;
cursorRect.left = pCursorData->position.x - pCursorImage->hotSpot.x;
cursorRect.top = pCursorData->position.y - pCursorImage->hotSpot.y;
cursorRect.right = cursorRect.left + pCursorImage->tddb.header.width - 1;
cursorRect.bottom = cursorRect.top + pCursorImage->tddb.header.height - 1;
displayRect.left = displayRect.top = 0;
displayRect.right = devId->pMode->width - 1;
displayRect.bottom = devId->pMode->height - 1;
UGL_RECT_INTERSECT(cursorRect, displayRect, destRect);
if (UGL_RECT_WIDTH(destRect) <= 0 || UGL_RECT_HEIGHT(destRect) <= 0)
return (UGL_STATUS_OK);
UGL_RECT_MOVE_TO(sourceRect, destRect.left - cursorRect.left,
destRect.top - cursorRect.top);
UGL_RECT_SIZE_TO(sourceRect, UGL_RECT_WIDTH(destRect),
UGL_RECT_HEIGHT(destRect));
UGL_GC_SET (devId, pCursorData->gc);
uglGeneric16BitBitmapBlt (devId, pVisPage, &destRect,
pCursorData->screenBitmap, (UGL_POINT *)&sourceRect);
uglGeneric16BitTransBitmapBlt (devId, (UGL_TDDB *)pCursorData->imageBitmap,
&sourceRect, pVisPage, (UGL_POINT *)&destRect);
pCursorData->hidden = UGL_FALSE;
return (UGL_STATUS_OK);
}
UGL_STATUS uglEpsonCursorHide
(
UGL_DEVICE_ID devId,
UGL_RECT * pHideRect
)
{
UGL_GENERIC_DRIVER * pDriver = (UGL_GENERIC_DRIVER *)devId;
UGL_GEN_CURSOR_DATA * pCursorData = (UGL_GEN_CURSOR_DATA *)pDriver->pCursorData;
UGL_GEN_CDDB * pCursorImage;
UGL_DDB *pVisPage = pDriver->pVisiblePage->pDdb;
UGL_RECT cursorRect, displayRect, sourceRect, destRect;
if (pCursorData == UGL_NULL)
return (UGL_STATUS_ERROR);
if (pCursorData->hidden || !pCursorData->on)
return (UGL_STATUS_OK);
pCursorImage = pCursorData->imageBitmap;
cursorRect.left = pCursorData->position.x - pCursorImage->hotSpot.x;
cursorRect.top = pCursorData->position.y - pCursorImage->hotSpot.y;
cursorRect.right = cursorRect.left + pCursorImage->tddb.header.width - 1;
cursorRect.bottom = cursorRect.top + pCursorImage->tddb.header.height - 1;
if (pHideRect != UGL_NULL)
{
UGL_RECT_INTERSECT(cursorRect, *pHideRect, destRect);
if (UGL_RECT_WIDTH (destRect) <= 0 || UGL_RECT_HEIGHT (destRect) <= 0)
return (UGL_STATUS_OK);
}
displayRect.left = displayRect.top = 0;
displayRect.right = devId->pMode->width - 1;
displayRect.bottom = devId->pMode->height - 1;
UGL_RECT_INTERSECT(cursorRect, displayRect, destRect);
if (UGL_RECT_WIDTH(destRect) <= 0 || UGL_RECT_HEIGHT(destRect) <= 0)
return (UGL_STATUS_OK);
UGL_RECT_MOVE_TO(sourceRect, destRect.left - cursorRect.left,
destRect.top - cursorRect.top);
UGL_RECT_SIZE_TO(sourceRect, UGL_RECT_WIDTH(destRect),
UGL_RECT_HEIGHT(destRect));
UGL_GC_SET (devId, pCursorData->gc);
uglGeneric16BitBitmapBlt (devId, pCursorData->screenBitmap, &sourceRect,
pVisPage, (UGL_POINT *)&destRect);
pCursorData->hidden = UGL_TRUE;
return (UGL_STATUS_OK);
}
UGL_STATUS uglEpsonCursorMove
(
UGL_DEVICE_ID devId,
UGL_POINT * pCursorPos
)
{
UGL_GENERIC_DRIVER * pDriver = (UGL_GENERIC_DRIVER *)devId;
UGL_GEN_CURSOR_DATA * pCursorData = (UGL_GEN_CURSOR_DATA *)pDriver->pCursorData;
UGL_DDB_ID tempBitmap;
UGL_RECT sourceRect;
UGL_POINT destPoint;
UGL_DDB *pVisPage = pDriver->pVisiblePage->pDdb;
if (pCursorData == UGL_NULL)
return (UGL_STATUS_ERROR);
if (pCursorData->on && !pCursorData->hidden)
{
UGL_GEN_CDDB * pCursorImage = pCursorData->imageBitmap;
UGL_RECT oldRect, newRect, intersectRect;
/* Compute the old cursor location */
oldRect.left = pCursorData->position.x - pCursorImage->hotSpot.x;
oldRect.top = pCursorData->position.y - pCursorImage->hotSpot.y;
oldRect.right = oldRect.left + pCursorImage->tddb.header.width - 1;
oldRect.bottom = oldRect.top + pCursorImage->tddb.header.height - 1;
/* Compute the new cursor location */
newRect = oldRect;
UGL_RECT_MOVE_TO (newRect, pCursorPos->x - pCursorImage->hotSpot.x,
pCursorPos->y - pCursorImage->hotSpot.y);
UGL_GC_SET (devId, pCursorData->gc);
/* Move the cursor */
UGL_RECT_INTERSECT(oldRect, newRect, intersectRect);
if (UGL_RECT_WIDTH(intersectRect) > 0 &&
UGL_RECT_HEIGHT(intersectRect) > 0)
{
/* Copy the display contents at the new cursor location */
sourceRect = newRect;
destPoint.x = destPoint.y = 0;
//(*devId->bitmapBlt) (devId, pVisPage,
// &sourceRect, pCursorData->scratchBitmap,
//&destPoint);
uglGeneric16BitBitmapBlt (devId, pVisPage,
&sourceRect, pCursorData->scratchBitmap,
&destPoint);
/*
* Update dirty portion (the portion that contains a cursor image)
* of 'scratchBitmap' from 'screenBitmap'
*/
sourceRect.left = intersectRect.left - oldRect.left;
sourceRect.top = intersectRect.top - oldRect.top;
sourceRect.right = intersectRect.right - oldRect.left;
sourceRect.bottom = intersectRect.bottom - oldRect.top;
destPoint.x = intersectRect.left - newRect.left;
destPoint.y = intersectRect.top - newRect.top;
uglGeneric16BitBitmapBlt (devId, pCursorData->screenBitmap,
&sourceRect, pCursorData->scratchBitmap,
&destPoint);
/* Blt cursor image to 'screenBitmap' */
sourceRect.left = sourceRect.top = 0;
sourceRect.right = UGL_RECT_WIDTH (oldRect) - 1;
sourceRect.bottom = UGL_RECT_HEIGHT(oldRect) - 1;
destPoint.x = newRect.left - oldRect.left;
destPoint.y = newRect.top - oldRect.top;
uglGeneric16BitTransBitmapBlt (devId,
(UGL_TDDB *)pCursorData->imageBitmap,
&sourceRect,
(UGL_DDB *)pCursorData->screenBitmap,
&destPoint);
/* Blt cursor to new position on the display */
sourceRect.left = sourceRect.top = 0;
sourceRect.right = UGL_RECT_WIDTH (newRect) - 1;
sourceRect.bottom = UGL_RECT_HEIGHT (newRect) - 1;
destPoint.x = newRect.left;
destPoint.y = newRect.top;
uglGeneric16BitTransBitmapBlt (devId,
(UGL_TDDB *)pCursorData->imageBitmap,
&sourceRect, pVisPage, &destPoint);
/* Erase cursor from old position on display */
sourceRect.left = sourceRect.top = 0;
sourceRect.right = UGL_RECT_WIDTH (oldRect) - 1;
sourceRect.bottom = UGL_RECT_HEIGHT(oldRect) - 1;
destPoint.x = oldRect.left;
destPoint.y = oldRect.top;
//(*devId->bitmapBlt) (devId, pCursorData->screenBitmap,
//&sourceRect, pVisPage,
//&destPoint);
uglGeneric16BitBitmapBlt (devId, pCursorData->screenBitmap,
&sourceRect, pVisPage,
&destPoint);
/* Swap 'screenBitmap' and 'scratchBitmap' */
tempBitmap = pCursorData->screenBitmap;
pCursorData->screenBitmap = pCursorData->scratchBitmap;
pCursorData->scratchBitmap = tempBitmap;
}
/* No cursor bitmap overlap between old and new locations */
else
{
/* Copy contents at new cursor location on the screen to
the scratch bitmap */
sourceRect = newRect;
destPoint.x = destPoint.y = 0;
uglGeneric16BitBitmapBlt (devId, pVisPage,
&sourceRect, pCursorData->scratchBitmap,
&destPoint);
/* Blit cursor image to new location on screen */
sourceRect.left = sourceRect.top = 0;
sourceRect.right = pCursorData->imageBitmap->tddb.header.width - 1;
sourceRect.bottom = pCursorData->imageBitmap->tddb.header.height - 1;
destPoint.x = newRect.left;
destPoint.y = newRect.top;
uglGeneric16BitTransBitmapBlt (devId,
(UGL_TDDB *)pCursorData->imageBitmap,
&sourceRect,
pVisPage,
&destPoint);
/* Copy contents of screen bitmap to old location on screen to
restore old location on the screen */
sourceRect.left = sourceRect.top = 0;
sourceRect.right = pCursorData->imageBitmap->tddb.header.width - 1;
sourceRect.bottom = pCursorData->imageBitmap->tddb.header.height - 1;
destPoint.x = oldRect.left;
destPoint.y = oldRect.top;
uglGeneric16BitBitmapBlt (devId, pCursorData->screenBitmap,
&sourceRect, pVisPage,
&destPoint);
/* Copy scratchbitmap to screenbitmap */
tempBitmap = pCursorData->screenBitmap;
pCursorData->screenBitmap = pCursorData->scratchBitmap;
pCursorData->scratchBitmap = tempBitmap;
}
}
/* Update curor location */
pCursorData->position = *pCursorPos;
return (UGL_STATUS_OK);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -