Click here to Skip to main content
15,921,463 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: regular experssion in C++ Pin
John R. Shaw10-Dec-04 18:44
John R. Shaw10-Dec-04 18:44 
GeneralCDC::BitBlt(...) - strange speed variations Pin
moredip10-Dec-04 7:01
moredip10-Dec-04 7:01 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
G. Steudtel10-Dec-04 7:22
G. Steudtel10-Dec-04 7:22 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
moredip10-Dec-04 7:31
moredip10-Dec-04 7:31 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
G. Steudtel10-Dec-04 7:52
G. Steudtel10-Dec-04 7:52 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
moredip10-Dec-04 8:16
moredip10-Dec-04 8:16 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
G. Steudtel10-Dec-04 9:10
G. Steudtel10-Dec-04 9:10 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
moredip10-Dec-04 9:22
moredip10-Dec-04 9:22 
I follow your reasoning, and it does seem completely reasonable.

The only thing is, I don't see why BitBlt() is /allocating/ memory. As far as I was aware, BitBlt only copies blocks of memory.

I /am/ allocating larger bitmaps as the window size increases, but that's done outside of the code I'm profiling. Here's how I'm profiling the code:

<------------------SNIP---------------------->
#ifdef _DEBUG
LARGE_INTEGER time4;
VERIFY( ::QueryPerformanceCounter( &time4 ) );
#endif

m_memDC.BitBlt( 0, 0, m_iScreenWidth, clientRect.Height(), &m_decorationsMemDC, 0, 0, SRCAND );

#ifdef _DEBUG
LARGE_INTEGER time5;
VERIFY( ::QueryPerformanceCounter( &time5 ) );
#endif
...
...
...
TRACE( " m_memDC.BitBlt( 0, 0, %i, %i, &m_decorationsMemDC, 0, 0, SRCAND ) ] took %f\tmilliseconds\n"
, m_iScreenWidth, clientRect.Height(), ((time5.QuadPart - time4.QuadPart)/(double)freq.QuadPart)*1000 );

<------------------SNIP---------------------->

As you can see, the only thing I'm timing is that one call to BitBlt(...), so it's definitely something within that method that's slowing down.

One thought I had was that maybe BitBlt() is doing some behind-the-scenes allocation for some reason? Or perhaps there's some lazy-initialization going on where the CBitmaps attached to my CDCs only allocate memory when needed, in this case somewhere within BitBlt(). That doesn't really make sense though - I'm drawing into the source CDC before the guilty BitBlt() call (and presumably the memory would have to be allocated then), and I call

m_memDC.BitBlt( 0, 0, m_iScreenWidth,
clientRect.Height(), NULL, 0, 0, WHITENESS );

earlier as well, so as far as I can tell both the source and destination DCs' CBitmaps should already be allocated when that slow call BitBlt() happens.

Strange, no? Anyways, thanks once again for your help. If you have any further thoughts, obviously I'd love to hear them!

Cheers,

Pete
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
Jack Puppy10-Dec-04 11:37
Jack Puppy10-Dec-04 11:37 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
moredip10-Dec-04 11:46
moredip10-Dec-04 11:46 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
Jack Puppy11-Dec-04 13:09
Jack Puppy11-Dec-04 13:09 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
moredip13-Dec-04 4:48
moredip13-Dec-04 4:48 
GeneralRe: CDC::BitBlt(...) - strange speed variations Pin
John R. Shaw10-Dec-04 19:09
John R. Shaw10-Dec-04 19:09 
GeneralWM message Pin
Ann6610-Dec-04 6:45
sussAnn6610-Dec-04 6:45 
GeneralRe: WM message Pin
prcarp10-Dec-04 7:00
prcarp10-Dec-04 7:00 
GeneralBaisc Pointer Question Pin
Anonymous10-Dec-04 6:18
Anonymous10-Dec-04 6:18 
GeneralRe: Baisc Pointer Question Pin
Maximilien10-Dec-04 6:40
Maximilien10-Dec-04 6:40 
GeneralRe: Baisc Pointer Question Pin
Anonymous10-Dec-04 6:51
Anonymous10-Dec-04 6:51 
GeneralRe: Baisc Pointer Question Pin
John M. Drescher10-Dec-04 9:56
John M. Drescher10-Dec-04 9:56 
GeneralRe: Baisc Pointer Question Pin
moredip10-Dec-04 7:06
moredip10-Dec-04 7:06 
GeneralRe: Baisc Pointer Question Pin
Maximilien10-Dec-04 7:33
Maximilien10-Dec-04 7:33 
GeneralRe: Baisc Pointer Question Pin
Anonymous10-Dec-04 8:06
Anonymous10-Dec-04 8:06 
GeneralRe: Baisc Pointer Question Pin
moredip10-Dec-04 8:25
moredip10-Dec-04 8:25 
GeneralRe: Baisc Pointer Question Pin
Maximilien10-Dec-04 9:01
Maximilien10-Dec-04 9:01 
GeneralRe: Baisc Pointer Question Pin
poiut10-Dec-04 9:29
poiut10-Dec-04 9:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.