mirror of
https://github.com/doublecmd/doublecmd.git
synced 2026-06-28 10:02:14 +00:00
FIX: Blurry icons in viewer/editor/differ (issue #2752)
This commit is contained in:
parent
d572592446
commit
af11aa348b
2 changed files with 18 additions and 7 deletions
|
|
@ -30,6 +30,10 @@ uses
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
{ TImageList }
|
||||||
|
|
||||||
|
TImageList = class(Controls.TImageList);
|
||||||
|
|
||||||
{ TdmComData }
|
{ TdmComData }
|
||||||
|
|
||||||
TdmComData = class(TDataModule)
|
TdmComData = class(TDataModule)
|
||||||
|
|
@ -151,6 +155,7 @@ var
|
||||||
AName: String;
|
AName: String;
|
||||||
AFactor: Double;
|
AFactor: Double;
|
||||||
AResolutions: array of Integer;
|
AResolutions: array of Integer;
|
||||||
|
AResolutions2: array of Integer;
|
||||||
ABitmaps: array of TCustomBitmap;
|
ABitmaps: array of TCustomBitmap;
|
||||||
begin
|
begin
|
||||||
Images.Clear;
|
Images.Clear;
|
||||||
|
|
@ -161,32 +166,34 @@ begin
|
||||||
AResolutions[1]:= 24; // AdjustIconSize(24, 96);
|
AResolutions[1]:= 24; // AdjustIconSize(24, 96);
|
||||||
AResolutions[2]:= 32; // AdjustIconSize(32, 96);
|
AResolutions[2]:= 32; // AdjustIconSize(32, 96);
|
||||||
|
|
||||||
if gToolIconsSize >= 48 then
|
if not (gToolIconsSize in [16, 24, 32]) then
|
||||||
begin
|
begin
|
||||||
SetLength(ABitmaps, 4);
|
SetLength(ABitmaps, 4);
|
||||||
SetLength(AResolutions, 4);
|
SetLength(AResolutions, 4);
|
||||||
AResolutions[3]:= gToolIconsSize;
|
AResolutions[3]:= gToolIconsSize;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
AResolutions2:= Copy(AResolutions);
|
||||||
AFactor:= findScaleFactorByFirstForm;
|
AFactor:= findScaleFactorByFirstForm;
|
||||||
|
|
||||||
if (AFactor > 1.0) then
|
if (AFactor > 1.0) then
|
||||||
begin
|
begin
|
||||||
I:= Round(gToolIconsSize * AFactor);
|
for I:= 0 to High(AResolutions2) do
|
||||||
if (I <> 16) and (I <> 24) and (I <> 32) then
|
|
||||||
begin
|
begin
|
||||||
SetLength(ABitmaps, Length(ABitmaps) + 1);
|
AResolutions2[I]:= Round(AResolutions2[I] * AFactor);
|
||||||
SetLength(AResolutions, Length(AResolutions) + 1);
|
|
||||||
AResolutions[High(AResolutions)]:= I;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Images.RegisterResolutions(AResolutions);
|
I:= AResolutions2[0];
|
||||||
|
Images.SetWidthHeight(I, I);
|
||||||
|
Images.RegisterResolutions(AResolutions2);
|
||||||
|
|
||||||
for AName in ANames do
|
for AName in ANames do
|
||||||
begin
|
begin
|
||||||
for I:= 0 to High(AResolutions) do
|
for I:= 0 to High(AResolutions) do
|
||||||
begin
|
begin
|
||||||
|
// GetThemeIcon takes into account
|
||||||
|
// CanvasScaleFactor, so use original icon size here
|
||||||
ABitmaps[I]:= PixMapManager.GetThemeIcon(AName, AResolutions[I]);
|
ABitmaps[I]:= PixMapManager.GetThemeIcon(AName, AResolutions[I]);
|
||||||
if (ABitmaps[I] = nil) then ABitmaps[I]:= TBitmap.Create;
|
if (ABitmaps[I] = nil) then ABitmaps[I]:= TBitmap.Create;
|
||||||
end;
|
end;
|
||||||
|
|
|
||||||
|
|
@ -2649,6 +2649,10 @@ begin
|
||||||
Result:= LoadIconThemeBitmap(AIconName, AIconSize);
|
Result:= LoadIconThemeBitmap(AIconName, AIconSize);
|
||||||
if Assigned(Result) then
|
if Assigned(Result) then
|
||||||
begin
|
begin
|
||||||
|
// LoadIconThemeBitmap takes into account
|
||||||
|
// CanvasScaleFactor, so use scaled icon size here
|
||||||
|
AIconSize := Round(AIconSize * findScaleFactorByFirstForm());
|
||||||
|
|
||||||
if (Result.Width > AIconSize) or (Result.Height > AIconSize) then
|
if (Result.Width > AIconSize) or (Result.Height > AIconSize) then
|
||||||
begin
|
begin
|
||||||
ABitmap:= Graphics.TBitmap.Create;
|
ABitmap:= Graphics.TBitmap.Create;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue