checksum immediately after loading because surface2tex does surface manipulation. also add some FIXMEs
authornemo
Wed, 25 Oct 2017 19:44:42 -0400
changeset 12770 d01e9dd5c439
parent 12769 272fcd3833d2
child 12771 a409da7276de
checksum immediately after loading because surface2tex does surface manipulation. also add some FIXMEs
hedgewars/uStore.pas
hedgewars/uTextures.pas
--- a/hedgewars/uStore.pas	Wed Oct 25 23:47:07 2017 +0200
+++ b/hedgewars/uStore.pas	Wed Oct 25 19:44:42 2017 -0400
@@ -417,7 +417,10 @@
                     imflags := (imflags or ifCritical);
 
                 // load the image
-                tmpsurf := LoadDataImageAltPath(Path, AltPath, FileName, imflags)
+                tmpsurf := LoadDataImageAltPath(Path, AltPath, FileName, imflags);
+                if (tmpsurf <> nil) and checkSum then
+                    for y := 0 to tmpsurf^.h-1 do
+                        syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(tmpsurf^.pixels)^[y*tmpsurf^.pitch], tmpsurf^.w*4)
                 end;
 
             if tmpsurf <> nil then
@@ -471,10 +474,6 @@
 {$IFDEF USE_CONTEXT_RESTORE}
                     Surface:= tmpsurf
 {$ELSE}
-                    if checkSum then
-                        for y := 0 to tmpsurf^.h-1 do
-                            syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(tmpsurf^.pixels)^[y*tmpsurf^.pitch], tmpsurf^.w*4);
-
                     if saveSurf then
                         Surface:= tmpsurf
                     else
--- a/hedgewars/uTextures.pas	Wed Oct 25 23:47:07 2017 +0200
+++ b/hedgewars/uTextures.pas	Wed Oct 25 19:44:42 2017 -0400
@@ -244,9 +244,11 @@
 
 fromP4:= Surf^.pixels;
 
+// FIXME move out of surface2tex
 if GrayScale then
     Surface2GrayScale(Surf);
 
+// FIXME move out of surface2tex
 PrettifySurfaceAlpha(surf, fromP4);
 
 if (not SupportNPOTT) and (not (isPowerOf2(Surf^.w) and isPowerOf2(Surf^.h))) then