2007/8/22, Jonas Maebe <[EMAIL PROTECTED]>: > > > It is because you do not redirect the line drawing directly to SDL, > but instead use the default line drawing routines. Those are indeed > very slow, because they call a procedural variable (directputpixel) > for each pixel which has to be drawn). And directputpixel then calls > through to SDL, which every time must recalculate the pixel position > on the screen (instead of just adding 1 to the horizontal or vertical > coordinate in case of horizontal/vertical line drawing).
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: for y:=y1 to y2 do Hline(x1,x2,y); 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): procedure sdlgraph_HLine(x,x2,y: smallint); var temp:DefPixelProc; begin temp:=DirectPutPixel; DirectPutPixel:[EMAIL PROTECTED]; // It doesn't lock the screen as sdlgraph_DirectPutPixel. It's quick. Slock; HLineDefault(x,x2,y); Sulock; DirectPutPixel:=temp; end; If to do the same (using nonBuf_HLine) with Bar3D it would be very fast. -- E.I.
_______________________________________________ fpc-devel maillist - fpc-devel@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-devel