GDI versus Direct2D

A common mistake with first attempts at Direct2D is developers do not properly cache the D2D resources and instead create and destroy resources too often. If all your ellipses are similar sized, you should create and cache this ellipse object once. If you have 30 different sizes/shapes, create ellipse versions for all 30 sizes/shapes only once. This significantly speeds up Direct2D. Same goes for Rectangles and all other primitives. Scaling a cached object versus repeated creation/destruction is also a solution for some scenarios if too many variations exist for a primitive, though using a resource at its native size is ideal and memory cards have quite a bit of memory to store your resources.

Gdi ellipses look absolutely terrible and using Direct3D directly is fairly complex, especially for ellipses, large polygons, and higher level primitives. With proper use of Direct2D you should be able to get good speed and high quality rendering.


Some time ago I’ve refused migrating rendering code from GDI to Direct2D due to low performance. As I understand from google, Direct2D performance depends on driver and hardware optimizations and you shouldn’t expect the same speed on different hardware. GDI is pretty old and works equally almost everywhere.

Must say I’ve tried to use it for drawing simple geometry primitives whereas Direct2D seems to be much more robust library and maybe there could be performance boost on complex scenarios, but this is not my case.

If you need GDI performance with better quality – try to use OpenGL or Direct3D directly.

This is a related question: Is TDirect2DCanvas slow or am I doing something wrong?