瀏覽代碼

Fixed pixmap bugs.

Mark Sibly 9 年之前
父節點
當前提交
d6739340f3
共有 2 個文件被更改,包括 2 次插入2 次删除
  1. 1 1
      modules/std/graphics/pixmap.monkey2
  2. 1 1
      modules/std/graphics/pixmaploader.monkey2

+ 1 - 1
modules/std/graphics/pixmap.monkey2

@@ -26,7 +26,7 @@ Class Pixmap
 	Method New( width:Int,height:Int,format:PixelFormat=PixelFormat.RGBA32 )
 
 		Local depth:=PixelFormatDepth( format )
-		Local pitch:=depth * height
+		Local pitch:=width*depth
 		Local data:=Cast<UByte Ptr>( libc.malloc( width*height*pitch ) )
 		
 		_width=width

+ 1 - 1
modules/std/graphics/pixmaploader.monkey2

@@ -64,7 +64,7 @@ Function LoadPixmap:Pixmap( path:String,format:PixelFormat )
 		End
 	End
 	
-	Return New Pixmap( x,y,format,data,PixelFormatDepth( format )*y,Lambda( data:UByte Ptr )
+	Return New Pixmap( x,y,format,data,x*PixelFormatDepth( format ),Lambda( data:UByte Ptr )
 		stbi_image_free( data )
 	End )
 End