lcl: don't create mask in SetTransparentColor, but remove old if exists. Create mask on demand. fixes #0011903

git-svn-id: trunk@16232 -
This commit is contained in:
paul 2008-08-25 14:53:36 +00:00
parent b955aded7a
commit f4a27a76a4
3 changed files with 9 additions and 9 deletions

View File

@ -639,15 +639,12 @@ var
begin
if AImage = nil then Exit;
// Paul: dont optimize. We need to call HandleNeeded before checking of maskhandle
// mwe: we should use MaskHandle without checking, but since TRasterImage only
// has a Transparent property and no Masked property, masks would also get
// generated for alpha images. Therefore we re rely now on the fact that a
// "native" mask handle is generated when a bitmaphandle is created.
// original stream can contain mask. it will be applied when we call BitmapHandleNeeded
// if we will not apply that mask - we can get some noise.
img := AImage.Handle;
if AMask = nil
then begin
if AImage.MaskHandleAllocated
if AImage.Masked
then msk := AImage.MaskHandle
else msk := 0;
end

View File

@ -395,7 +395,9 @@ begin
then FTransparentMode := tmAuto
else FTransparentMode := tmFixed;
CreateMask;
if MaskHandleAllocated
then MaskHandle := 0
else Changed(Self);
end;
procedure TRasterImage.Changed(Sender: TObject);
@ -917,3 +919,4 @@ end;
// included by graphics.pp

View File

@ -596,14 +596,14 @@ begin
else
ABitmap := Windows.CreateBitmap(ADesc.Width, ADesc.Height, 1, 1, ARawImage.Data);
//DbgDumpBitmap(ABitmap, 'CreateBitmaps - Image');
DbgDumpBitmap(ABitmap, 'CreateBitmaps - Image');
if ASkipMask then Exit(True);
AMask := Windows.CreateBitmap(ADesc.Width, ADesc.Height, 1, 1, ARawImage.Mask);
if AMask = 0 then
DebugLn('Windows.CreateBitmap returns 0. Reason = ' + GetLastErrorText(Windows.GetLastError));
Result := AMask <> 0;
//DbgDumpBitmap(AMask, 'CreateBitmaps - Mask');
DbgDumpBitmap(AMask, 'CreateBitmaps - Mask');
end;
{------------------------------------------------------------------------------