Hi all,
I've extended an IControl that makes a lots of operations prior to elaborate elements that will be to draw later:
Code:
bool Draw(IGraphics *pGraphics) {
}
such as iterate lots of index and do pGraphics->DrawLine or FillIRect, some DrawIText, or drawing a Wave form. Since I refresh this method quite often (at fps) and only some of these elements change during the refresh, I'll keep an underlying layer cached, so it doesn't need to be eleborated/redrawn again. The idea is:
Code:
bool Draw(IGraphics *pGraphics) {
if (mFlagCacheBitmap) {
// my draw operations
// cache bitmap
// change flag
mFlagCacheBitmap= false;
}
pGraphics->DrawBitmap(&mCachedBitmap, &mRECTBitmap)
return true;
}
so when I externally switch the mFlagCacheBitmap flag, it creates a new Bitmap and later I just draw it without any processing for the "static" element.
How would you "create" Bitmap from the current (drawn) elements at the "// cache bitmap" point?