IPB SourceForge.net Logo

Welcome Guest ( Log In | Register )

[ Outline ] · Standard · Linear+

> Very slow drawing operation, Im trying to draw points on a grid

ABlueEyedMonkey
post Sep 13 2008, 05:01 PM
Post #1


Advanced Member
***

Group: Members
Posts: 31
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.

CODE

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 );
   context->fillPath();
 }
}


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.
User is offlineProfile CardPM
Go to the top of the page
+Quote Post

Posts in this topic
ABlueEyedMonkey   Very slow drawing operation   Sep 13 2008, 05:01 PM
ABlueEyedMonkey   Just as a quick aside - its drawing about 1500 rec...   Sep 13 2008, 05:12 PM
ddiego   Try moving the fillPath()/strokePath outside of th...   Sep 14 2008, 03:09 AM
ABlueEyedMonkey   Thanks ddiego, I already tried that and yes it sti...   Sep 14 2008, 02:45 PM
ddiego   Thanks for posting! I'll try and look into...   Sep 15 2008, 01:28 PM
ABlueEyedMonkey   I havn't no - but i will give it a go and let ...   Sep 15 2008, 02:07 PM
ddiego   Try updating to the latest code. I made a small ch...   Sep 15 2008, 07:44 PM
ABlueEyedMonkey   Just as an aside - ive got to say that the drawing...   Sep 15 2008, 04:22 PM
ddiego   Thanks ! If you do like the way things are p...   Sep 15 2008, 07:47 PM
ABlueEyedMonkey   Ok so i changed the code to work as was done in th...   Sep 16 2008, 09:32 PM
ddiego   Here's my stats, running in Debug mode: My mac...   Sep 17 2008, 03:38 AM
ABlueEyedMonkey   Woah ok - so i added your code and this is what i ...   Sep 17 2008, 01:13 PM
ddiego   Can you try drawing using the GraphicsContext::r...   Sep 18 2008, 02:04 AM
ddiego   Here's an alternate approach: if ( m_G...   Sep 20 2008, 03:22 AM
ddiego   If you update once more, I think I've fixed it...   Sep 20 2008, 09:14 PM
ABlueEyedMonkey   Sure thing Jim :) Its a bit mental for me right no...   Sep 21 2008, 04:18 PM
ddiego   Not a problem! I'll miss by a few weeks...   Sep 21 2008, 04:31 PM
Fraggle   Let us know what you think of our fair isle, eh? ...   Sep 22 2008, 09:49 PM
ABlueEyedMonkey   Im actually still doing my course; as in Ive alrea...   Sep 23 2008, 05:32 PM
ABlueEyedMonkey   Hey guys - ok ive done some reading and i think th...   Sep 23 2008, 08:38 PM
ddiego   OK that's insanely slow. Again, how are you ...   Sep 23 2008, 09:25 PM


Reply to this topicTopic OptionsStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
 

Lo-fi Version : 19th May 2013 - 07:29 PM