tags:

views:

34

answers:

2

I'm writing a control where there's a lot of custom drawing going through. Because of this I need to trim down the amount of "screen writes" that go about. Currently there is only one memory DC that is used to write to screen so as to avoid flicker when the control is redrawn. I want to know if it is a possiblity to use 2 or more memory DCs to write updates independently and then bitblt them to screen. This way the need to render non-changed parts of the screen is minimized.

thanx in advacne, the_Saint

A: 

You could use a number of separate DCs, but all writing to the same bitmap. In that case, you'd get a "last write wins" policy -- i.e., the last write to any given spot in the bitmap would be the one that would show up in the final picture.

This wouldn't gain you much (if anything) in the way of reduced drawing to the screen though. OTOH, a BitBlt is usually fast enough that it's unlikely to make much difference.

Jerry Coffin
A: 

You can make as many DC's as you want, preparing part of the screen in one, BitBlt()'ing its contents to another DC, which then gets BitBlt()'ed to the screen or whatever, as complex as you want (within the Windows limits of nr of handles etc. obviously).

I agree with the above comment though that it's unlikely to give you any speed gains. Where I use it sometimes is when areas are complex re: areas to be updated, doing that in parts can save a lot of location calculations sometimes.

Roel