浏览代码

+ Patch from Juergen Rathlev to remove use of QWord. Fixes bug #4117

git-svn-id: trunk@859 -
michael 20 年之前
父节点
当前提交
3ab45b5b19
共有 1 个文件被更改,包括 29 次插入24 次删除
  1. 29 24
      fcl/image/fpreadpng.pp

+ 29 - 24
fcl/image/fpreadpng.pp

@@ -1,4 +1,5 @@
 {
 {
+    $Id: fpreadpng.pp,v 1.10 2003/10/19 21:09:51 luk Exp $
     This file is part of the Free Pascal run time library.
     This file is part of the Free Pascal run time library.
     Copyright (c) 2003 by the Free Pascal development team
     Copyright (c) 2003 by the Free Pascal development team
 
 
@@ -518,7 +519,7 @@ end;
 function TFPReaderPNG.ColorGrayAlpha16 (CD:TColorData) : TFPColor;
 function TFPReaderPNG.ColorGrayAlpha16 (CD:TColorData) : TFPColor;
 var c : word;
 var c : word;
 begin
 begin
-  c := (CD and qword($FFFF0000)) shr 16;
+  c := (CD shr 16) and $FFFF;
   with result do
   with result do
     begin
     begin
     red := c;
     red := c;
@@ -535,56 +536,59 @@ begin
     begin
     begin
     c := CD and $FF;
     c := CD and $FF;
     red := c + (c shl 8);
     red := c + (c shl 8);
-    c := CD and $FF00;
-    green := c + (c shr 8);
-    c := (CD and $FF0000) shr 8;
-    blue := c + (c shr 8);
+    CD:=CD shr 8;
+    c := CD and $FF;
+    green := c + (c shl 8);
+    CD:=CD shr 8;
+    c := CD and $FF;
+    blue := c + (c shl 8);
     alpha := alphaOpaque;
     alpha := alphaOpaque;
     end;
     end;
 end;
 end;
 
 
 function TFPReaderPNG.ColorColor16 (CD:TColorData) : TFPColor;
 function TFPReaderPNG.ColorColor16 (CD:TColorData) : TFPColor;
-var c : qword;
 begin
 begin
   with result do
   with result do
     begin
     begin
     red := CD and $FFFF;
     red := CD and $FFFF;
-    c := qword($FFFF0000);
-    green := (CD and c) shr 16;
-    c := c shl 16;
-    blue := (CD and c) shr 32;
+    CD:=CD shr 16;
+    green := CD and $FFFF;
+    CD:=CD shr 16;
+    blue := CD and $FFFF;
     alpha := alphaOpaque;
     alpha := alphaOpaque;
     end;
     end;
 end;
 end;
 
 
 function TFPReaderPNG.ColorColorAlpha8 (CD:TColorData) : TFPColor;
 function TFPReaderPNG.ColorColorAlpha8 (CD:TColorData) : TFPColor;
-var c : qword;
+var c : word;
 begin
 begin
   with result do
   with result do
     begin
     begin
     c := CD and $FF;
     c := CD and $FF;
     red := c + (c shl 8);
     red := c + (c shl 8);
-    c := CD and $FF00;
-    green := c + (c shr 8);
-    c := (CD and $FF0000) shr 8;
-    blue := c + (c shr 8);
-    c := (CD and qword($FF000000)) shr 16;
-    alpha := c + (c shr 8);
+    CD:=CD shr 8;
+    c := CD and $FF;
+    green := c + (c shl 8);
+    CD:=CD shr 8;
+    c := CD and $FF;
+    blue := c + (c shl 8);
+    CD:=CD shr 8;
+    c := CD and $FF;
+    alpha := c + (c shl 8);
     end;
     end;
 end;
 end;
 
 
 function TFPReaderPNG.ColorColorAlpha16 (CD:TColorData) : TFPColor;
 function TFPReaderPNG.ColorColorAlpha16 (CD:TColorData) : TFPColor;
-var c : qword;
 begin
 begin
   with result do
   with result do
     begin
     begin
     red := CD and $FFFF;
     red := CD and $FFFF;
-    c := qword($FFFF0000);
-    green := (CD and c) shr 16;
-    c := c shl 16;
-    blue := (CD and c) shr 32;
-    c := c shl 16;
-    alpha := (CD and c) shr 48;
+    CD:=CD shr 16;
+    green := CD and $FFFF;
+    CD:=CD shr 16;
+    blue := CD and $FFFF;
+    CD:=CD shr 16;
+    alpha := CD and $FFFF;
     end;
     end;
 end;
 end;
 
 
@@ -830,3 +834,4 @@ end;
 initialization
 initialization
   ImageHandlers.RegisterImageReader ('Portable Network Graphics', 'png', TFPReaderPNG);
   ImageHandlers.RegisterImageReader ('Portable Network Graphics', 'png', TFPReaderPNG);
 end.
 end.
+