Question
caching bitmap
Hi,
I have a project that has multiple screens. On the first screen, there is a zoom animation. Every 10 tick, it's getting larger. How ever, it looks like that it stucks towards the end of animation. So, I decided to use caching.
void TouchGFXHAL::initialize()
{
TouchGFXGeneratedHAL::initialize();
uint16_t* const cacheStartAddr = (uint16_t*)0x30025800;
const uint32_t cacheSize = 0x20000;
touchgfx::Bitmap::removeCache();
touchgfx::Bitmap::setCache(cacheStartAddr, cacheSize);
}void IgnitionOnDemoScreenView::setupScreen()
{
IgnitionOnDemoScreenViewBase::setupScreen();
Bitmap::cache(BITMAP_LOGO_ORIG_60X60_ID);
LogoImage.setBitmap(BITMAP_LOGO_ORIG_60X60_ID);
LogoImage.setXY(90,130);
LogoImage.setScalingAlgorithm(touchgfx::ScalableImage::BILINEAR_INTERPOLATION);
add(LogoImage);
}
void IgnitionOnDemoScreenView::tearDownScreen()
{
IgnitionOnDemoScreenViewBase::tearDownScreen();
Bitmap::clearCache();
}
bool IgnitionOnDemoScreenView::IgnitionOnDemoScr_Animate() {
static uint8_t Tick = 0;
Tick++;
if (Tick % 10 == 0) {
if (LogoImage.getWidth() < 225 && LogoImage.getHeight() < 225) {
LogoImage.setPosition(LogoImage.getX() - 5, LogoImage.getY() - 5, LogoImage.getWidth() + 10, LogoImage.getHeight() + 10);
LogoImage.invalidate();
}
else {
return true;
}
}
return false;
}But now, the quality of image is bad and it makes the other processes get stuck.
