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
@@ -439,7 +439,7 @@ void __inline SetPix(HDC hDC, int X, int Y, COLORREF clrColor, DWORD *dwPalette,
MySetPixel(hDC,X,Y,clrColor);\r
}\r
\r
-HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, DWORD *nGrpSize)\r
+HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize)\r
{\r
GRPHEADER GrpHeader;\r
FRAMEHEADER *lpFrameHeaders;\r
@@ -496,15 +496,20 @@ HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMa
lpFrameHeaders[i].Width = x2 - x1 + 1;\r
lpFrameHeaders[i].Height = y2 - y1 + 1;\r
\r
- EncodeFrameData(lpImageData, i, &GrpHeader, &lpFrameHeaders[i], &lpFrameData[i]);\r
+ if (!bNoCompress) {\r
+ EncodeFrameData(lpImageData, i, &GrpHeader, &lpFrameHeaders[i], &lpFrameData[i]);\r
\r
- y = lpFrameHeaders[i].Height;\r
- if (y > 0) {\r
- y--;\r
- nLastOffset = lpFrameHeaders[i].Offset + lpFrameData[i].lpRowOffsets[y] + lpFrameData[i].lpRowSizes[y];\r
+ y = lpFrameHeaders[i].Height;\r
+ if (y > 0) {\r
+ y--;\r
+ nLastOffset = lpFrameHeaders[i].Offset + lpFrameData[i].lpRowOffsets[y] + lpFrameData[i].lpRowSizes[y];\r
+ }\r
+ else {\r
+ nLastOffset = lpFrameHeaders[i].Offset;\r
+ }\r
}\r
else {\r
- nLastOffset = lpFrameHeaders[i].Offset;\r
+ nLastOffset = lpFrameHeaders[i].Offset + lpFrameHeaders[i].Width * lpFrameHeaders[i].Height;\r
}\r
}\r
\r
@@ -516,18 +521,28 @@ HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMa
\r
for (i = 0; i < nFrames; i++) {\r
if (lpFrameData[i].lpRowOffsets) {\r
- memcpy(lpGrpData + lpFrameHeaders[i].Offset, lpFrameData[i].lpRowOffsets, lpFrameHeaders[i].Height * sizeof(WORD));\r
+ if (!bNoCompress) {\r
+ memcpy(lpGrpData + lpFrameHeaders[i].Offset, lpFrameData[i].lpRowOffsets, lpFrameHeaders[i].Height * sizeof(WORD));\r
\r
- for (y = 0; y < lpFrameHeaders[i].Height; y++) {\r
- if (lpFrameData[i].lpRowData[y]) {\r
- memcpy(lpGrpData + lpFrameHeaders[i].Offset + lpFrameData[i].lpRowOffsets[y], lpFrameData[i].lpRowData[y], lpFrameData[i].lpRowSizes[y]);\r
- free(lpFrameData[i].lpRowData[y]);\r
+ for (y = 0; y < lpFrameHeaders[i].Height; y++) {\r
+ if (lpFrameData[i].lpRowData[y]) {\r
+ memcpy(lpGrpData + lpFrameHeaders[i].Offset + lpFrameData[i].lpRowOffsets[y], lpFrameData[i].lpRowData[y], lpFrameData[i].lpRowSizes[y]);\r
+ free(lpFrameData[i].lpRowData[y]);\r
+ }\r
}\r
- }\r
\r
- free(lpFrameData[i].lpRowOffsets);\r
- free(lpFrameData[i].lpRowSizes);\r
- free(lpFrameData[i].lpRowData);\r
+ free(lpFrameData[i].lpRowOffsets);\r
+ free(lpFrameData[i].lpRowSizes);\r
+ free(lpFrameData[i].lpRowData);\r
+ }\r
+ else {\r
+ for (y = 0; y < lpFrameHeaders[i].Height; y++) {\r
+ for (x = 0; x < lpFrameHeaders[i].Width; x++) {\r
+ lpGrpData[lpFrameHeaders[i].Offset + y * lpFrameHeaders[i].Width + x] =\r
+ lpImageData[i * wMaxWidth * wMaxHeight + (lpFrameHeaders[i].Top + y) * wMaxWidth + lpFrameHeaders[i].Left + x];\r
+ }\r
+ }\r
+ }\r
}\r
}\r
\r
@@ -553,7 +568,7 @@ void EncodeFrameData(signed short *lpImageData, WORD nFrame, GRPHEADER *lpGrpHea
i = nFrame * lpGrpHeader->wMaxWidth * lpGrpHeader->wMaxHeight + (lpFrameHeader->Top + y) * lpGrpHeader->wMaxWidth;\r
\r
/* Fails verification when using this. Bug in encoder or decoder? Doesn't provide much benefit.\r
- // Search for duplicate rows\r
+ // Search for duplicate rows (experimental)\r
for (x = 0; x < y; x++) {\r
j = nFrame * lpGrpHeader->wMaxWidth * lpGrpHeader->wMaxHeight + (lpFrameHeader->Top + x) * lpGrpHeader->wMaxWidth;\r
if (memcmp(&lpImageData[i+lpFrameHeader->Left],\r
diff --git a/grpapi/grpapi.h b/grpapi/grpapi.h
--- a/grpapi/grpapi.h
+++ b/grpapi/grpapi.h
BOOL GRPAPI WINAPI DrawGrp(HANDLE hGrp, HDC hdcDest, int nXDest, int nYDest, WORD nFrame, DWORD *dwPalette, DWORD dwFlags, DWORD dwAlpha);\r
BOOL GRPAPI WINAPI GetGrpInfo(HANDLE hGrp, GRPHEADER *GrpInfo);\r
\r
-HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, DWORD *nGrpSize);\r
+HANDLE GRPAPI WINAPI CreateGrp(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize);\r
\r
typedef COLORREF (WINAPI* GETPIXELPROC)(\r
HDC hDC, // same value as hdcDest from DrawGrp,\r
diff --git a/grpapi/grpapi_no-lib.h b/grpapi/grpapi_no-lib.h
--- a/grpapi/grpapi_no-lib.h
+++ b/grpapi/grpapi_no-lib.h
extern funcDrawGrp DrawGrp;\r
extern funcGetGrpInfo GetGrpInfo;\r
\r
-typedef HANDLE (WINAPI* funcCreateGrp)(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, DWORD *nGrpSize);\r
+typedef HANDLE (WINAPI* funcCreateGrp)(signed short *lpImageData, WORD nFrames, WORD wMaxWidth, WORD wMaxHeight, BOOL bNoCompress, DWORD *nGrpSize);\r
extern funcCreateGrp CreateGrp;\r
\r
typedef COLORREF (WINAPI* GETPIXELPROC)(\r
|