Game Development Community

Fix for PNG height size limits

by Tom Spilman · in Torque Game Engine Advanced · 01/14/2007 (1:47 pm) · 2 replies

I posted the majority of this fix to the TGE forums over here.

In addition to this i fixed the special GBitmap::writePNGDebug() found in TSE.

At line 456 remove this:

// Check height
#define MAX_HEIGHT 4096
   if (height >= MAX_HEIGHT)
      return (false);

Then add this at line 469...

// REMOVED: png_bytep row_pointers[MAX_HEIGHT];
   FrameAllocatorMarker marker; // ADDED!
   png_bytep* row_pointers = (png_bytep*)marker.alloc( height * sizeof( png_bytep ) ); // ADDED!
   char bitmapNameBuf[256];
   for(U32 i = 0; i < getNumMipLevels(); i++ ) 
   {

Now remove all further references to FrameAllocator:: in the function. The FrameAllocatorMarker takes care of managing the watermark all by itself. FrameAllocatorMarker and FrameTemp<> rule. ;)

Enjoy!

About the author

Tom is a programmer and co-owner of Sickhead Games, LLC.


#1
01/14/2007 (11:21 pm)
Super Tom!!!!

One of those nasty irritating issues that was damn annoying to everyone
#2
01/15/2007 (5:37 pm)
Got it, thanks again Tom.