From eec4c8208622e8c3f5aa421cdb1631576d4c08d2 Mon Sep 17 00:00:00 2001 From: Bergmann89 Date: Thu, 6 Feb 2014 17:50:40 +0100 Subject: [PATCH] * load PNG direct over TLazIntfImage and TLazReaderPNG instead of TPortableNetworkGraphic --- glBitmap.pas | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/glBitmap.pas b/glBitmap.pas index 1e95efa..ea47607 100644 --- a/glBitmap.pas +++ b/glBitmap.pas @@ -5751,7 +5751,7 @@ const MAGIC_LEN = 8; PNG_MAGIC: String[MAGIC_LEN] = #$89#$50#$4E#$47#$0D#$0A#$1A#$0A; var - png: TPortableNetworkGraphic; + reader: TLazReaderPNG; intf: TLazIntfImage; StreamPos: Int64; magic: String[MAGIC_LEN]; @@ -5767,27 +5767,20 @@ begin exit; end; - png := TPortableNetworkGraphic.Create; + intf := TLazIntfImage.Create(0, 0); + reader := TLazReaderPNG.Create; try try - png.LoadFromStream(aStream); - intf := png.CreateIntfImage; - try try - AssignFromLazIntfImage(intf); - except - result := false; - aStream.Position := StreamPos; - exit; - end; - finally - intf.Free; - end; + reader.UpdateDescription := true; + reader.ImageRead(aStream, intf); + AssignFromLazIntfImage(intf); except result := false; aStream.Position := StreamPos; exit; end; finally - png.Free; + reader.Free; + intf.Free; end; end; -- 2.1.4