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:
paul 2007-11-21 03:20:48 +00:00
parent e38ed63108
commit dd774d76b7

View File

@ -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);