mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 07:36:19 +02:00
LCL: image list: fix adding icons (correct size)
git-svn-id: trunk@57179 -
This commit is contained in:
parent
de98dc8a6f
commit
545a00f620
@ -259,7 +259,7 @@ type
|
|||||||
function GetHeightForPPI(AImageWidth, APPI: Integer): Integer;
|
function GetHeightForPPI(AImageWidth, APPI: Integer): Integer;
|
||||||
function GetCount: Integer;
|
function GetCount: Integer;
|
||||||
function GetSizeForPPI(AImageWidth, APPI: Integer): TSize;
|
function GetSizeForPPI(AImageWidth, APPI: Integer): TSize;
|
||||||
function GetBestIconIndexForSize(AIcon: TCustomIcon; AWidth: Integer): Integer;
|
function GetBestIconIndexForSize(AIcon: TCustomIcon; AWidth: Integer): Integer; // the icon must be sorted
|
||||||
function GetResolutionByIndex(AIndex: Integer): TCustomImageListResolution;
|
function GetResolutionByIndex(AIndex: Integer): TCustomImageListResolution;
|
||||||
function GetResolutionCount: Integer;
|
function GetResolutionCount: Integer;
|
||||||
procedure CreateDefaultResolution;
|
procedure CreateDefaultResolution;
|
||||||
|
@ -1743,20 +1743,28 @@ var
|
|||||||
R: TCustomImageListResolution;
|
R: TCustomImageListResolution;
|
||||||
ScBmp: TRGBAQuadArray;
|
ScBmp: TRGBAQuadArray;
|
||||||
msk: HBITMAP;
|
msk: HBITMAP;
|
||||||
|
SortedIcon: TIcon;
|
||||||
begin
|
begin
|
||||||
if AIcon = nil then Exit;
|
if AIcon = nil then Exit;
|
||||||
|
|
||||||
CreateDefaultResolution;
|
CreateDefaultResolution;
|
||||||
for R in Resolutions do
|
SortedIcon := TIcon.Create;
|
||||||
begin
|
try
|
||||||
AIcon.Current := GetBestIconIndexForSize(AIcon, R.Width);
|
SortedIcon.Assign(AIcon);
|
||||||
if AIcon.Masked then
|
SortedIcon.Sort;
|
||||||
msk := AIcon.MaskHandle
|
for R in Resolutions do
|
||||||
else
|
begin
|
||||||
msk := 0;
|
SortedIcon.Current := GetBestIconIndexForSize(SortedIcon, R.Width);
|
||||||
ScaleImage(AIcon.BitmapHandle, msk,
|
if SortedIcon.Masked then
|
||||||
AIcon.Width, AIcon.Height, R.Width, R.Height, ScBmp);
|
msk := SortedIcon.MaskHandle
|
||||||
R.InternalInsert(AIndex, @ScBmp[0]);
|
else
|
||||||
|
msk := 0;
|
||||||
|
ScaleImage(SortedIcon.BitmapHandle, msk,
|
||||||
|
SortedIcon.Width, SortedIcon.Height, R.Width, R.Height, ScBmp);
|
||||||
|
R.InternalInsert(AIndex, @ScBmp[0]);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
SortedIcon.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2207,19 +2215,27 @@ var
|
|||||||
R: TCustomImageListResolution;
|
R: TCustomImageListResolution;
|
||||||
ScBmp: TRGBAQuadArray;
|
ScBmp: TRGBAQuadArray;
|
||||||
msk: HBITMAP;
|
msk: HBITMAP;
|
||||||
|
SortedIcon: TIcon;
|
||||||
begin
|
begin
|
||||||
if AIcon = nil then Exit;
|
if AIcon = nil then Exit;
|
||||||
|
|
||||||
for R in Resolutions do
|
SortedIcon := TIcon.Create;
|
||||||
begin
|
try
|
||||||
AIcon.Current := GetBestIconIndexForSize(AIcon, R.Width);
|
SortedIcon.Assign(AIcon);
|
||||||
if AIcon.Masked then
|
SortedIcon.Sort;
|
||||||
msk := AIcon.MaskHandle
|
for R in Resolutions do
|
||||||
else
|
begin
|
||||||
msk := 0;
|
SortedIcon.Current := GetBestIconIndexForSize(SortedIcon, R.Width);
|
||||||
ScaleImage(AIcon.BitmapHandle, msk,
|
if SortedIcon.Masked then
|
||||||
AIcon.Width, AIcon.Height, R.Width, R.Height, ScBmp);
|
msk := SortedIcon.MaskHandle
|
||||||
R.InternalReplace(AIndex, @ScBmp[0]);
|
else
|
||||||
|
msk := 0;
|
||||||
|
ScaleImage(SortedIcon.BitmapHandle, msk,
|
||||||
|
SortedIcon.Width, SortedIcon.Height, R.Width, R.Height, ScBmp);
|
||||||
|
R.InternalReplace(AIndex, @ScBmp[0]);
|
||||||
|
end;
|
||||||
|
finally
|
||||||
|
SortedIcon.Free;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user