*/
typedef struct _DDSPixelFormat
{
- unsigned long
+ size_t
flags,
fourcc,
rgb_bitcount,
typedef struct _DDSInfo
{
- unsigned long
+ size_t
flags,
height,
width,
%
*/
-static inline unsigned long Min(unsigned long one, unsigned long two)
+static inline size_t Min(size_t one, size_t two)
{
if (one < two)
return one;
DDSDecoder
*decoder;
- unsigned long
+ size_t
n, num_images;
/*
static MagickBooleanType ReadDDSInfo(Image *image, DDSInfo *dds_info)
{
- unsigned long
+ size_t
hdr_size,
required;
dds_info->flags = ReadBlobLSBLong(image);
/* Check required flags */
- required=(unsigned long) (DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT);
+ required=(size_t) (DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT);
if ((dds_info->flags & required) != required)
return MagickFalse;
ExceptionInfo
*exception;
- long
+ ssize_t
j,
y;
PixelPacket
*q;
- register long
+ register ssize_t
i,
x;
c0,
c1;
- unsigned long
+ size_t
bits;
exception=(&image->exception);
- for (y = 0; y < (long) dds_info->height; y += 4)
+ for (y = 0; y < (ssize_t) dds_info->height; y += 4)
{
- for (x = 0; x < (long) dds_info->width; x += 4)
+ for (x = 0; x < (ssize_t) dds_info->width; x += 4)
{
/* Get 4x4 patch of pixels to write on */
q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x),
{
for (i = 0; i < 4; i++)
{
- if ((x + i) < (long) dds_info->width && (y + j) < (long) dds_info->height)
+ if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)
{
code = (unsigned char) ((bits >> ((j*4+i)*2)) & 0x3);
q->red = ScaleCharToQuantum( colors.r[code] );
ExceptionInfo
*exception;
- long
+ ssize_t
j,
y;
PixelPacket
*q;
- register long
+ register ssize_t
i,
x;
unsigned char
alpha;
- unsigned long
+ size_t
a0,
a1,
bits,
c1;
exception=(&image->exception);
- for (y = 0; y < (long) dds_info->height; y += 4)
+ for (y = 0; y < (ssize_t) dds_info->height; y += 4)
{
- for (x = 0; x < (long) dds_info->width; x += 4)
+ for (x = 0; x < (ssize_t) dds_info->width; x += 4)
{
/* Get 4x4 patch of pixels to write on */
q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x),
{
for (i = 0; i < 4; i++)
{
- if ((x + i) < (long) dds_info->width && (y + j) < (long) dds_info->height)
+ if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)
{
code = (bits >> ((4*j+i)*2)) & 0x3;
q->red = ScaleCharToQuantum( colors.r[code] );
ExceptionInfo
*exception;
- long
+ ssize_t
j,
y;
PixelPacket
*q;
- register long
+ register ssize_t
i,
x;
a0,
a1;
- unsigned long
+ size_t
alpha,
bits,
code,
c1;
exception=(&image->exception);
- for (y = 0; y < (long) dds_info->height; y += 4)
+ for (y = 0; y < (ssize_t) dds_info->height; y += 4)
{
- for (x = 0; x < (long) dds_info->width; x += 4)
+ for (x = 0; x < (ssize_t) dds_info->width; x += 4)
{
/* Get 4x4 patch of pixels to write on */
q = QueueAuthenticPixels(image, x, y, Min(4, dds_info->width - x),
{
for (i = 0; i < 4; i++)
{
- if ((x + i) < (long) dds_info->width && (y + j) < (long) dds_info->height)
+ if ((x + i) < (ssize_t) dds_info->width && (y + j) < (ssize_t) dds_info->height)
{
code = (bits >> ((4*j+i)*2)) & 0x3;
q->red = ScaleCharToQuantum( colors.r[code] );
q->blue = ScaleCharToQuantum( colors.b[code] );
/* Extract alpha value */
- alpha_code = (unsigned long) (alpha_bits >> (3*(4*j+i))) & 0x7;
+ alpha_code = (size_t) (alpha_bits >> (3*(4*j+i))) & 0x7;
if (alpha_code == 0)
alpha = a0;
else if (alpha_code == 1)
ExceptionInfo
*exception;
- long
+ ssize_t
x, y;
PixelPacket
*q;
exception=(&image->exception);
- for (y = 0; y < (long) dds_info->height; y++)
+ for (y = 0; y < (ssize_t) dds_info->height; y++)
{
q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception);
if (q == (PixelPacket *) NULL)
return MagickFalse;
- for (x = 0; x < (long) dds_info->width; x++)
+ for (x = 0; x < (ssize_t) dds_info->width; x++)
{
q->blue = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
q->green = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
q->red = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
+ if (dds_info->pixelformat.rgb_bitcount == 32)
+ (void) ReadBlobByte(image);
q++;
}
ExceptionInfo
*exception;
- long
+ ssize_t
x, y;
PixelPacket
*q;
exception=(&image->exception);
- for (y = 0; y < (long) dds_info->height; y++)
+ for (y = 0; y < (ssize_t) dds_info->height; y++)
{
q = QueueAuthenticPixels(image, 0, y, dds_info->width, 1,exception);
if (q == (PixelPacket *) NULL)
return MagickFalse;
- for (x = 0; x < (long) dds_info->width; x++)
+ for (x = 0; x < (ssize_t) dds_info->width; x++)
{
q->blue = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
q->green = ScaleCharToQuantum( (unsigned char) ReadBlobByte(image) );
*/
static void SkipDXTMipmaps(Image *image, DDSInfo *dds_info, int texel_size)
{
- register long
+ register ssize_t
i;
MagickOffsetType
offset;
- unsigned long
+ size_t
h,
w;
/*
Mipmapcount includes the main image, so start from one
*/
- for (i = 1; (i < (long) dds_info->mipmapcount) && w && h; i++)
+ for (i = 1; (i < (ssize_t) dds_info->mipmapcount) && w && h; i++)
{
offset = (MagickOffsetType) ((w + 3) / 4) * ((h + 3) / 4) * texel_size;
(void) SeekBlob(image, offset, SEEK_CUR);
MagickOffsetType
offset;
- register long
+ register ssize_t
i;
- unsigned long
+ size_t
h,
w;
/*
Mipmapcount includes the main image, so start from one
*/
- for (i=1; (i < (long) dds_info->mipmapcount) && w && h; i++)
+ for (i=1; (i < (ssize_t) dds_info->mipmapcount) && w && h; i++)
{
offset = (MagickOffsetType) w * h * pixel_size;
(void) SeekBlob(image, offset, SEEK_CUR);
% RegisterDDSImage(void)
%
*/
-ModuleExport unsigned long RegisterDDSImage(void)
+ModuleExport size_t RegisterDDSImage(void)
{
MagickInfo
*entry;