Hi all
When I have some "hard" stuff to calculate before Draw it, I usually (thanks to the support by Tale) flip the current bitmap to a cached one; I draw there what I need, than I re-flip and I Blit the cached result.
Here's the code:
Code:
bool Meter::Draw(IGraphics *pGraphics) {
if (mCacheBitmap) {
// flag cache off
mCacheBitmap = false;
// swap to cached bitmap...
// my cached hard stuff (will draw to the cached Bitmap)
pGraphics->FillIRect(&COLOR_PLUG_BORDER, &mRECTMeter);
// back to original bitmap...
}
// draw cache...
// my not-cached hard stuff (will draw to the currentBitmap)
pGraphics->FillIRect(&COLOR_PLUG_COMPONENT, &mRECTComponent);
return true;
}
It works like a charm. Once I recall Draw and I don't need to recalculate stuff, I just Blit the cached bitmap. With FillIRect, LICE_FLine, DrawLine or DrawIText (and many more) I don't have any problem.
The problem is when I want to Draw a Bitmap; somethings like this:
Code:
// my cached hard stuff (will draw to the cached Bitmap)
pGraphics->FillIRect(&COLOR_PLUG_BORDER, &mRECTMeter);
pGraphics->DrawBitmap(&MYBITMAP_CONTROL_BUTTON, &mRECT);
When I blit, I can't see any Bitmap drawn over the cache.
Instead, if I place the drawing at the end of the Draw function (after blit), it draws the bitmap. But that's not cached so...
Where am I wrong?
Thanks to everybody!