Canvas.Copy is taking too long to complete

Tamar tamar.kolodny at gmail.com
Wed Apr 24 05:33:21 UTC 2013


I'm programming a visual experiment, and suffering from some timing issues. 
It seems that the line presenting the stimuli (canvas.copy) is considerably 
time consuming: 10-12 ms. I can't figure out the cause for this delay, and 
I would appreciate any help...

Here is the relevant piece of code:

====== in an initializing inline script, at the begining of SessionProc: 
======
Set MainCanvas = Display.Canvas
MainCanvas.fillColor = CColor(background_color)
MainCanvas.clear

For i = 1 To NumStim
   Set StimCanvases(i) = Display.CreateCanvas

   'define destination rect as center of screen
   destRects(i).Left = Display.XRes/2-stim_w/2
   destRects(i).Top = Display.YRes/2-stim_h/2
   destRects(i).Right = Display.XRes/2+stim_w/2
   destRects(i).Bottom = Display.YRes/2+stim_h/2
   
   'define source rect as upper left corner
   srcRects(i).Left = 0
   srcRects(i).Top = 0
   srcRects(i).Right = stim_w
   srcRects(i).Bottom = stim_h
   
   'Load the image file
   StimCanvases(i).LoadImage "Stimuli/" & FileNames(i) & ".bmp"
   
Next i

====== in the inline of TrialProc: =======
Debug.Print "1:" & clock.read
StartTrialTime = clock.read
n = c.GetAttrib("CanvasNum")
c.SetAttrib "TrialStart", StartTrialTime
display.WaitForVerticalBlank
Debug.Print "4:" & clock.read
StartStimTime = clock.read
c.SetAttrib "StimStart", StartStimTime
Debug.Print "5:" & clock.read
mainCanvas.copy StimCanvases(n),srcRects(n),destRects(n)
Debug.Print "6:" & clock.read


I've tried a few things: 
- to create variables taking the values of 
StimCanvases(n),srcRects(n),destRects(n) in the beginning of the trial, so 
the mainCanvas.copy line would not need to approach the arrays.
- to present other simple canvases instead of my real stimuli (just a 
fixation, for example. or an empty canvas)
- to draw something on the mainCanvas rather than copy a new canvas to it 
(e.g. mainCanvas.Circle).

All of these takes 10-12 ms! (as calculated by subtracting time5 from 
time6). The only way I managed to get rid of the delay was to erase the 
entire row...

Am I missing something here?...

Thanks,
Tamar

-- 
You received this message because you are subscribed to the Google Groups "E-Prime" group.
To unsubscribe from this group and stop receiving emails from it, send an email to e-prime+unsubscribe at googlegroups.com.
To post to this group, send email to e-prime at googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/e-prime/-/y5hiddEu-6oJ.
For more options, visit https://groups.google.com/groups/opt_out.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.linguistlist.org/pipermail/eprime/attachments/20130423/c91bc873/attachment.htm>


More information about the Eprime mailing list