Re: GDI can be fast!



På Thu, 30 Mar 2006 06:09:45 +0200, skrev Donkey <contact_nospam_donkey@xxxxxxxxxxx>:

The GDI, depending on which version you are using, makes pretty fair use of hardware acceleration so yes, if you choose your functions carefully it can be relatively quick, though not ever "fast" in my opinion. The BitBlt function can be fast as it is essentially a built in compiler that compiles based on the ROP code.

I am drawing to a simple memorybuffer now, and then
use the SetDIBitsToDevice. It all quite new to me, and many sutle
problems to solve. But it performs _way_ over what I had expected.

The most interessting thing with it, is that you can do a whole range of stuff that
you cannot do with normal GDI (I have never tried the GDI plus thing). And some of the operations are easy to implement as well. Like doing transparent blts. That was way easy.

Like this :

L0:
lodsd
cmp eax TransparentColor | je L1>
stosd
dec ecx
jnz L0<
L1:
add edi 4
dec ecx
jnz L0<

To bad one really needs to clip, as the code without clipping is very simple.

Ofcourse using 32 bit images and DWORD transfers or MMX will be faster than just about any GDI call, I have routines that have tested 10x faster than the GDI (ie GrayScaling) using this method (without MMX). The problem is displaying the updated image on a DC that is not 32 bit as the conversion is slow.

Hmm. Ok. On my card, the timings for 16 bit and 32 bit is identical.

Donkey

.