Unlockimage does nothing?

BlitzMax Forums/BlitzMax Programming/Unlockimage does nothing?

I was just digging around for the code to DrawPixmap hoping there was a method for drawing pixmaps just cause I wanted to be all OOP and I found this:

Rem
bbdoc: Lock an image for direct access
returns: A pixmap representing the image contents
about:
Locking an image allows you to directly access an image's pixels.<br>
<br>
Only images created with the DYNAMICIMAGE flag can be locked.<br>
<br>
Locked images must eventually be unlocked with #UnlockImage before they can be drawn.
end rem
Function LockImage:TPixmap( image:TImage,frame=0,read_lock=True,write_lock=True )
	Return image.Lock( frame,read_lock,write_lock )
End Function

Rem
bbdoc: Unlock an image
about:
Unlocks an image previously locked with #LockImage.
end rem
Function UnlockImage( image:TImage,frame=0 )
End Function



It seemed odd to me that there should be no code at all in the UnlockImage function.

Here's the image.lock() method:

	Method Lock:TPixmap( index,read,write )
		If write
			seqs[index]=0
			frames[index]=Null
		EndIf
		If Not pixmaps[index]
			pixmaps[index]=CreatePixmap( width,height,PF_RGBA8888 )
		EndIf
		Return pixmaps[index]
	End Method


I guess it doesn't seem to do anything special besides create a pixmap that it saves a pointer to in the image, but it seems odd that the docs would tell you to call a command that does nothing at all, and call the command to create a pixmap "lockimage".

I suppose there was some future expansion stuff in mind. Or maybe something gets overridden for DirectX?

I noticed this a while back. I think its for people coming from Blitz3D/+ (so they could use the Lock command, without which an Unlock would seem odd) and for future expansion like you said.

Or unless it actually does do something behind the scenes in the OpenGL/dx driver. I expect OpenGL for example has a mechanism built in which Max taps into that gets a lock on an image and maybe that requires a release. ?