copy alpha extraction to the other digest computation
authoralfadur
Mon, 19 Aug 2019 18:48:11 +0300
changeset 15364 ae4c5738e8cb
parent 15363 0230c4766aa6
child 15365 9fca575e3c88
copy alpha extraction to the other digest computation
hedgewars/uStore.pas
--- a/hedgewars/uStore.pas	Mon Aug 19 11:41:59 2019 -0400
+++ b/hedgewars/uStore.pas	Mon Aug 19 18:48:11 2019 +0300
@@ -385,7 +385,8 @@
 var ii: TSprite;
     ai: TAmmoType;
     tmpsurf, tmpoverlay: PSDL_Surface;
-    i, y, imflags: LongInt;
+    i, y, x, imflags: LongInt;
+    rowData: PByte;
     keyConfirm, keyQuit: shortstring;
 begin
 AddFileLog('StoreLoad()');
@@ -432,11 +433,17 @@
                 // load the image
                 tmpsurf := LoadDataImageAltPath(Path, AltPath, FileName, imflags);
                 if (tmpsurf <> nil) and checkSum then
+                    begin
+                    rowData := GetMem(tmpsurf^.w);
                     for y := 0 to tmpsurf^.h-1 do
                         begin
-                        syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(tmpsurf^.pixels)^[y*tmpsurf^.pitch], tmpsurf^.w*4);
+                        for x := 0 to tmpsurf^.w - 1 do
+                            (rowData + x)^:= (PByte(tmpsurf^.pixels) + y * tmpsurf^.pitch + x * 4 + AByteIndex)^;
+                        syncedPixelDigest:= Adler32Update(syncedPixelDigest, rowData, tmpsurf^.w);
                         AddFileLog(FileName + ': ' + IntToStr(syncedPixelDigest));
                         end;
+                    FreeMem(rowData, tmpsurf^.w);
+                    end;
                 end;
 
             if tmpsurf <> nil then