your code is very simple minded, and it is bad.
Quote:
i use Timer which redraws the digits every 100 milliseconds.
A simple test can divide by 10 the workload of redraw:
if (LastTime != NewTime) {
redrawClock();
LastTime = NewTime;
}
Rather than rebuilding the 2 same polygons every times
int trLen = min(rect.right, rect.bottom) *0.5; bool bHorizontal = rect.right > rect.bottom;
POINT pointsVert[] = { trLen, 0, trLen *2, trLen, trLen *2, rect.bottom -trLen,
trLen, rect.bottom, 0, rect.bottom -trLen, 0, trLen};
POINT pointsHorz[] = { trLen, 0, rect.right -trLen, 0, rect.right, trLen,
rect.right -trLen, rect.bottom, trLen, rect.bottom, 0, trLen };
POINT *ptArray = bHorizontal ? pointsHorz : pointsVert;
wgeb you know that only 1 will be useful
int trLen = min(rect.right, rect.bottom) *0.5; if (rect.right > rect.bottom) { POINT pointsHorz[] = { trLen, 0, rect.right -trLen, 0, rect.right, trLen, rect.right -trLen, rect.bottom, trLen, rect.bottom, 0, trLen };
POINT *ptArray = pointsHorz;
}
else {
POINT pointsVert[] = { trLen, 0, trLen *2, trLen, trLen *2, rect.bottom -trLen, trLen, rect.bottom, 0, rect.bottom -trLen, 0, trLen};
POINT *ptArray = pointsVert;
}
This rebuild only the useful polygon.
You can also the 2 polygons once for all and keep then in persistent variables between calls.