PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Using SetColorMask

Hello,

I have a simple problem.

In my GameInit I do the following:

Code:

m_hsibackoverlay = Frog::LoadImage(display, IDR_HSIBACKOVERLAY);
m_hsibackoverlay->SetColorMask(Color(255,0,255));


Then I use the loaded resource in my GameLoop:

Code:

// Erase to black
m_display->Clear(Color(RGB(0,0,0)));
// Draw overlay
m_display->Blit(-23,0,m_hsibackoverlay);


However, I get the entire image drawn, including the sections of the image set to 255,0,255.
The mask doesn't seem to be working.

What have I done wrong?
Ok, I was being dum and I have fixed the masking problem now. BUT!

The performance I am getting on my Compaq H3870 is awful.

I am blitting one png image, then rotate blitting another over it, like so:

Code:

// Erase to black
m_display->Clear(Color(RGB(0,0,0)));

m_display->Blit(0,0,m_hsibackoverlay);

m_display->BlitRotated(40,40,ang,m_hsicard);

ang += 0.01;
if(ang > 360.0) // for test
ang = 0;


but my frame rate (which i have set at 30FPS) drops to 20FPS and I run completely out of spare time.
Why are these two simple operations taking so long?
Conan · 30 Mar 2003, 07:45 UTC — why so slow
First thing to check if not already done is to take out your frame rate limiter just in case it's wrong & check speed still same.

I don't know if this iPaq is one with a different screen layout but some devices are slower than others due to the screen memory being arranged in a way that's bad for blitting. Check the general forum on this one.
I have taken out my frame rate limiter.
I get 6 FPS on a debug build and 20 FPS on a release build.

I have read through loads of stuff on the Compaq memory buffer display issue and have checked that PF is doing what it should...i.e using direct access to 0xAC0755A0 instead of what is returned by GXGetDisplayProperties().

The problem seems to be when I do the Blit. When I blit nothing the page displays at 130 FPS. But as soon as I blit my image (*.png type image), the framerate reduces to 34 FPS.

And this is whilst doing NOTHING else in the Gameloop. No game code whatsoever. Heaven knows what rate i'll get when I add that in!!

HELP!
Try doing a plain Blit() instead of BlitRotated().
It seems just doing a

Code:

m_display->Blit(0,0,m_hsibackoverlay);

reduces frame rate from 150 to 75.

Granted, the image is not small (256x273), so I would expect a reduction in frame rate. But over 70 FPS reduction??
Well, I can't speak for Blit(), but I imagine it takes quite a lot of calculations to rotate an image of that size.