Current News Archived News Search News Discussion Forum Old Forum Install Programs More Downloads... Troubleshooting Source Code Format Specs. Misc. Information Non-SF Stuff Links Small banner for links to this site: |
diff --git a/grpapi/grpapi.cpp b/grpapi/grpapi.cpp
--- a/grpapi/grpapi.cpp
+++ b/grpapi/grpapi.cpp
@@ -525,20 +525,18 @@ HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMa
lpFrameHeaders[i].Width = x2;\r
lpFrameHeaders[i].Height = y2;\r
\r
- EncodeFrameData(lpImageData, i, &GrpHeader, &lpFrameHeaders[i], &lpFrameData[i], bNoCompress);\r
-\r
// Search for duplicate frames\r
for (j = 0; j < i; j++) {\r
- if (lpFrameData[j].lpRowOffsets && lpFrameHeaders[i].Width == lpFrameHeaders[j].Width && lpFrameHeaders[i].Height == lpFrameHeaders[j].Height && lpFrameData[i].Size == lpFrameData[j].Size) {\r
- for (y = 0; y < lpFrameHeaders[i].Height; y++) {\r
- if (!lpFrameData[i].lpRowData[y] && !lpFrameData[j].lpRowData[y])\r
- continue;\r
+ if (lpFrameData[j].lpRowOffsets && lpFrameHeaders[i].Width == lpFrameHeaders[j].Width && lpFrameHeaders[i].Height == lpFrameHeaders[j].Height) {\r
+ y1 = i * wMaxWidth * wMaxHeight + lpFrameHeaders[i].Top * wMaxWidth + lpFrameHeaders[i].Left;\r
+ y2 = j * wMaxWidth * wMaxHeight + lpFrameHeaders[j].Top * wMaxWidth + lpFrameHeaders[j].Left;\r
\r
- if ((!lpFrameData[i].lpRowData[y] && lpFrameData[j].lpRowData[y]) || (lpFrameData[i].lpRowData[y] && !lpFrameData[j].lpRowData[y]) || lpFrameData[i].lpRowSizes[y] != lpFrameData[j].lpRowSizes[y])\r
+ for (y = 0; y < lpFrameHeaders[i].Height; y++) {\r
+ if (memcmp(&lpImageData[y1], &lpImageData[y2], lpFrameHeaders[i].Width * sizeof(short)) != 0)\r
break;\r
\r
- if (memcmp(lpFrameData[i].lpRowData[y], lpFrameData[j].lpRowData[y], lpFrameData[i].lpRowSizes[y]) != 0)\r
- break;\r
+ y1 += wMaxWidth;\r
+ y2 += wMaxWidth;\r
}\r
\r
if (y == lpFrameHeaders[i].Height) {\r
@@ -548,17 +546,7 @@ HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMa
}\r
\r
if (j < i) {\r
- // Duplicate frame found, free stored frame data and change offset\r
- for (y = 0; y < lpFrameHeaders[i].Height; y++) {\r
- if (lpFrameData[i].lpRowData[y]) {\r
- free(lpFrameData[i].lpRowData[y]);\r
- }\r
- }\r
-\r
- free(lpFrameData[i].lpRowOffsets);\r
- free(lpFrameData[i].lpRowSizes);\r
- free(lpFrameData[i].lpRowData);\r
-\r
+ // Duplicate frame found, set offset and flag as duplicate\r
lpFrameHeaders[i].Offset = lpFrameHeaders[j].Offset;\r
lpFrameData[i].lpRowOffsets = 0;\r
lpFrameData[i].lpRowSizes = 0;\r
@@ -567,6 +555,7 @@ HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMa
continue;\r
}\r
\r
+ EncodeFrameData(lpImageData, i, &GrpHeader, &lpFrameHeaders[i], &lpFrameData[i], bNoCompress);\r
nLastOffset = lpFrameHeaders[i].Offset + lpFrameData[i].Size;\r
}\r
\r
|