AIR BitmapData.draw lento
Frecuentes
Visto 369 veces
2
I am working with large bitmapdata that I need to resize, doing some test I realized that the same code runs tooooo slow in AIR.
Este es el código:
import flash.display.BitmapData;
import flash.geom.Matrix;
import flash.display.Bitmap;
import flash.geom.Point;
var MAX_BITMAP_SIZE:Point = new Point( 596, 842 );
var bitmapdata:BitmapData = new MyBitmap();
var sc:Number = Math.min( MAX_BITMAP_SIZE.x / bitmapdata.width, MAX_BITMAP_SIZE.y / bitmapdata.height );
var outBitmap:BitmapData = new BitmapData( bitmapdata.width >> 1, bitmapdata.height >> 1, false, 0x0 );
var bitmap:Bitmap = new Bitmap();
addChild( bitmap );
var scaleMatrix:Matrix = new Matrix();
scaleMatrix.scale(sc,sc);
var time:Number = new Date().getTime();
outBitmap.draw( bitmapdata, scaleMatrix, null,null,null,true );
trace( new Date().getTime()-time );
bitmap.bitmapData = outBitmap;
The same code tests:
Publish as flash 11.4 -> 1ms Publish as AIR 3.4 ->62ms
¿Nadie?
0 Respuestas
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas actionscript-3 flash air bitmapdata or haz tu propia pregunta.
Have you tried drawWithQuality, setting a lower quality than the default one? - Kodiak
Yes, I have test with StageQuality.LOW but the results are the same. - xperiments
and isn't scaling the Bitmap (DisplayObject) itself faster and smoother? - Kodiak
No, really is a strange behaviour. Why publish to flash player gives me 1ms and the same code compiled to Desktop Air gets 63ms. - xperiments
Ummm, figured out why... I was testing inside Flash IDE, but testing in browser gives me 46ms... anyway it gets 62ms in AIR app... strange anyway... - xperiments