Browse Source

* Patch from Pascal RiekenBerg to fix wrong coordinates in PDF shape rendering (Bug ID 32448)

git-svn-id: trunk@37271 -
michael 8 years ago
parent
commit
642e08a573
1 changed files with 11 additions and 7 deletions
  1. 11 7
      packages/fcl-report/src/fpreportpdfexport.pp

+ 11 - 7
packages/fcl-report/src/fpreportpdfexport.pp

@@ -277,12 +277,16 @@ begin
   APage.SetColor(clblack, True);
   APage.SetColor(clblack, False);
 
+  { PDF origin coordinate is Bottom-Left, and Report Layout is Top-Left }
   lPt1.X := ABand.RTLayout.Left + AShape.RTLayout.Left;
-  lPt1.Y := ABand.RTLayout.Top + AShape.RTLayout.Top;
+  lPt1.Y := ABand.RTLayout.Top + AShape.RTLayout.Top + AShape.RTLayout.Height;
 
-  { Frame must be drawn before the text as it could have a fill color. }
+  { Frame must be drawn before the shape as it could have a fill color. }
   RenderFrame(APage, ABand, AShape.Frame, lPt1, AShape.RTLayout.Width, AShape.RTLayout.Height);
-  RenderShape(APage, lPt1, AShape);
+  { Only render shape when color is set and color is different to frame background color. }
+  if (TFPReportShape(AShape).Color <> clNone) and
+  (TFPReportShape(AShape).Color <> AShape.Frame.BackgroundColor) then
+    RenderShape(APage, lPt1, AShape);
 end;
 
 type
@@ -442,11 +446,11 @@ begin
   begin
     ldx := 0;
     ldy := (ALayout.Height - ALayout.Width) / 2;
-    lw := ALayout.Height;
+    lw := ALayout.Width;
   end;
   { PDF origin coordinate is Bottom-Left, and Report Layout is Top-Left }
   lPt2.X := lPt1.X + ldx;
-  lPt2.Y := lPt1.Y + ldy;
+  lPt2.Y := lPt1.Y - ldy;
   APage.DrawEllipse(lPt2, lw, lw, 1, False, True);
 end;
 
@@ -514,11 +518,11 @@ begin
   begin
     ldx := 0;
     ldy := (ALayout.Height - ALayout.Width) / 2;
-    lw := ALayout.Height;
+    lw := ALayout.Width;
   end;
   P.X := lPt1.X + ldx;
   { PDF origin coordinate is Bottom-Left, and Report Layout is Top-Left }
-  P.Y := lPt1.Y + ldy;
+  P.Y := lPt1.Y - ldy;
   APage.DrawRect(P, lw, lw, 1, False, True);
 end;