| @@ -5751,7 +5751,7 @@ const | |||||
| MAGIC_LEN = 8; | MAGIC_LEN = 8; | ||||
| PNG_MAGIC: String[MAGIC_LEN] = #$89#$50#$4E#$47#$0D#$0A#$1A#$0A; | PNG_MAGIC: String[MAGIC_LEN] = #$89#$50#$4E#$47#$0D#$0A#$1A#$0A; | ||||
| var | var | ||||
| png: TPortableNetworkGraphic; | |||||
| reader: TLazReaderPNG; | |||||
| intf: TLazIntfImage; | intf: TLazIntfImage; | ||||
| StreamPos: Int64; | StreamPos: Int64; | ||||
| magic: String[MAGIC_LEN]; | magic: String[MAGIC_LEN]; | ||||
| @@ -5767,27 +5767,20 @@ begin | |||||
| exit; | exit; | ||||
| end; | end; | ||||
| png := TPortableNetworkGraphic.Create; | |||||
| intf := TLazIntfImage.Create(0, 0); | |||||
| reader := TLazReaderPNG.Create; | |||||
| try try | 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 | except | ||||
| result := false; | result := false; | ||||
| aStream.Position := StreamPos; | aStream.Position := StreamPos; | ||||
| exit; | exit; | ||||
| end; | end; | ||||
| finally | finally | ||||
| png.Free; | |||||
| reader.Free; | |||||
| intf.Free; | |||||
| end; | end; | ||||
| end; | end; | ||||