mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-29 10:52:22 +02:00
* Implemented minimalistic PixelFormat dependency when creating rawimage description (Mono|RGB|Alpha) (fixes #11672)
* Forced full rawimage data before copying date when unsharing bitmap (sideeffect notices in #11672) git-svn-id: trunk@15804 -
This commit is contained in:
parent
00f660ac0c
commit
210a124450
@ -113,6 +113,7 @@ procedure TCustomBitmap.RawimageNeeded(ADescOnly: Boolean);
|
|||||||
var
|
var
|
||||||
OldChangeEvent: TNotifyEvent;
|
OldChangeEvent: TNotifyEvent;
|
||||||
ImagePtr: PRawImage;
|
ImagePtr: PRawImage;
|
||||||
|
Flags: TRawImageQueryFlags;
|
||||||
begin
|
begin
|
||||||
ImagePtr := @TSharedCustomBitmap(FSharedImage).FImage;
|
ImagePtr := @TSharedCustomBitmap(FSharedImage).FImage;
|
||||||
if ImagePtr^.Description.Format <> ricfNone
|
if ImagePtr^.Description.Format <> ricfNone
|
||||||
@ -137,7 +138,18 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// keep size
|
// keep size
|
||||||
ImagePtr^.Description := GetDescriptionFromDevice(0, ImagePtr^.Description.Width, ImagePtr^.Description.Height);
|
// ImagePtr^.Description := GetDescriptionFromDevice(0, ImagePtr^.Description.Width, ImagePtr^.Description.Height);
|
||||||
|
// use query to get a default description without alpha, since alpha drawing
|
||||||
|
// is not yet supported (unless asked for)
|
||||||
|
case PixelFormat of
|
||||||
|
pf1bit: Flags := [riqfMono, riqfMask];
|
||||||
|
pf4bit,
|
||||||
|
pf8bit: Flags := [riqfRGB, riqfMask, riqfPalette];
|
||||||
|
pf32bit: Flags := [riqfRGB, riqfMask, riqfAlpha];
|
||||||
|
else
|
||||||
|
Flags := [riqfRGB, riqfMask];
|
||||||
|
end;
|
||||||
|
ImagePtr^.Description := QueryDescription(Flags, ImagePtr^.Description.Width, ImagePtr^.Description.Height);
|
||||||
Exit;
|
Exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -307,7 +319,11 @@ begin
|
|||||||
try
|
try
|
||||||
NewImage.Reference;
|
NewImage.Reference;
|
||||||
if CopyContent and OldImage.ImageAllocated
|
if CopyContent and OldImage.ImageAllocated
|
||||||
then OldImage.FImage.ExtractRect(Rect(0, 0, Width, Height), NewImage.FImage);
|
then begin
|
||||||
|
// force a complete rawimage, so we can copy it
|
||||||
|
RawimageNeeded(False);
|
||||||
|
OldImage.FImage.ExtractRect(Rect(0, 0, Width, Height), NewImage.FImage);
|
||||||
|
end;
|
||||||
|
|
||||||
FreeCanvasContext;
|
FreeCanvasContext;
|
||||||
FSharedImage := NewImage;
|
FSharedImage := NewImage;
|
||||||
|
Loading…
Reference in New Issue
Block a user