aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Schodet2011-01-25 20:25:16 +0100
committerNicolas Schodet2011-01-25 20:25:16 +0100
commit100953400e65342243d6838c4bac25de310d1eae (patch)
tree02e19a54b8cc125219c34b83ca155e1687c26703
parent8aa1d4b314f219f8d5b30eced790efae0f79b77d (diff)
move RIC drawing code out of syscall wrapper
-rw-r--r--AT91SAM7S256/Source/c_cmd_drawing.inc46
1 files changed, 34 insertions, 12 deletions
diff --git a/AT91SAM7S256/Source/c_cmd_drawing.inc b/AT91SAM7S256/Source/c_cmd_drawing.inc
index 0132d44..f298805 100644
--- a/AT91SAM7S256/Source/c_cmd_drawing.inc
+++ b/AT91SAM7S256/Source/c_cmd_drawing.inc
@@ -184,6 +184,8 @@ SLONG * gpPassedImgVars;
SWORD gPassedVarsCount;
// Private Prototypes
+NXT_STATUS cCmdDrawPicture(SLONG x, SLONG y, UBYTE *pFileName, SLONG *pVars,
+ ULONG DrawOptions);
void cCmdDrawLine(SLONG x1, SLONG y1, SLONG x2, SLONG y2);
void cCmdDrawRect(SLONG left, SLONG bottom, SLONG width, SLONG hieght);
void cCmdCopyBitMapBits(SLONG dst_x, SLONG dst_y,
@@ -438,6 +440,31 @@ SLONG cCmdResolveValue(SWORD Value)
NXT_STATUS cCmdWrapDrawPicture(UBYTE * ArgV[])
{
SBYTE * pReturnVal = (SBYTE*)(ArgV[0]);
+ NXT_STATUS DStatus;
+ IMG_PT Pt;
+
+ Pt = *(IMG_PT*)ArgV[1];
+ //Resolve array argument
+ ArgV[2] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[2]));
+ ArgV[3] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[3]));
+
+ //Draw
+ DStatus = cCmdDrawPicture(Pt.X, Pt.Y, ArgV[2], (SLONG*)ArgV[3], *(ULONG*)ArgV[4]);
+
+ //Done
+ *pReturnVal = DStatus;
+ return (NO_ERR);
+}
+
+//-----------------------------------------------------------------
+// cCmdDrawPicture - draw a picture from a RIC file.
+NXT_STATUS cCmdDrawPicture(
+ SLONG x,
+ SLONG y,
+ UBYTE *pFileName,
+ SLONG *pVars,
+ ULONG DrawOptions)
+{
LOADER_STATUS LStatus;
NXT_STATUS DStatus = NO_ERR;
ULONG DataSize;
@@ -446,29 +473,25 @@ NXT_STATUS cCmdWrapDrawPicture(UBYTE * ArgV[])
UBYTE ImageHandle;
IMG_OP_UNION * pImage;
- //Resolve array argument
- ArgV[2] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[2]));
- ArgV[3] = (UBYTE*)cCmdDVPtr(*(DV_INDEX *)(ArgV[3]));
-
- cCmdClearScreenIfNeeded(*(ULONG*)ArgV[4]);
+ cCmdClearScreenIfNeeded(DrawOptions);
//Open the file in memory map mode. return if failure.
- LStatus = pMapLoader->pFunc(OPENREADLINEAR, ArgV[2], (UBYTE*)(&pImage), &DataSize);
+ LStatus = pMapLoader->pFunc(OPENREADLINEAR, pFileName, (UBYTE*)(&pImage), &DataSize);
ImageHandle = LOADER_HANDLE(LStatus);
//If error opening file, give up and write loader status back to user.
if (LOADER_ERR(LStatus) != SUCCESS || pImage == NULL)
{
- *pReturnVal = (SBYTE)(LOADER_ERR_BYTE(LStatus));
- return (NO_ERR);
+ return (SBYTE)(LOADER_ERR_BYTE(LStatus));
}
//Else, start interpretting the file
else
{
+ Pt.X = x;
+ Pt.Y = y;
// Read the ArgV params, Clear the data table.
- Pt = *(IMG_PT*)ArgV[1];
//!!! Unsafe assumption that array is non-empty. Should check and avoid using pointer if empty.
- gpPassedImgVars = (SLONG*)ArgV[3];
+ gpPassedImgVars = pVars;
memset(gpImgData,0,sizeof(gpImgData));
// Run through the op codes.
@@ -599,9 +622,8 @@ NXT_STATUS cCmdWrapDrawPicture(UBYTE * ArgV[])
}
// Set return value, close file and return
- *pReturnVal = DStatus;
pMapLoader->pFunc(CLOSE, &ImageHandle, NULL, NULL);
- return (NO_ERR);
+ return DStatus;
}
//-----------------------------------------------------------------