mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-09 20:38:29 +02:00
* fixed maskhandlecreation before bitmaphandle was created
git-svn-id: trunk@16248 -
This commit is contained in:
parent
6dac5ad9bc
commit
97be08d811
@ -106,10 +106,44 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCustomBitmap.MaskHandleNeeded;
|
procedure TCustomBitmap.MaskHandleNeeded;
|
||||||
|
var
|
||||||
|
ImagePtr: PRawImage;
|
||||||
|
MaskImage: TRawImage;
|
||||||
|
msk, dummy: HBITMAP;
|
||||||
begin
|
begin
|
||||||
if FMaskHandle <> 0 then Exit;
|
if FMaskHandle <> 0 then Exit;
|
||||||
if Masked
|
if not Masked then Exit;
|
||||||
then CreateMask;
|
|
||||||
|
if not BitmapHandleAllocated
|
||||||
|
then BitmapHandleNeeded; // create together with bitmaphandle
|
||||||
|
if FMaskHandle <> 0 then Exit;
|
||||||
|
|
||||||
|
ImagePtr := GetRawImagePtr;
|
||||||
|
if ImagePtr^.Description.Format = ricfNone then Exit;
|
||||||
|
|
||||||
|
// check if we have mask data
|
||||||
|
if (ImagePtr^.Description.MaskBitsPerPixel <> 0)
|
||||||
|
and (ImagePtr^.Mask <> nil)
|
||||||
|
and (ImagePtr^.MaskSize <> 0)
|
||||||
|
then begin
|
||||||
|
// move mask to image data, so we only have to create one handle
|
||||||
|
// (and don't have to think about imahehandle format)
|
||||||
|
|
||||||
|
MaskImage.Description := ImagePtr^.Description.GetDescriptionFromMask;
|
||||||
|
MaskImage.DataSize := ImagePtr^.MaskSize;
|
||||||
|
MaskImage.Data := ImagePtr^.Mask;
|
||||||
|
|
||||||
|
if RawImage_CreateBitmaps(MaskImage, msk, dummy, False)
|
||||||
|
then begin
|
||||||
|
if BitmapHandleAllocated
|
||||||
|
then UpdateHandles(BitmapHandle, msk)
|
||||||
|
else UpdateHandles(0, msk);
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
// no data, create ourselves
|
||||||
|
CreateMask;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomBitmap.PaletteAllocated: boolean;
|
function TCustomBitmap.PaletteAllocated: boolean;
|
||||||
|
Loading…
Reference in New Issue
Block a user