mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-05 01:41:35 +02:00
lazreport: apply scale when drawing not stretched image. This fixes the size of image in printed report
git-svn-id: trunk@39366 -
This commit is contained in:
parent
8d49c04d1f
commit
b1e8475e3b
@ -4375,7 +4375,7 @@ procedure TfrPictureView.Draw(aCanvas: TCanvas);
|
|||||||
var
|
var
|
||||||
r: TRect;
|
r: TRect;
|
||||||
kx, ky: Double;
|
kx, ky: Double;
|
||||||
w, h, w1, h1: Integer;
|
w, h, w1, h1, PictureHeight, PictureWidth: Integer;
|
||||||
ClipRgn, PreviousClipRgn: HRGN;
|
ClipRgn, PreviousClipRgn: HRGN;
|
||||||
ClipNeeded: Boolean;
|
ClipNeeded: Boolean;
|
||||||
|
|
||||||
@ -4456,15 +4456,19 @@ begin
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
|
PictureWidth := Round(Picture.Width * ScaleX);
|
||||||
|
PictureHeight := Round(Picture.Height * ScaleY);
|
||||||
if (Flags and flPictCenter) <> 0 then
|
if (Flags and flPictCenter) <> 0 then
|
||||||
OffsetRect(r, (w - Picture.Width) div 2, (h - Picture.Height) div 2);
|
OffsetRect(r, (w - PictureWidth) div 2, (h - PictureHeight) div 2);
|
||||||
ClipNeeded := (Picture.Height > h) or (Picture.Width > w);
|
ClipNeeded := (PictureHeight > h) or (PictureWidth > w);
|
||||||
if ClipNeeded then
|
if ClipNeeded then
|
||||||
begin
|
begin
|
||||||
ClipRgn := CreateRectRgn(DRect.Left, DRect.Top, DRect.Right, DRect.Bottom);
|
ClipRgn := CreateRectRgn(r.Left, r.Top, r.Right, r.Bottom);
|
||||||
PreviousClipRgn := SelectClipRgn(Handle, ClipRgn);
|
PreviousClipRgn := SelectClipRgn(Handle, ClipRgn);
|
||||||
end;
|
end;
|
||||||
Draw(r.Left, r.Top, Picture.Graphic);
|
r.Right := r.Left + PictureWidth;
|
||||||
|
r.Bottom := r.Top + PictureHeight;
|
||||||
|
StretchDraw(r, Picture.Graphic);
|
||||||
if ClipNeeded then
|
if ClipNeeded then
|
||||||
begin
|
begin
|
||||||
SelectClipRGN(Handle, PreviousClipRgn);
|
SelectClipRGN(Handle, PreviousClipRgn);
|
||||||
|
Loading…
Reference in New Issue
Block a user