With this code BMax crashes two times.
The first bug in
Change init value from 20 and see second bug.
The second bug in the PixmapReDim function in the
WindowsXP Pro SP1, AMD Sempron 2600, 1 GB RAM, Radeon 9550
Function PixmapReDim(src:TPixmap var, w%, h%) Local pm:TPixmap = src.Copy() src = CreatePixmap(w , h , src.format) 'fill with 0 Local c:Int = $000000FF Local p:Int ptr = Int ptr(src.PixelPtr(0,0)) Local l = w*h For Local i=0 Until l p[i]=c Next src.Paste( pm , 0 , 0 ) 'DebugStop End Function Function AddChar( dst:TPixmap var, font:TImageFont, char% ) Local glyph:TImageGlyph = font.LoadGlyph( char ) Local x% = dst.width Local h% = dst.height If (glyph._h + glyph._y) > h Then h = glyph._h + glyph._y PixmapReDim( dst, x + glyph._w, h ) dst.Paste( glyph._image.pixmaps[0], x, glyph._y ) 'DrawOnImage( dst, glyph._image, x, glyph._y ) End Function '============================================================================== Local fontFile$ = GetFontsPath() + "verdana.ttf" Local font:TImageFont = LoadImageFont( fontFile, 12 ) Local bmp:TPixmap Local i% = 0 Local mi% = i+255 '------------------------------------------------------------------------------ Local glyph:TImageGlyph = font.LoadGlyph(i) bmp = CreatePixmap( glyph._w, glyph._h+glyph._y, PF_RGBA8888, 4 ) bmp.Paste( glyph._image.pixmaps[0], 0,glyph._y ) For i=i+1 To mi AddChar( bmp, font, i ) Next
The first bug in
Local glyph:TImageGlyph = font.LoadGlyph(i)when i from 0 to about 20. These chars must exists!
Change init value from 20 and see second bug.
Local i% = 20
The second bug in the PixmapReDim function in the
src = CreatePixmap(w , h , src.format)Detailed about: error occured in the module "pixmap.bmx" in the code:
pixmap.Pixels=MemAlloc( capacity )when char or number of new pixmap is about 103.
WindowsXP Pro SP1, AMD Sempron 2600, 1 GB RAM, Radeon 9550