mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 14:36:09 +02:00
cocoa: #32749. invalidating (and discarding) the original non-premultiplied data, if it has been modified by NSBitmapContext in NSImageRep. Changing bitmap handle recreation prior to drawing the bitmap. The change has been tested with samples from #28692 and #28102.
git-svn-id: trunk@56715 -
This commit is contained in:
parent
c35b4b0f90
commit
eda7fd2cd0
@ -989,6 +989,12 @@ end;
|
|||||||
|
|
||||||
procedure TCocoaBitmap.SetModified;
|
procedure TCocoaBitmap.SetModified;
|
||||||
begin
|
begin
|
||||||
|
if FOriginalData <> nil then
|
||||||
|
begin
|
||||||
|
// the original data no longer applies, as imageRep was modified
|
||||||
|
System.FreeMem(FOriginalData);
|
||||||
|
FOriginalData:=nil;
|
||||||
|
end;
|
||||||
FModified_SinceLastRecreate := True;
|
FModified_SinceLastRecreate := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2095,6 +2101,9 @@ begin
|
|||||||
if not Assigned(Bmp) then
|
if not Assigned(Bmp) then
|
||||||
Exit(False);
|
Exit(False);
|
||||||
|
|
||||||
|
// Make sure that bitmap is the most up-to-date
|
||||||
|
Bmp.ReCreateHandle_IfModified(); // Fix for bug 28102
|
||||||
|
|
||||||
if (Msk <> nil) and (Msk.Image <> nil) then
|
if (Msk <> nil) and (Msk.Image <> nil) then
|
||||||
begin
|
begin
|
||||||
MskImage := Msk.CreateMaskImage(Bounds(XMsk, YMsk, SrcWidth, SrcHeight));
|
MskImage := Msk.CreateMaskImage(Bounds(XMsk, YMsk, SrcWidth, SrcHeight));
|
||||||
@ -2110,14 +2119,12 @@ begin
|
|||||||
|
|
||||||
CGImageRelease(MskImage);
|
CGImageRelease(MskImage);
|
||||||
CGContextRestoreGState(CGContext);
|
CGContextRestoreGState(CGContext);
|
||||||
Bmp.ReCreateHandle_IfModified(); // Fix for bug 28102
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
// convert Y coordinate of the source bitmap
|
// convert Y coordinate of the source bitmap
|
||||||
YSrc := Bmp.Height - (SrcHeight + YSrc);
|
YSrc := Bmp.Height - (SrcHeight + YSrc);
|
||||||
Result := DrawImageRep(GetNSRect(X, Y, Width, Height),GetNSRect(XSrc, YSrc, SrcWidth, SrcHeight), bmp.ImageRep);
|
Result := DrawImageRep(GetNSRect(X, Y, Width, Height),GetNSRect(XSrc, YSrc, SrcWidth, SrcHeight), bmp.ImageRep);
|
||||||
Bmp.ReCreateHandle_IfModified(); // Fix for bug 28102
|
|
||||||
end;
|
end;
|
||||||
AttachedBitmap_SetModified();
|
AttachedBitmap_SetModified();
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user