From: ShadowFlare Date: Sat, 18 Aug 2007 22:43:18 +0000 (+0000) Subject: Fixed bug in decompressed frame detection X-Git-Url: https://sfsrealm.hopto.org/projects/?a=commitdiff_plain;h=ff9de648cc9c9047adad171820f164810497f753;p=grpapi.git Fixed bug in decompressed frame detection --- diff --git a/grpapi/grpapi.cpp b/grpapi/grpapi.cpp index d206614..20d0c06 100644 --- a/grpapi/grpapi.cpp +++ b/grpapi/grpapi.cpp @@ -223,24 +223,33 @@ BOOL GRPAPI WINAPI DrawGrp(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WOR BYTE *GrpRaw = (BYTE *)GrpOffsets; BYTE *RowData; WORD x,ofs; - DWORD y; + DWORD y, nMaxOffset = 0; WORD i; - int j; - if (nFrame + 1 < GrpFile->nFrames) { - for (i = 0; i + 1 < GrpFile->nFrames; i++) { - j = GrpFrames[i].Offset - GrpFrame->Offset; - if (j > 0 && j < FrameSize) - FrameSize = j; - } + int j, nFirstNonBlankFrame = 0; + for (i = 0; i < GrpFile->nFrames; i++) { + j = GrpFrames[i].Offset - GrpFrame->Offset; + if (j > 0 && j < FrameSize) + FrameSize = j; + if (GrpFrames[i].Offset > nMaxOffset) + nMaxOffset = GrpFrames[i].Offset; } if (FrameSize == 0xFFFFFF || FrameSize == GrpFrame->Width * GrpFrame->Height) { FrameSize = 0xFFFFFF; - for (i = 0; i + 1 < GrpFile->nFrames; i++) { - j = GrpFrames[i].Offset - GrpFrames[0].Offset; + for (i = 0; i < GrpFile->nFrames; i++) { + if (GrpFrames[i].Width != 0 && GrpFrames[i].Height != 0 && GrpFrames[i].Offset != GrpFrame->Offset && GrpFrames[i].Offset != nMaxOffset) { + nFirstNonBlankFrame = i; + break; + } + } + if (i == GrpFile->nFrames) + nFirstNonBlankFrame = nFrame; + + for (i = 0; i < GrpFile->nFrames; i++) { + j = GrpFrames[i].Offset - GrpFrames[nFirstNonBlankFrame].Offset; if (j > 0 && j < FrameSize) FrameSize = j; } - if (FrameSize == GrpFrames[0].Width * GrpFrames[0].Height) + if (FrameSize == GrpFrames[nFirstNonBlankFrame].Width * GrpFrames[nFirstNonBlankFrame].Height) FrameSize = GrpFrame->Width * GrpFrame->Height; } if (!(dwFlags&HORIZONTAL_FLIP) && !(dwFlags&VERTICAL_FLIP)) { diff --git a/grpapi/grpapi.rc b/grpapi/grpapi.rc index 30a813d..13a4ade 100644 --- a/grpapi/grpapi.rc +++ b/grpapi/grpapi.rc @@ -53,8 +53,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,1,1,3 - PRODUCTVERSION 1,1,1,3 + FILEVERSION 1,1,1,4 + PRODUCTVERSION 1,1,1,4 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -73,11 +73,11 @@ BEGIN VALUE "FileDescription", "ShadowFlare GRP Library" VALUE "FileVersion", "1.11" VALUE "InternalName", "grpapi" - VALUE "LegalCopyright", "Copyright © ShadowFlare Software 2002-2006" + VALUE "LegalCopyright", "Copyright © ShadowFlare Software 2002-2007" VALUE "OriginalFilename", "grpapi.dll" VALUE "ProductName", "GRP Library" - VALUE "ProductVersion", "1, 1, 1, 3" - VALUE "Web Address", "http://shadowflare.samods.org/" + VALUE "ProductVersion", "1, 1, 1, 4" + VALUE "Web Address", "http://sfsrealm.hopto.org/" END END BLOCK "VarFileInfo"