mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 06:09:15 +02:00
Minor improvement to the custom drawn bitmap resizer
git-svn-id: trunk@36191 -
This commit is contained in:
parent
36928275f2
commit
72c633b780
@ -505,7 +505,7 @@ begin
|
|||||||
TCDCHECKBOX_SQUARE_HALF_HEIGHT: Floor(GetMeasures(TCDCHECKBOX_SQUARE_HEIGHT)/2);
|
TCDCHECKBOX_SQUARE_HALF_HEIGHT: Floor(GetMeasures(TCDCHECKBOX_SQUARE_HEIGHT)/2);
|
||||||
TCDCHECKBOX_SQUARE_HEIGHT: Result := DPIAdjustment(20);
|
TCDCHECKBOX_SQUARE_HEIGHT: Result := DPIAdjustment(20);
|
||||||
//
|
//
|
||||||
TCDRADIOBUTTON_CIRCLE_HEIGHT: Result := DPIAdjustment(20);
|
TCDRADIOBUTTON_CIRCLE_HEIGHT: Result := DPIAdjustment(20); // Must be dividable by 4
|
||||||
//
|
//
|
||||||
{ TCDSCROLLBAR_BUTTON_WIDTH: Result := 17;
|
{ TCDSCROLLBAR_BUTTON_WIDTH: Result := 17;
|
||||||
TCDSCROLLBAR_LEFT_SPACING: Result := 17;
|
TCDSCROLLBAR_LEFT_SPACING: Result := 17;
|
||||||
|
@ -545,10 +545,19 @@ end;
|
|||||||
procedure TCDDrawer.ScaleRasterImage(ARasterImage: TRasterImage; ASourceDPI, ADestDPI: Word);
|
procedure TCDDrawer.ScaleRasterImage(ARasterImage: TRasterImage; ASourceDPI, ADestDPI: Word);
|
||||||
var
|
var
|
||||||
lNewWidth, lNewHeight: Int64;
|
lNewWidth, lNewHeight: Int64;
|
||||||
|
lTmpBmp: TBitmap;
|
||||||
begin
|
begin
|
||||||
lNewWidth := Round(ARasterImage.Width * ADestDPI / ASourceDPI);
|
lNewWidth := Round(ARasterImage.Width * ADestDPI / ASourceDPI);
|
||||||
lNewHeight := Round(ARasterImage.Height * ADestDPI / ASourceDPI);
|
lNewHeight := Round(ARasterImage.Height * ADestDPI / ASourceDPI);
|
||||||
ARasterImage.Canvas.StretchDraw(Bounds(0, 0, lNewWidth, lNewHeight), ARasterImage);
|
lTmpBmp := TBitmap.Create;
|
||||||
|
try
|
||||||
|
lTmpBmp.Width := ARasterImage.Width;
|
||||||
|
lTmpBmp.Height := ARasterImage.Height;
|
||||||
|
lTmpBmp.Canvas.Draw(0, 0, ARasterImage);
|
||||||
|
ARasterImage.Canvas.StretchDraw(Bounds(0, 0, lNewWidth, lNewHeight), lTmpBmp);
|
||||||
|
finally
|
||||||
|
lTmpBmp.Free;
|
||||||
|
end;
|
||||||
ARasterImage.Width := lNewWidth;
|
ARasterImage.Width := lNewWidth;
|
||||||
ARasterImage.Height := lNewHeight;
|
ARasterImage.Height := lNewHeight;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user