Quantcast
Channel: Adobe Community : Popular Discussions - Archived Discussions
Viewing all articles
Browse latest Browse all 21156

BitmapData.draw tooo slow in AIR

$
0
0

Hi,

 

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();
scaleMatrix.scale(sc,sc);

var time:Number = new Date().getTime();
outBitmap.drawWithQuality( bitmapdata, scaleMatrix, null,null,null,true,StageQuality.LOW );
trace( new Date().getTime()-time  );

 

UPDATE:

 

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...


Viewing all articles
Browse latest Browse all 21156

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>