summaryrefslogtreecommitdiff
path: root/src/corelib/fpg_imgfmt_png.pas
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graemeg@gmail.com>2014-08-20 02:11:13 +0100
committerGraeme Geldenhuys <graemeg@gmail.com>2014-08-20 02:11:13 +0100
commitc8acc2c1666015daeb3038c838e5018c0ecd8903 (patch)
tree5ad2edaf0e5fb6be146491226dca4d915333d80d /src/corelib/fpg_imgfmt_png.pas
parentc45010b6370b50f8e6192ddb7dc3d7762c8c29f7 (diff)
parentd0d8573b046e5020d05c86a970d303084de19b7d (diff)
downloadfpGUI-c8acc2c1666015daeb3038c838e5018c0ecd8903.tar.xz
Merge branch 'release-1.2' into master
Diffstat (limited to 'src/corelib/fpg_imgfmt_png.pas')
-rw-r--r--src/corelib/fpg_imgfmt_png.pas12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/corelib/fpg_imgfmt_png.pas b/src/corelib/fpg_imgfmt_png.pas
index c95150e4..3148a5b4 100644
--- a/src/corelib/fpg_imgfmt_png.pas
+++ b/src/corelib/fpg_imgfmt_png.pas
@@ -1,7 +1,7 @@
{
fpGUI - Free Pascal GUI Toolkit
- Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this
+ Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this
distribution, for details of the copyright.
See the file COPYING.modifiedLGPL, included in this distribution,
@@ -68,6 +68,7 @@ end;
function LoadImage_PNG(const AFileName: TfpgString): TfpgImage;
var
imga: TFPCustomImage;
+ PNGReader: TFPReaderPNG;
begin
Result := nil;
if not fpgFileExists(AFileName) then
@@ -75,7 +76,12 @@ begin
imga := TFPMemoryImage.Create(0, 0);
try
- imga.LoadFromFile(AFileName, TFPReaderPNG.Create); // auto size image
+ PNGReader := TFPReaderPNG.Create;
+ try
+ imga.LoadFromFile(fpgToOSEncoding(AFileName), PNGReader); // auto size image
+ finally
+ PNGReader.Free;
+ end;
except
imga := nil;
end;
@@ -159,7 +165,7 @@ begin
// Calculated to fit the image within required size: xlocal, ylocal
imga := TFPMemoryImage.Create(0, 0);
try
- imga.LoadFromFile(AFileName, TFPReaderPNG.Create); // auto size image
+ imga.LoadFromFile(fpgToOSEncoding(AFileName), TFPReaderPNG.Create); // auto size image
except
imga := nil;
imgb := nil;