Odd Buffer problem
Posted: Tue Apr 15, 2008 2:55 pm
I've been having a weird Allocation problem.
If I store 640 in a short var wdth, and 480 to a short var height (screen dimensions), and then ask to allocate, the bugger fails.
If I ask to allocate a 640*480 buffer, it continues.
However, the first case works if the dimensions are smaller (but I'm not going to work with a 100*100 screen, people).
Here's some abridged code
This one didn't work. The buffer was null and empty.
This one did work:
The resulting buffer was in good working order. The latter is nice if I am going to use 640*480, but that won't always be the case. The former is good for stamps.
If I store 640 in a short var wdth, and 480 to a short var height (screen dimensions), and then ask to allocate, the bugger fails.
If I ask to allocate a 640*480 buffer, it continues.
However, the first case works if the dimensions are smaller (but I'm not going to work with a 100*100 screen, people).
Here's some abridged code
Code: Select all
DIM AS main something = main (640,480)
'blah blah blah
CONSTRUCTOR main (wdth_ AS SHORT, height_ AS SHORT)
wdth = wdth_ 'both are SHORT
height = height_
SCREENRES wdth, height
'buffer
buffer = ALLOCATE (wdth * height * SIZEOF (INTEGER))
END CONSTRUCTOR
This one did work:
Code: Select all
DIM AS main something = main
'blah blah blah
CONSTRUCTOR main
SCREENRES 640, 480
'buffer
buffer = ALLOCATE (640 * 480 * SIZEOF (INTEGER))
END CONSTRUCTOR