Browse Source

* Committed patch from Mantis 13331. gif is indeed always little endian.
Also added registration reader part of patch, since other readers do too.

git-svn-id: trunk@12996 -

marco 16 years ago
parent
commit
ba10015c04
1 changed files with 20 additions and 2 deletions
  1. 20 2
      packages/fcl-image/src/fpreadgif.pas

+ 20 - 2
packages/fcl-image/src/fpreadgif.pas

@@ -192,7 +192,15 @@ begin
     Stream.Read(FHeader,SizeOf(FHeader));
     Progress(psRunning, trunc(100.0 * (Stream.position / Stream.size)), False, Rect(0,0,0,0), '', ContProgress);
     if not ContProgress then exit;
-
+     
+    // Endian Fix Mantis 8541. Gif is always little endian
+    {$IFDEF ENDIAN_BIG}    
+      with FHeader do 
+        begin
+          ScreenWidth := LEtoN(ScreenWidth);
+          ScreenHeight := LEtoN(ScreenHeight);
+        end; 
+    {$ENDIF}
     // global palette
     if (FHeader.Packedbit and $80) <> 0 then
     begin
@@ -207,7 +215,15 @@ begin
 
     // descriptor
     Stream.Read(FDescriptor, SizeOf(FDescriptor));
-
+    {$IFDEF ENDIAN_BIG}
+      with FDescriptor do 
+        begin
+          Left := LEtoN(Left);
+          Top := LEtoN(Top);
+          Width := LEtoN(Width);
+          Height := LEtoN(Height);
+        end;
+    {$ENDIF}
     // local palette
     if (FDescriptor.Packedbit and $80) <> 0 then
     begin
@@ -522,5 +538,7 @@ begin
   inherited Destroy;
 end;
 
+initialization
+  ImageHandlers.RegisterImageReader ('GIF Graphics', 'gif', TFPReaderGif);
 end.