PocketMatrix forums

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

Surface Size

I'm lookin around but haven't come across where its noted ...What is the maximum memory/size for a surface in the current non-beta release. I think that is what's causing me problems with certain, but not all, images I am trying to load.

JJB
I'm not positive, but I believe the only limitation is device memory. An app I did for a client has an animation surface of 4160 x 480 - that's 1.3M for a single surface, and it works perfectly. Be sure you allocate enough system memory to run the app.

--GR
Actually, I think that there is a limitation for very big surfaces in 1.04. Don't know about exact limitations, but as far as I know, Johan has removed these in the new betas.
Hm. I did read that notation for 1.10 Beta. Thusly why I mentioned for the current non-beta releases. At any rate, the surface in question is 256x4096. And...it doesn't appear to be working so far. The smaller surfaces are working fine though. I haven't actually tried splitting up the larger surface. I'd really rather not have so many smaller images to load separately and have to fiddle with. Hmm..will I have to wait on 1.10 or use a Beta lib?

JJB
Are you having the problem running under WIN32 or on a specific device only?

-- GR
Hmm. Well I seem to have fixed my problem. It was not necessarily a memory size issue really after all. LOL. But rather two different problems of my own doing. One, the RECT specifying the src region wasn't being set BEFORE the BltFast call. So, usually it was a 0-sized RECT being copied.

Second, I was BltFasting a src region larger than the actual display. I didn't know this was an issue (clipping?) and maybe it's not (I remember it was in older DirectX SDKs)...but I had to specify a RECT equal to or smaller than the display. Using NULL only worked for src images smaller than the display.

Ok, so GapiDraw is runnin fine now. Too bad I get fatal exception crashes every time my program runs an fopen or fclose. :( Weird.

If it's not one thing it's another.

Thanks for the input/comments guys.


JJB
Glad you found the problem. As for fopen/fclose, I use them all the time for debug dumps. Post an example of how you are using them.

-- GR
Just thought I could mention. GapiDraw 1.04 uses (as most other libraries such as PocketFrog) the IMGDECMP.DLL library to load images on handheld computers.

Using IMGDECMP.DLL in 1.04 causes extreme overhead:
(1) The source image is loaded into memory (unless it is stored as a resource or in a memory location)
(2) IMGDECMP.DLL is called and will allocate memory for an uncompressed 24-bit version of the image
(3) A GapiSurface is allocated in memory taking width*height*2 bytes of memory
(4) The image is downscaled from 24-bit to 16-bit color.
Total amount of required memory: source file + width*height*3 bytes + width*height*2 bytes... Of course after the image has been loaded, all other memory except the GapiSurface will be freed.

In GapiDraw 1.10, the following happens when reading an image from file, resource or memory:
(1) The source image is mapped as a memory mapped file (unless it is stored as a resource or in a memory location)
(2) The GapiSurface is allocated taking width*height*2 bytes
(3) The image is loaded using zero-memory overhead and transformed to 16-bit while reading directly into the GapiSurface.
Total amount of required memory: width*height*2 bytes...

The only image types using zero-memory overhead in 1.10 is BMP (using my own bmp-reader capable of RLE-encoded BMPs) and PNG. Other file types still use IMGDECMP.DLL.

/Johan
AAaah. That is very interesting. Hmm. Initially I had the images as files. But I have since loaded them as resources. Still notice some loading time, but I don't expect an instant effect from the image size in question on a PocketPC.

I am using 8-bit PNG at this point loaded as resource. Not what I originally started with, but at this point is what I'm using. Would that be my best bet for the least overhead in 1.04? I find the filesize of the PNG format to be highly acceptable without noticeably altering the image. No wonder you use that format in the samples. :)

JJB
8-bit png should work fine..