TouchGFX cache use with Bitmap::dynamicBitmapCreateExternal()
I've been able to successfully use Bitmap::dynamicBitmapCreateExternal() when just loading a bitmap in the frontendappliation and setting up the cache there...
FrontendApplication::FrontendApplication(Model& m, FrontendHeap& heap)
: FrontendApplicationBase(m, heap)
{
/*
* Initialize dynamic bitmap cache;
* bookkeeping memory for external bitmaps not stored in cache
*/
uint16_t* const cacheStartAddr = (uint16_t*)myBmpCache;
const uint32_t cacheSize = sizeof(myBmpCache);
Bitmap::setCache(cacheStartAddr, cacheSize, 1);
void* srcPtr = logoGetImagePtr();
BitmapId bmpId = Bitmap::dynamicBitmapCreateExternal(LCD_X_Size, LCD_Y_Size, srcPtr,
Bitmap::RGB888, 0);
oprSetLogoBmpId(bmpId);
}I also must be able to load in a different bitmap image is selected by the user and have been able to do this successfully as well by clearing the cache...
if (logoImportCustomLogo(&fileLoad.filename[value][0]) == Result_success) {
uint8_t* ptr = logoGetImagePtr();
/*
* Initialize dynamic bitmap cache;
* bookkeeping memory for external bitmaps not stored in cache
*/
Bitmap::clearCache();
bmpId = Bitmap::dynamicBitmapCreateExternal(LCD_X_Size, LCD_Y_Size, ptr,
Bitmap::RGB888, 0);
oprSetLogoBmpId(bmpId);
prmSetVal(Prm_logo, PrmE_logo_customLogo);
}However, I will need to be able hand 2 different dynamic images in cache, and when I try to use the cacheRemoveBitmap() the dynamicBitmapCreateExternal() return and invalid bitmapID. The cacheRemoveBitmap() return true so it seems to execute correctly but the cache doesn't seem to be free for the new bitmap.
if (logoImportCustomLogo(&fileLoad.filename[value][0]) == Result_success) {
uint8_t* ptr = logoGetImagePtr();
/*
* Initialize dynamic bitmap cache;
* bookkeeping memory for external bitmaps not stored in cache
*/
bmpId = oprGetLogoBmpId();
if (Bitmap::cacheRemoveBitmap(bmpId)) {
bmpId = Bitmap::dynamicBitmapCreateExternal(LCD_X_Size, LCD_Y_Size, ptr,
Bitmap::RGB888, 0);
oprSetLogoBmpId(bmpId);
prmSetVal(Prm_logo, PrmE_logo_customLogo);
}
}Any suggestions? Something simple I'm missing?
