gettingstarted
[Top] [All Lists]

Re: graphics and speed

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: graphics and speed
From: "Joseph J. Strout" <joe at realsoftware dot com>
Date: Thu, 26 Aug 2004 12:44:51 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <1cb dot 29c4e5de dot 2e5f785e at aol dot com>
At 1:31 PM -0400 8/26/04, GAmoore at aol dot com wrote:

I have tried to implement this, but as simple as it is, there is something
not right. Something that use to take 0.5 seconds now takes as long as 20
seconds.

You'll have to use a profiler or step through your code -- clearly it's doing a lot more work than you think it is.

Two attempts ...
======================================================================
sub draw_canvas( g as graphics )

   draw_layer1   g
   draw_layer2   g
   draw_layer3   g
   draw_layer4   g

This code is right. You should be calling this from the Paint event of your canvas (and pass in 'g'), as well as anyplace else you need to update the display (and pass in canvas3.graphics or whatever).

======================================================================
sub draw_canvas( g as graphics )
   Dim g2 as Graphics = window3.canvas3.graphics
draw_layer1 g2
   draw_layer2   g2
   draw_layer3   g2
   draw_layer4   g2
g = g2

This code is not right; it ignores the place the caller is telling it to draw (drawing into canvas3.graphics of the implicit instance of window3 instead!), and then at the end, does a pointless reassignment of the parameter (which is really just a local variable).

Best,
- Joe

--
,------------------------------------------------------------------.
|    Joseph J. Strout           REAL Software, Inc.                |
|    joe at realsoftware dot com       http://www.realsoftware.com        |
`------------------------------------------------------------------'
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>