New WritePixel() or TPixMap Bug?
Archives Forums/BlitzMax Bug Reports/New WritePixel() or TPixMap Bug?
| ||
I am writing a fast oval algorith and I decided to do it this way:Function AuchOval(B%,H%) Local Mal:TPixmap=CreatePixmap(300,200,PF_RGBA8888) For Local I#=180 To 270 Step .1 WritePixel Mal,B+Sin(i)*B+1,H+Cos(i)*H+1,$ffffffff Next Local Bild:Timage=LoadImage(Mal) DrawImage Bild,0,100 End Function Function only paints a quarter of the oval. Later I will copy the rest while changing "SetScale". Ok, the function seems to work perfect. but to test the performance I put it into this surrounding: SuperStrict Graphics 400,300 Global Test% Repeat Cls Test=Test+1 DrawText "Round"+test ,20,20 DrawText "painiting 10 ovals:",20,40 For Local i%=1 To 10 AuchOval 200,100 Next Flip Delay 100 Until KeyHit(key_escape) Now something strange happens: In the first seconds it works as expected. But after a certain number of paintings, the POINTER to Map:TPixMap seems to have the wrong adress. see this picture: If you cannot see the problem on your computer, change the 10 to 100 in: For Local i%=1 To 10 |
| ||
To fix this behaviour use ClearPixel after creating the Pixmap. In any case after 70/75 round my computer starts to 'get very slow'... |
| ||
Yes, that the second behavoir I recognized too. The larger the pixmap the earlier the problem occurs. Can it be because of a memory problem or grafic card problem? Thank you for the advise. I will test it and find out what the command is good for. Is this a workaround or the normal procedure of creating PIXMAPS? Isn't the pixmap created new each time I call the CREATEPIXMAP? |
| ||
Thank you for the advise. I will test it and find out what the command is good for. Is this a workaround or the normal procedure of creating PIXMAPS? Isn't the pixmap created new each time I call the CREATEPIXMAP? I think this can be considered as 'normal' because the in-line help refers to ClearPixel...from the docs Note that the newly created pixmap will contain random data. ClearPixels can be used to set all pixels to a known value prior to use. Probably there's no guarantee the ram-bank alloced for the Pixmap is 'empty'. |