From 253c353c17bde9ce22fe6681ea5cbbb934a7826a Mon Sep 17 00:00:00 2001 From: jesus Date: Wed, 2 Nov 2011 20:50:27 +0000 Subject: [PATCH] LazReport, fixes barcode zoom broken in r33200 #15fd0b5d98 git-svn-id: trunk@33229 - --- components/lazreport/source/lr_barc.pas | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/components/lazreport/source/lr_barc.pas b/components/lazreport/source/lr_barc.pas index 6ba1cf1129..d154d6d077 100644 --- a/components/lazreport/source/lr_barc.pas +++ b/components/lazreport/source/lr_barc.pas @@ -272,7 +272,8 @@ begin BarC.Top := 0; BarC.Typ := Param.cBarType; BarC.Angle := Param.cAngle; - BarC.Ratio := 2.1; //Param.cRatio; + BarC.Ratio := Param.cRatio; // some barcodes allow only some ratios + // use at your own risk, for ean13 only 2.0-3.0 BarC.Modul := 1; //Param.cModul; {$IFDEF BC_1_25} BarC.ShowTextPosition:=stpBottomCenter; @@ -488,6 +489,12 @@ begin Bmp := CreateBarcode; if Bmp <> nil then try + // dx/dy is calculated in CreateBarCode using as base + // barcdode type, angle, zoom and data + if (Param.cAngle = 90) or (Param.cAngle = 270) then + dy := round(dy * param.cRatio) + else + dx := round(dx * Param.cRatio); CalcGaps; ShowBackground; if Param.cShowText then @@ -535,12 +542,13 @@ begin end else aCanvas.StretchDraw(DRect,Bmp); - finally - Bmp.Free - end; - ShowFrame; - RestoreCoord; + ShowFrame; + + finally + Bmp.Free; + RestoreCoord; + end; end; procedure TfrBarCodeView.Print(Stream: TStream);