The attached fixes a 32 bit overflow problem when writing PNG files
using 16 bits per colour
Colin
diff -uNr trunk/fpcsrc/fcl/image/fpwritepng.pp trunk.w/fpcsrc/fcl/image/fpwritepng.pp
--- trunk/fpcsrc/fcl/image/fpwritepng.pp 2005-06-11 09:58:32.000000000 +0100
+++ trunk.w/fpcsrc/fcl/image/fpwritepng.pp 2005-06-25 13:09:55.000000000 +0100
@@ -472,7 +472,7 @@
function TFPWriterPNG.ColorDataColorW(color:TFPColor) : TColorData;
begin
with color do
- result := red + (green shl 16) + (blue shl 32);
+ result := red + (green shl 16) + (qword(blue) shl 32);
end;
function TFPWriterPNG.ColorDataColorAB(color:TFPColor) : TColorData;
@@ -484,7 +484,7 @@
function TFPWriterPNG.ColorDataColorAW(color:TFPColor) : TColorData;
begin
with color do
- result := red + (green shl 16) + (blue shl 32) + (alpha shl 48);
+ result := red + (green shl 16) + (qword(blue) shl 32) + (qword(alpha) shl 48);
end;
{ Data making routines }
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
http://lists.freepascal.org/mailman/listinfo/fpc-devel