From a5e03310ce91577f07c90bb08ff3d6e58cf53d8e Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Wed, 16 Mar 2016 20:25:57 +0000 Subject: [PATCH] fpvectorial: Fixes bug where sometimes text would be drawn with white font due to lack of propagation of background color through table drawing git-svn-id: trunk@51963 - --- components/fpvectorial/fpvectorial.pas | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/components/fpvectorial/fpvectorial.pas b/components/fpvectorial/fpvectorial.pas index dc8162ab7a..33cb707bf1 100644 --- a/components/fpvectorial/fpvectorial.pas +++ b/components/fpvectorial/fpvectorial.pas @@ -482,6 +482,7 @@ type class procedure CalcEntityCanvasMinMaxXY_With2Points(var ARenderInfo: TvRenderInfo; AX1, AY1, AX2, AY2: Integer); procedure MergeRenderInfo(var AFrom, ATo: TvRenderInfo); class procedure InitializeRenderInfo(out ARenderInfo: TvRenderInfo); + class procedure CopyAndInitDocumentRenderInfo(out ATo: TvRenderInfo; AFrom: TvRenderInfo); function CentralizeY_InHeight(ADest: TFPCustomCanvas; AHeight: Double): Double; function GetHeight(ADest: TFPCustomCanvas): Double; function GetWidth(ADest: TFPCustomCanvas): Double; @@ -2496,6 +2497,7 @@ begin // changes from pos relative inside table (calculated in CalculateRowHeights) to absolute pos CurRow.Y := Y + CurRow.Y; + CopyAndInitDocumentRenderInfo(lEntityRenderInfo, ARenderInfo); CurRow.Render(ADest, lEntityRenderInfo, ADestX, ADestY, AMulX, AMulY, ADoDraw); //MergeRenderInfo(lEntityRenderInfo, ARenderInfo); no need to merge, since TvTableCell.DrawBorder calculates the proper size end; @@ -2691,6 +2693,7 @@ begin CurCell.X := CurX_mm; CurCell.Y := Y; //ADest.Line(CoordToCanvasX(CurX_mm), CoordToCanvasY(Y), CoordToCanvasX(CurX_mm+1), CoordToCanvasY(Y+1)); + CopyAndInitDocumentRenderInfo(lEntityRenderInfo, ARenderInfo); CurCell.Render(ADest, lEntityRenderInfo, ADestX, ADestY, AMulX, AMulY, ADoDraw); if (Table <> nil) then begin @@ -3524,6 +3527,14 @@ begin ARenderInfo.ForceRenderBlock := False; end; +class procedure TvEntity.CopyAndInitDocumentRenderInfo(out ATo: TvRenderInfo; + AFrom: TvRenderInfo); +begin + InitializeRenderInfo(ATo); + ATo.AdjustPenColorToBackground := AFrom.AdjustPenColorToBackground; + ATo.BackgroundColor := AFrom.BackgroundColor; +end; + function TvEntity.CentralizeY_InHeight(ADest: TFPCustomCanvas; AHeight: Double): Double; var lHeight: Double; @@ -5539,7 +5550,9 @@ begin // Paint line if ADoDraw then + begin ADest.TextOut(pt.x, pt.y, lText); + end; // Calc text boundaries respecting text rotation. CalcEntityCanvasMinMaxXY(ARenderInfo, pt.x, pt.y); @@ -8106,6 +8119,7 @@ begin if Style <> nil then Style.ApplyIntoEntity(lText); + CopyAndInitDocumentRenderInfo(lEntityRenderInfo, ARenderInfo); lText.Render(ADest, lEntityRenderInfo, CurX, CurY, AMulX, AMulY, ADoDraw); lText.CalculateBoundingBox(ADest, lLeft, lTop, lRight, lBottom); lCurWidth := lCurWidth + Abs(lRight - lLeft); @@ -8434,6 +8448,7 @@ begin lEntity.X := X; lEntity.Y := Y + lCurHeight; lHeight_px := lEntity.GetEntityFeatures(ADest).DrawsUpwardHeightAdjustment; + CopyAndInitDocumentRenderInfo(lEntityRenderInfo, ARenderInfo); lEntity.Render(ADest, lEntityRenderInfo, ADestX, ADestY + lHeight_px, AMulX, AMulY, ADoDraw); lEntity.CalculateBoundingBox(ADest, lLeft, lTop, lRight, lBottom); lCurHeight := lCurHeight + (lBottom - lTop);