bnichols
07-29-2002, 11:16 AM
Hello, I'm new to Brew, so I hope I don't make too much of an idiot of myself.
I'm just playing around with the IImage display and what I thought is a very simple piece of code, turns out to leak memory faster than Ronald Reagan. The code just puts a bitmap on the screen and then updates the screen with any keypress. It does nothing else. Please let me know what I'm doing wrong.
Thanks,
Ben
Code:
static boolean ResApp_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEERect rc;
AECHAR szBuf[30] = {0};
CResApp * pMe = (CResApp*)pi;
switch (eCode)
{
case EVT_APP_START: // Applet start event
case EVT_APP_RESUME:
IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Erase whole screen
IIMAGE_SetDrawSize(pMe->m_pIImage, CROWDWIDTH, CROWDHEIGHT);
IIMAGE_Draw(pMe->m_pIImage, pMe->m_nX, pMe->m_nY);
IDISPLAY_Update(pMe->a.m_pIDisplay);
return TRUE;
case EVT_KEY_PRESS: // process key-down event
IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Erase whole screen
IIMAGE_SetDrawSize(pMe->m_pIImage, CROWDWIDTH, CROWDHEIGHT);
IIMAGE_Draw(pMe->m_pIImage, pMe->m_nX, pMe->m_nY);
IDISPLAY_Update(pMe->a.m_pIDisplay);
return TRUE;
case EVT_APP_STOP:
return TRUE;
case EVT_APP_SUSPEND:
return TRUE;
default:
break;
}
return FALSE;
}
I'm just playing around with the IImage display and what I thought is a very simple piece of code, turns out to leak memory faster than Ronald Reagan. The code just puts a bitmap on the screen and then updates the screen with any keypress. It does nothing else. Please let me know what I'm doing wrong.
Thanks,
Ben
Code:
static boolean ResApp_HandleEvent(IApplet * pi, AEEEvent eCode, uint16 wParam, uint32 dwParam)
{
AEERect rc;
AECHAR szBuf[30] = {0};
CResApp * pMe = (CResApp*)pi;
switch (eCode)
{
case EVT_APP_START: // Applet start event
case EVT_APP_RESUME:
IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Erase whole screen
IIMAGE_SetDrawSize(pMe->m_pIImage, CROWDWIDTH, CROWDHEIGHT);
IIMAGE_Draw(pMe->m_pIImage, pMe->m_nX, pMe->m_nY);
IDISPLAY_Update(pMe->a.m_pIDisplay);
return TRUE;
case EVT_KEY_PRESS: // process key-down event
IDISPLAY_ClearScreen (pMe->a.m_pIDisplay); // Erase whole screen
IIMAGE_SetDrawSize(pMe->m_pIImage, CROWDWIDTH, CROWDHEIGHT);
IIMAGE_Draw(pMe->m_pIImage, pMe->m_nX, pMe->m_nY);
IDISPLAY_Update(pMe->a.m_pIDisplay);
return TRUE;
case EVT_APP_STOP:
return TRUE;
case EVT_APP_SUSPEND:
return TRUE;
default:
break;
}
return FALSE;
}