mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-05-06 23:33:37 +02:00
dont share image data between different bitmap classes (this fixes issue when you load pixmap from .xpm, then assign it to portablenetworkgraphics class and after save to .png you'll get .xpm content inside .png file)
git-svn-id: trunk@12946 -
This commit is contained in:
parent
e38ed63108
commit
dd774d76b7
@ -57,6 +57,7 @@ begin
|
||||
if Source is TBitmap
|
||||
then begin
|
||||
// TBitmap can share image data
|
||||
|
||||
// -> check if already shared
|
||||
if SrcBitmap.FImage=FImage then exit;// already sharing
|
||||
|
||||
@ -76,6 +77,15 @@ begin
|
||||
// share FImage with assigned graphic
|
||||
FImage := SrcBitmap.FImage;
|
||||
FImage.Reference;
|
||||
|
||||
// Paul: we can share image data only is ClassTypes are the same
|
||||
// if ClassTypes are differ then we should create copy of data and free save stream
|
||||
if Source.ClassType <> ClassType then
|
||||
begin
|
||||
UnshareImage(True);
|
||||
FreeSaveStream;
|
||||
end;
|
||||
|
||||
//DebugLn(['TBitMap.Assign B ',Width,',',Height,' ',HandleAllocated,' RefCount=',FImage.RefCount]);
|
||||
Changed(Self);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user