Jump to content
Search Community

blitMask runs fine on pc slow on iOS

lukelukeluke test
Moderator Tag

Recommended Posts

Hi there,

Here is my code :

 

package {
	  import flash.display.MovieClip;
	  import com.greensock.*;
	  import flash.events.*;
	  public class test extends MovieClip {
				public var blitMask:BlitMask;
				public var holder:CONTENT;
				public var moving=true;
				public function test() {
						  holder = new CONTENT();
						  addChild(holder);
						  addEventListener(Event.ENTER_FRAME,update);
						  blitMask=new BlitMask(holder,0,0,320,185,true);
				}


				private function update(e:Event) {
						  if (moving) {
									holder.x+=1;
									blitMask.bitmapMode=true;
									blitMask.update();
						  } else {
									blitMask.bitmapMode=false;
						  }
				}


				public function addMoreClips(clip) {
						  holder.addChild(clip);
						  ///What shoud I do here to update the blitmask ?
				}
	  }
}

 

 

like i said this runs fine on pc but really slow on iOS .

without blitMask it is running at 60 fps on iOS with blitMask is much slower.

the content is just about 20 clips with text in each.

I am running it GPU mode and the whole movie gets scaled to the size of the screen once when starting the app.

 

what have I done wrong ?

Link to comment
Share on other sites

I'm not sure what else is going on in your file that might be causing the problem, but I don't see any HUGE problems with the code you posted although it is kinda wasteful in the sense that it is constantly setting the bitmaMode value over and over on every frame. That really shouldn't be a big deal, though.

 

You didn't manually set your "holder" DisplayObject's visible property to true did you? If so, that would definitely explain the slowdown.

 

As far as forcing a recpature during the update (in your addMoreClips() method), you can simply call update(null, true) on the BlitMask. But do that sparingly because it can be processor-intensive to do a recapture of all the pixels.

Link to comment
Share on other sites

Hello and thanks for your reply , also thank you very much for your work.

I just did a test on the pc to see if my code had a problem.

I created a 320*180000 clip with out bitMask it was scrolling around 50fps with bitMask 55fps.

So I can confirm on the PC there is an improvement.

 

so its not my code. must be an iOS problem.

I guess ill have to go without .

Link to comment
Share on other sites

I just did a test in a brand new project with this code on the first frame and a symbol in the library with text field.

 

 

import flash.display.MovieClip;
import hiResStats.net.hires.debug.Stats;
import flash.display.BitmapData;
import flash.display.Bitmap;
import com.greensock.*;
import flash.events.*;

var stats:Stats = new Stats();


var holder:MovieClip = new MovieClip();
addChild(holder);
for (var i=0; i<1000; i++) {
var newitem:item = new item();
newitem.label.text=String(Math.random());
var bmp:BitmapData=new BitmapData(320,60);
bmp.draw(newitem);
var bitmap:Bitmap=new Bitmap(bmp);
bitmap.y=i*60;
holder.addChild(bitmap);
}

var blitMask:BlitMask=new BlitMask(holder,0,0,320,480,true,true);
addChild(stats);

addEventListener(Event.ENTER_FRAME,go);

function go(e:Event) {
holder.y-=10
}

 

iPhone 4s ,GPU ,full screen , 60fps

 

with blitMask on it runs at 55fps(quite noticeable) and sometimes crashes at start up

without blitMask it runs flawlessly at 60fps .

:?

Link to comment
Share on other sites

This is the exact issue I've been having with iOS. :( Tested on Android, PlayBook and BB10 and can confirm that those 3 work fine.

 

I really am crossing my fingers that iOS six is announced next week and developers get it right away so we can see an improvement.

Link to comment
Share on other sites

This thing is confusing me I made a bmp 320*120000 and scrolled it up the stage and it was still running at a solid 60 fps with out blitMask. ... I don't get it. The whole point of me trying to use blitMask is that i thought scrolling a big bitmap would be slow , is that not a big bitmap ? because its running fine. Is it something to do with the GPU ? are blitMasks benefits only noticeable on CPU ? if this is so maybe It would still be useful for older devices ? but the problem still stands is that should using blitMask in my test make things slower ?

Link to comment
Share on other sites

I have definitely seen big improvements on iPads using BlitMask, but those tests were done a while back on an iPad 2. Maybe Apple or Adobe did something to more recent versions of AIR or iOS that is causing a difference (I can't imagine what or why though). Have you run your tests on both an iPad 2 and 3? I wonder if it has something to do with the super high-res screen in the iPad 3 and the scaling that Apple is having to do behind the scenes. Not sure. And yes, 320*120000 is pretty huge.

  • Like 1
Link to comment
Share on other sites

I can confirm that blitMask works better on the iPad2 than the iPad3. The iPad3 is almost as bad as having to work against the iPad1. Keep in mind there hasn't been an iOS update since the iPad3 came out. It seems like the iPad3 has less available memory to work with than the iPad2.

 

Lets hope that iOS6 announced on Monday and available for developers fixes some of these annoyances.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...