Possible bug in CopyPixelFast (Blitz 2D)

BlitzPlus Forums/BlitzPlus Programming/Possible bug in CopyPixelFast (Blitz 2D)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

what, so writing lots of pixels to the screen is faster than using the draw image command? Or am i missing the point?

This example copys pixels across buffers and draws images to the screen. press 1 to get the images being drawn with DrawImage command and press 2 to get the images drawn by CopyPixelFast.

Graphics 800,600
SetBuffer BackBuffer()


img=CreateImage(50,50)

SetBuffer ImageBuffer(img)
Color 100,200,255
Rect 0,0,50,50

SetBuffer BackBuffer()

mode=0

Color 50,150,20

While Not KeyHit(1)

	Cls

	If KeyHit(2) Then mode=0
	If KeyHit(3) Then mode=1
	
	If mode=0 Then
				For loop=0 To 8
					For loop1=0 To 8
						DrawImage img,loop*52,loop1*52
					Next
				Next
	ElseIf mode=1 Then
				LockBuffer BackBuffer()
				LockBuffer ImageBuffer(img)
				For loop=0 To 8
					For loop1=0 To 8
						For loop2=0 To ImageWidth(img)-1
							For loop3=0 To ImageHeight(img)-1
								CopyPixelFast loop2,loop3,ImageBuffer(img),(loop*52)+loop2,(loop1*52)+loop3,BackBuffer()
							Next
						Next
					Next
				Next
				UnlockBuffer ImageBuffer(img)
				UnlockBuffer BackBuffer()
	End If
	
	If MilliSecs()<timer+1000 Then
								frame=frame+1
	Else
								fps=frame
								frame=0
								timer=MilliSecs()
	End If
	
	Text 0,0,"FPS="+fps
	Flip False
Wend
End


I do apoligise if i'm talking about something different from you ^_^