You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a performance problem to create a texture vs BitmapData size
Ex : "new BitmapTexture( new BitmapData( 2048, 2048, false ), false);"
Using 2048x2048 everything run perfectly under Flash but targeting Neko / Windows
my software hang for a second .... decreasing BitmapData size reduce the issue ( at 128*128
everything fine on all target ) ...
Edit 1 : Seems the problem comes from BitmapData.getRGBAPixels ( ~ 900ms to process a 2048 x 2048 BitmapData )
Edit 2 : Temporary ( Ugly !! :-) ) workaround :
******* openfl._v2.display.BitmapData.hx
public inline static function getRGBAPixels (bitmapData:BitmapData):ByteArray {
var data = bitmapData.getPixels (new Rectangle (0, 0, bitmapData.width, bitmapData.height));
var size = bitmapData.width * bitmapData.height; var copy = new ByteArray(size-1); copy.writeBytes( data, 1, 0); return copy;
}
The text was updated successfully, but these errors were encountered:
Jeff94
changed the title
BitmapTexture - BitmapData size vs performance > Neko & Windows
[ neko & windows ] - BitmapTexture - BitmapData size vs performance
Mar 28, 2015
Jeff94
changed the title
[ neko & windows ] - BitmapTexture - BitmapData size vs performance
[ Neko / Windows ] - BitmapTexture - BitmapData size vs performance
Mar 28, 2015
public inline static function getRGBAPixels (bitmapData:BitmapData):ByteArray {
var rgbaData = new BitmapData( bitmapData.width, bitmapData.height, bitmapData.transparent );
var rect = new Rectangle( 0, 0, bitmapData.width, bitmapData.height );
var point = new Point( 0, 0 );
rgbaData.copyChannel( bitmapData, rect, point, BitmapDataChannel.GREEN, BitmapDataChannel.RED );
rgbaData.copyChannel( bitmapData, rect, point, BitmapDataChannel.BLUE, BitmapDataChannel.GREEN );
rgbaData.copyChannel( bitmapData, rect, point, BitmapDataChannel.ALPHA, BitmapDataChannel.BLUE );
rgbaData.copyChannel( bitmapData, rect, point, BitmapDataChannel.RED, BitmapDataChannel.ALPHA );
return rgbaData.getPixels( rect );
}
My pull request for this change got merged recently: openfl/openfl#604
Hi all,
I have a performance problem to create a texture vs BitmapData size
Ex : "new BitmapTexture( new BitmapData( 2048, 2048, false ), false);"
Using 2048x2048 everything run perfectly under Flash but targeting Neko / Windows
my software hang for a second .... decreasing BitmapData size reduce the issue ( at 128*128
everything fine on all target ) ...
Edit 1 : Seems the problem comes from BitmapData.getRGBAPixels ( ~ 900ms to process a 2048 x 2048 BitmapData )
Edit 2 : Temporary ( Ugly !! :-) ) workaround :
******* openfl._v2.display.BitmapData.hx
public inline static function getRGBAPixels (bitmapData:BitmapData):ByteArray {
var data = bitmapData.getPixels (new Rectangle (0, 0, bitmapData.width, bitmapData.height));
var size = bitmapData.width * bitmapData.height;
var copy = new ByteArray(size-1);
copy.writeBytes( data, 1, 0);
return copy;
}
The text was updated successfully, but these errors were encountered: