Jedediah Smith wrote:
I think it's come time for a proper class for decoded images.
- anywhere else decoded images are used
public byte[] Red;
public byte[] Green;
public byte[] Blue;
public byte[] Bump;
public byte[] Alpha;
I would think you would get less page cache misses if you use a
structure since the code generally uses the Alpha channel with
the color channels.
I also don't see anywhere you would have just an Alpha and not a full
RGB pixel. The packed structure takes one 32 bit word and therefore
would not use that much more ram even when the Alpha channel is not
used.
#pragma pack(push)
#pragma pack(1) //pack the structure itself.
typedef struct tagRGBQUADA {
BYTE Red; //LSB first on Intel processors.
BYTE Green; //The order only matters if a union is used.
BYTE Blue;
BYTE Alpha;
} RGBQUADA;
#pragma pack(pop) //back to default packing
Namespace libsecondlife
{
public class Image
{
public int Width;
public int Height;
public RGBQUADA[] Pixels;
public byte[] Bump;
public bool AlphaChannelUsed; //true if actually used.
public Create(int width, int height, bool bRGB, bool bBump)
int n = width * height;
if (bRGB) Pixels = new RGBQUADA[n];
if (bBump) Bump = new byte[n];
}; //create
}//Class image
}//Namespace libsecondlife
--
Bill, Grumble
_______________________________________________
libsl-dev mailing list
libsl-dev@opensecondlife.org
http://opensecondlife.org/cgi-bin/mailman/listinfo/libsl-dev