Click here to Skip to main content
15,867,488 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, I'm writing some code that draws shapes to a memory DC and then BLTs to the screen.

I originally used CreatDIBSection and used Bresenham Circle algorithm to draw/create the pixels. When I get up near 10,000 circles it's really really slow.

To the contrary when I use the CDC or HDC Ellipse command it draws them 1/10 of the speed compared to using Bresenham to a DIB.

What is going on under the hood with the Microsoft Ellipse? How can it be that much faster than drawing to a DIB with Bresenham? Is Bresenham not really that fast?
Or is Microsoft using some fancy algorithm to optimize all this?

Is there a proven method used in drawing shapes that uses some kind of optimization such as drawing a single circle and then scaling/translating/copying it with a matrices? to speed it up? sort of like an "instance" ??

any thoughts ? thanks
Posted
Updated 13-Jul-15 7:38am
v2
Comments
Sergey Alexandrovich Kryukov 13-Jul-15 13:51pm    
Of course it can be slow if you write one pixel at a time... :-)
—SA
shiftwik 13-Jul-15 14:04pm    
so CDC is using multiple threads to create a circle? what are they doing?
Sergey Alexandrovich Kryukov 13-Jul-15 14:15pm    
I don't think it uses multiple threads. And you cannot improve performance using threads, unless you have as many or more CPU cores then threads. It just uses efficient algorithm and direct video memory access. I cannot see your code to tell you where you have some performance leak. And I did not draw a circle at pixel level myself, but I think it's possible.
—SA
shiftwik 13-Jul-15 14:16pm    
so what do you use to draw circles? I'm curious how to optimize the DIBSection method and Bresenham
Sergey Alexandrovich Kryukov 13-Jul-15 14:20pm    
Sorry, I only used high-level method. And I don't like C++ at all, use it very rarely. And never MFC, it's a damn old thing, obsolete.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900