Friday, July 22, 2005

line width

creating a 1-pixel wide CPen and selecting it takes 85 micros (avg)
best case is around 8 micros, worst case is 850 to nearly 1000 (!)

m_Pen.DeleteObject();
m_Pen.CreatePen(PS_SOLID, 1, rp.Color);
SelectObject(dc, m_Pen);

setting DC pen color and selecting DC pen takes 2 micros (avg)
best case is 1 micro, worst case is 5

CPen way is anywhere from 2 to 1000 times slower
it's worth it to branch if you plan on doing a lot of 1-pixel wide lines

No comments: