COCKOS
CONFEDERATED FORUMS
Cockos : REAPER : NINJAM : Forums
Forum Home : Register : FAQ : Members List : Search :
Old 06-14-2016, 03:33 AM   #1
Nowhk
Human being with feelings
 
Join Date: Mar 2016
Posts: 234
Default How do you cache Bitmap?

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?

Last edited by Nowhk; 06-14-2016 at 03:42 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 06:45 AM.


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