SkipRGBMipmaps(Image *,DDSInfo *,int,ExceptionInfo *),
WriteDDSImage(const ImageInfo *,Image *,ExceptionInfo *),
WriteMipmaps(Image *,const ImageInfo*,const size_t,const size_t,const size_t,
- const MagickBooleanType,const MagickBooleanType,ExceptionInfo *);
+ const MagickBooleanType,const MagickBooleanType,const MagickBooleanType,
+ ExceptionInfo *);
static void
RemapIndices(const ssize_t *,const unsigned char *,unsigned char *),
MagickBooleanType
clusterFit,
+ fromlist,
status,
weightByAlpha;
}
}
- maxMipmaps=SIZE_MAX;
mipmaps=0;
- if ((image->columns & (image->columns - 1)) == 0 &&
- (image->rows & (image->rows - 1)) == 0)
+ fromlist=MagickFalse;
+ option=GetImageOption(image_info,"dds:mipmaps");
+ if (option != (char *) NULL)
{
- option=GetImageOption(image_info,"dds:mipmaps");
+ if (LocaleNCompare(option,"fromlist",8) == 0)
+ {
+ Image
+ *next;
+
+ fromlist=MagickTrue;
+ next=image->next;
+ while(next != (Image *) NULL)
+ {
+ mipmaps++;
+ next=next->next;
+ }
+ }
+ }
+
+ if ((mipmaps == 0) &&
+ ((image->columns & (image->columns - 1)) == 0) &&
+ ((image->rows & (image->rows - 1)) == 0))
+ {
+ maxMipmaps=SIZE_MAX;
if (option != (char *) NULL)
maxMipmaps=StringToUnsignedLong(option);
exception);
if ((mipmaps > 0) && (WriteMipmaps(image,image_info,pixelFormat,compression,
- mipmaps,clusterFit,weightByAlpha,exception) == MagickFalse))
+ mipmaps,fromlist,clusterFit,weightByAlpha,exception) == MagickFalse))
return(MagickFalse);
(void) CloseBlob(image);
static MagickBooleanType WriteMipmaps(Image *image,const ImageInfo *image_info,
const size_t pixelFormat,const size_t compression,const size_t mipmaps,
- const MagickBooleanType clusterFit,const MagickBooleanType weightByAlpha,
- ExceptionInfo *exception)
+ const MagickBooleanType fromlist,const MagickBooleanType clusterFit,
+ const MagickBooleanType weightByAlpha,ExceptionInfo *exception)
{
const char
*option;
option=GetImageOption(image_info,"dds:fast-mipmaps");
fast_mipmaps=IsStringTrue(option);
mipmap_image=image;
+ resize_image=image;
status=MagickTrue;
- for (i=0; i< (ssize_t) mipmaps; i++)
+ for (i=0; i < (ssize_t) mipmaps; i++)
{
- resize_image=ResizeImage(mipmap_image,columns,rows,TriangleFilter,
- exception);
+ if (fromlist == MagickFalse)
+ {
+ mipmap_image=ResizeImage(resize_image,columns,rows,TriangleFilter,
+ exception);
- if (resize_image == (Image *) NULL)
+ if (mipmap_image == (Image *) NULL)
+ {
+ status=MagickFalse;
+ break;
+ }
+ }
+ else
{
- status=MagickFalse;
- break;
+ mipmap_image=mipmap_image->next;
+ if ((mipmap_image->columns != columns) || (mipmap_image->rows != rows))
+ ThrowBinaryException(CoderError,"ImageColumnOrRowSizeIsNotSupported",
+ image->filename);
}
- DestroyBlob(resize_image);
- resize_image->blob=ReferenceBlob(image->blob);
+ DestroyBlob(mipmap_image);
+ mipmap_image->blob=ReferenceBlob(image->blob);
- WriteImageData(resize_image,pixelFormat,compression,weightByAlpha,
+ WriteImageData(mipmap_image,pixelFormat,compression,weightByAlpha,
clusterFit,exception);
- if (fast_mipmaps == MagickFalse)
- resize_image=DestroyImage(resize_image);
- else
+ if (fromlist == MagickFalse)
{
- if (mipmap_image != image)
+ if (fast_mipmaps == MagickFalse)
mipmap_image=DestroyImage(mipmap_image);
- mipmap_image=resize_image;
+ else
+ {
+ if (resize_image != image)
+ resize_image=DestroyImage(resize_image);
+ resize_image=mipmap_image;
+ }
}
columns=DIV2(columns);
rows=DIV2(rows);
}
- if (mipmap_image != image)
- mipmap_image=DestroyImage(mipmap_image);
+ if (resize_image != image)
+ resize_image=DestroyImage(resize_image);
return(status);
}