windowscodecs: Add support for color table sort flag to the GIF decoder.
This commit is contained in:
parent
ec206a843f
commit
cfdf84b434
|
@ -912,7 +912,8 @@ static HRESULT create_IMD_metadata_reader(GifFrameDecode *This, IWICMetadataRead
|
|||
IMD_data.packed |= 1 << 7;
|
||||
/* local_color_table_size */
|
||||
IMD_data.packed |= This->frame->ImageDesc.ColorMap->BitsPerPixel - 1;
|
||||
/* FIXME: sort_flag */
|
||||
/* sort_flag */
|
||||
IMD_data.packed |= This->frame->ImageDesc.ColorMap->SortFlag ? 0x20 : 0;
|
||||
}
|
||||
|
||||
stream = create_stream(&IMD_data, sizeof(IMD_data));
|
||||
|
|
|
@ -272,7 +272,7 @@ FreeSavedImages(GifFileType * GifFile) {
|
|||
static int
|
||||
DGifGetScreenDesc(GifFileType * GifFile) {
|
||||
|
||||
int i, BitsPerPixel;
|
||||
int i, BitsPerPixel, SortFlag;
|
||||
GifByteType Buf[3];
|
||||
|
||||
/* Put the screen descriptor into the file: */
|
||||
|
@ -284,6 +284,7 @@ DGifGetScreenDesc(GifFileType * GifFile) {
|
|||
return GIF_ERROR;
|
||||
}
|
||||
GifFile->SColorResolution = (((Buf[0] & 0x70) + 1) >> 4) + 1;
|
||||
SortFlag = (Buf[0] & 0x08) != 0;
|
||||
BitsPerPixel = (Buf[0] & 0x07) + 1;
|
||||
GifFile->SBackGroundColor = Buf[1];
|
||||
GifFile->SAspectRatio = Buf[2];
|
||||
|
@ -295,6 +296,7 @@ DGifGetScreenDesc(GifFileType * GifFile) {
|
|||
}
|
||||
|
||||
/* Get the global color map: */
|
||||
GifFile->SColorMap->SortFlag = SortFlag;
|
||||
for (i = 0; i < GifFile->SColorMap->ColorCount; i++) {
|
||||
if (READ(GifFile, Buf, 3) != 3) {
|
||||
FreeMapObject(GifFile->SColorMap);
|
||||
|
@ -353,7 +355,7 @@ DGifGetRecordType(GifFileType * GifFile,
|
|||
static int
|
||||
DGifGetImageDesc(GifFileType * GifFile) {
|
||||
|
||||
int i, BitsPerPixel;
|
||||
int i, BitsPerPixel, SortFlag;
|
||||
GifByteType Buf[3];
|
||||
GifFilePrivateType *Private = GifFile->Private;
|
||||
SavedImage *sp;
|
||||
|
@ -367,6 +369,7 @@ DGifGetImageDesc(GifFileType * GifFile) {
|
|||
return GIF_ERROR;
|
||||
}
|
||||
BitsPerPixel = (Buf[0] & 0x07) + 1;
|
||||
SortFlag = (Buf[0] & 0x20) != 0;
|
||||
GifFile->Image.Interlace = (Buf[0] & 0x40);
|
||||
if (Buf[0] & 0x80) { /* Does this image have local color map? */
|
||||
|
||||
|
@ -381,6 +384,7 @@ DGifGetImageDesc(GifFileType * GifFile) {
|
|||
}
|
||||
|
||||
/* Get the image local color map: */
|
||||
GifFile->Image.ColorMap->SortFlag = SortFlag;
|
||||
for (i = 0; i < GifFile->Image.ColorMap->ColorCount; i++) {
|
||||
if (READ(GifFile, Buf, 3) != 3) {
|
||||
FreeMapObject(GifFile->Image.ColorMap);
|
||||
|
@ -417,6 +421,7 @@ DGifGetImageDesc(GifFileType * GifFile) {
|
|||
if (sp->ImageDesc.ColorMap == NULL) {
|
||||
return GIF_ERROR;
|
||||
}
|
||||
sp->ImageDesc.ColorMap->SortFlag = GifFile->Image.ColorMap->SortFlag;
|
||||
}
|
||||
sp->RasterBits = NULL;
|
||||
sp->ExtensionBlockCount = 0;
|
||||
|
|
|
@ -88,6 +88,7 @@ typedef struct GifColorType {
|
|||
typedef struct ColorMapObject {
|
||||
int ColorCount;
|
||||
int BitsPerPixel;
|
||||
int SortFlag;
|
||||
GifColorType *Colors;
|
||||
} ColorMapObject;
|
||||
|
||||
|
|
Loading…
Reference in New Issue