Very slow drawing operation, Im trying to draw points on a grid
Sep 13 2008, 05:01 PM
Joined: 13-August 08
Member No.: 1176
Hi guys - im trying to draw points and lines on my control which is being used like a canvas grid. But the drawing operation is taking very long and it has totally slowed down the application. Here is how im drawing the points on the canvas - this was the slowest one.
Rect view = context->getViewableBounds();
int width = view.getRight();
int height = view.getBottom();
if ( m_GridType == GRID_TYPE::GRID_POINTS )
double pointSize = 2;
for ( int x = 0; x < width; x += 10 ) // this size obviously changes the speed
for ( int y = 0; y < height; y += 10 )
context->rectangle( x - pointSize * 0.5f, y - pointSize * 0.5f, x + pointSize * 0.5f, y + pointSize * 0.5f );
What speed operations / limitations should I be aware of? because when i went into the code I could not see anything particularly slow...
If you are curious what im trying to achieve - i am developing a diagramming solution (flowcharts etc) which when complete I will release for everyone to use.
|Lo-fi Version||: 19th May 2013 - 07:29 PM|