1 Reply Latest reply on Aug 29, 2012 2:24 PM by undereyes

    BitmapData.draw tooo slow in AIR

    xperiments.es.fr Level 1



      I am getting an strange behaviour when doing a BitmapData.draw, when I publish to Flash Player plugin it takes 1ms to scale down a big image but if I publish the same code as AIR Desktop it takes 62ms.


      This is the code I am using, nothing special in it....


      import flash.display.BitmapData;
      import flash.geom.Matrix;
      import flash.display.Bitmap;
      import flash.geom.Point;
      import flash.display.StageQuality;
      var MAX_BITMAP_SIZE:Point = new Point( 596, 842 );
      var bitmapdata:BitmapData = new MyBitmap(); // class with a image
      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 scaleMatrix:Matrix = new Matrix();
      var time:Number = new Date().getTime();
      outBitmap.drawWithQuality( bitmapdata, scaleMatrix, null,null,null,true,StageQuality.LOW );
      trace( new Date().getTime()-time  );




      Figured out why this is happening... I was testing inside Flash IDE and this gives me 1ms.... if I test in browser it gives me 42-47ms.

      Anyway testing in AIR gives me 62ms...