COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :

Go Back   Cockos Incorporated Forums > Other Software Discussion > WDL users forum

Reply
 
Thread Tools Display Modes
Old 12-21-2016, 08:36 AM   #1
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 234
Default How to draw a IBitmap over a cached LICE_SysBitmap?

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!

Last edited by Nowhk; 12-22-2016 at 01:44 AM.
Nowhk is offline   Reply With Quote
Old 12-22-2016, 12:40 AM   #2
ynohtna
Human being with feelings
 
Join Date: Jan 2014
Location: Brighton, UK
Posts: 21
Default

Are you notifying the control that it's dirty and so must be redrawn?
ynohtna is offline   Reply With Quote
Old 12-22-2016, 01:03 AM   #3
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 234
Default

Quote:
Originally Posted by ynohtna View Post
Are you notifying the control that it's dirty and so must be redrawn?
Of course. Draw() it's called at every SetDirty(). In fact it cache the elements correctly when I prior set mCacheBitmap to true. The rest of the code outside that block (i.e. the end of the Draw function) redraw correctly. And also the cache works fine. Except when I try to Draw over it a Bitmap (instead of, as I said, a FillIRect or a DrawLine)...
Nowhk is offline   Reply With Quote
Old 12-22-2016, 01:41 AM   #4
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 234
Default

Fixed! I was drawing on a wrong IRECT: mRECT instead of mRECTMeter. Thanks anyway for the helps

Last edited by Nowhk; 12-22-2016 at 02:47 AM.
Nowhk is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 02:21 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.