Jump to content
Search Community

Blitmask perf on a slot machine

laugre test
Moderator Tag

Recommended Posts

Hi blitmaskers,

 

Im developing a full hd dual screen air app that display a slot machine on one screen.

My slot machine get 6 columns, each loading 6 (265p x 265p) pictures. 

I use a blitmask (265p x 830p) on each column to spin it.

But once I create the 6 blitmasks I'm loosing 30fps.

If I disable bitmap mode my fps stay at 60fps.

But I have to let the spin work while doing something on the other screen in my same app.

 

Do I have something wrong in my code ?

Or do I reach perf limits ?

Could I improve that ?

 

Here is my code :

/**
		 * loadPhotos
		 */
		public function loadPhotos() : void
		{
			var directory : File = File.applicationDirectory.resolvePath(Common.s_presetManager.getPresetStringValue("/records"));
			pathList = directory.getDirectoryListing();
			
			if (pathList[0].name == ".DS_Store")
			{
				pathList.shift();
			}
			
			var lineItemNB : Array = new Array();
			for (i = 0; i < m_vignetteNb; i++)
			{
				lineItemNB.push(1);
			}
			
			m_photoLoader = new LoaderMax({name:"photoLoader", onComplete:completeHandler});
			for (i = 0; i < pathList.length; i++)
			{
				var line : int;
				if (String(pathList[i].url).charAt(17) == '0')
					line = int(String(pathList[i].url).substr(18, 1)) - 1;
				else
					line = int(String(pathList[i].url).substr(17, 2)) - 1;
				
				m_photoLoader.append( new ImageLoader(pathList[i].url, { container : m_columns[lineItemNB[line]], x : 0, y : line * (265+17), width : 265, height : 265 }) );
				lineItemNB[line]++;
			}
			
			m_photoLoader.load();
		}

private function completeHandler(event : LoaderEvent) : void
		{
			Common.s_logManager.write("[log] vignettes loaded");
			trace("[log] vignettes loaded");
			
			var blitMask1 : BlitMask = new BlitMask(m_columns[0], m_columns[0].x, m_columns[0].y, m_columns[0].width, 829, false, true, 0xffffff, true);
			var blitMask2 : BlitMask = new BlitMask(m_columns[1], m_columns[1].x, m_columns[1].y, m_columns[1].width, 829, false, true, 0xffffff, true);
			var blitMask3 : BlitMask = new BlitMask(m_columns[2], m_columns[2].x, m_columns[2].y, m_columns[2].width, 829, false, true, 0xffffff, true);
			var blitMask4 : BlitMask = new BlitMask(m_columns[3], m_columns[3].x, m_columns[3].y, m_columns[3].width, 829, false, true, 0xffffff, true);
			var blitMask5 : BlitMask = new BlitMask(m_columns[4], m_columns[4].x, m_columns[4].y, m_columns[4].width, 829, false, true, 0xffffff, true);
			var blitMask6 : BlitMask = new BlitMask(m_columns[5], m_columns[5].x, m_columns[5].y, m_columns[5].width, 829, false, true, 0xffffff, true);
			
//			blitMask1.disableBitmapMode();
//			blitMask2.disableBitmapMode();
//			blitMask3.disableBitmapMode();
//			blitMask4.disableBitmapMode();
//			blitMask5.disableBitmapMode();
//			blitMask6.disableBitmapMode();
		}
Link to comment
Share on other sites

Hi,

 

Its very tough to say by just seeing your code, but nothing jumps out at me as being wrong or problematic.

In all our tests bitmapMode makes things perform better (which is why BlitMask was created).

4 years ago I made a little demo of 32 BlitMasks running simultaneously and it doesn't skip a beat: http://www.snorkl.tv/2011/10/use-blitmasks-wrap-feature-for-easy-bitmap-scrolling-and-looping/

 

It sounds like AIR may have some optimizations under the hood that make BlitMask not as necessary or performant as it was in the regular Flash Player.

Link to comment
Share on other sites

Hi Carl,

 

Thx for your answer.

 

The only difference I can see in your demo is that each case is a blitmask and is spinning itself independantly.

In my app, items of a column have to spin together, so my masked area is bigger, 265 x 830p, if I reduce the masked area to 265 x 265, my fps is 60.

 

 

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