industrial: Anti-aliased drawing of scaled TLEDNumber at lowest size.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7313 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-01-22 06:28:50 +00:00
parent eaf32201bd
commit 019e5e3a8e

View File

@@ -375,9 +375,20 @@ procedure TCustomLEDNumber.Paint;
var
Points: array[0..MAX_POINTS] of TPoint;
ARect: TRect;
AADraw: Boolean; // anti-aliased drawing flag
savedScaleFactor: Double;
begin
lbDrawBMP.Width := Width;
lbDrawBMP.Height := Height;
AADraw := (Font.PixelsPerInch <> 96) and (FSize = 2);
if AADraw then begin
savedScaleFactor := FScaleFactor;
FScaleFactor := 2*FScaleFactor;
lbDrawBMP.Width := 2*Width;
lbDrawBMP.Height := 2*Height;
end else
begin
lbDrawBMP.Width := Width;
lbDrawBMP.Height := Height;
end;
Initialize(Points);
lbDrawBMP.Canvas.Brush.Color := FBgColor;
@@ -385,7 +396,7 @@ begin
ProcessCaption(Points);
Canvas.CopyMode := cmSrcCopy;
if BorderStyle <> lnbNone then
if (BorderStyle <> lnbNone) then
begin
ARect := ClientRect;
case BorderStyle of
@@ -402,6 +413,11 @@ begin
inc(ARect.Right, 1);
inc(ARect.Bottom, 1);
Canvas.StretchDraw(ARect, lbDrawBMP);
end else
if AADraw then begin
ARect := ClientRect;
Canvas.StretchDraw(ARect, lbDrawBMP);
FScaleFactor := savedScaleFactor;
end else
Canvas.Draw(0, 0, lbDrawBMP);
end;