<br><br><div><span class="gmail_quote">2007/8/22, Jonas Maebe <<a href="mailto:jonas.maebe@elis.ugent.be">jonas.maebe@elis.ugent.be</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>It is because you do not redirect the line drawing directly to SDL,<br>but instead use the default line drawing routines. Those are indeed<br>very slow, because they call a procedural variable (directputpixel)<br>for each pixel which has to be drawn). And directputpixel then calls
<br>through to SDL, which every time must recalculate the pixel position<br>on the screen (instead of just adding 1 to the horizontal or vertical<br>coordinate in case of horizontal/vertical line drawing).</blockquote><div>
<br> Hm... I really forgot to hook Line (but wrote the routine). But HLine and VLine are hooked and the speed problem is in the Bar function, it has such code:<br> for y:=y1 to y2 do<br> Hline(x1,x2,y);
<br>HLine is hooked and works quickly. But it locks the screen every time it is executed (but calls DirectPutPixel without locking (that's why it is fast):<br>procedure sdlgraph_HLine(x,x2,y: smallint);<br>var<br>temp:DefPixelProc;
<br>begin<br> temp:=DirectPutPixel;<br> DirectPutPixel:=@nonBuf_DirectPutPixel; // It doesn't lock the screen as sdlgraph_DirectPutPixel. It's quick.<br> Slock;<br> HLineDefault(x,x2,y);<br> Sulock;<br> DirectPutPixel:=temp;
<br>end;<br><br>If to do the same (using nonBuf_HLine) with Bar3D it would be very fast.<br></div><br><br></div><br><br clear="all"><br>-- <br>E.I.