From 5aa799810a62e04e16e3988f529c3740a99dc816 Mon Sep 17 00:00:00 2001 From: sekelsenmat Date: Wed, 16 Mar 2016 10:59:05 +0000 Subject: [PATCH] fpvectorial-html: Fixes bug in positioning of raster image inside table, fixes crash in table without caption git-svn-id: trunk@51958 - --- components/fpvectorial/fpvectorial.pas | 13 +++++++++++-- components/fpvectorial/htmlvectorialreader.pas | 5 +++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/components/fpvectorial/fpvectorial.pas b/components/fpvectorial/fpvectorial.pas index 8dd796c8cd..25a02d741d 100644 --- a/components/fpvectorial/fpvectorial.pas +++ b/components/fpvectorial/fpvectorial.pas @@ -2561,12 +2561,21 @@ procedure TvEmbeddedVectorialDoc.Render(ADest: TFPCustomCanvas; var lPage: TvPage; + lPageHeight: Integer; + lMulY, lY: Double; begin inherited Render(ADest, ARenderInfo, ADestX, ADestY, AMulX, AMulY, ADoDraw); lPage := Document.GetPage(0); + lPageHeight := Round(lPage.Height); + lPage.GetNaturalRenderPos(lPageHeight, lMulY); + lY := Y; + if AmulY * lMulY < 0 then + begin + lY := Y + lPage.Height; + end; if ADoDraw then - lPage.Render(ADest, CoordToCanvasX(X), CoordToCanvasY(Y), AMulX, AMulY); + lPage.Render(ADest, CoordToCanvasX(X), CoordToCanvasY(Y), AMulX, AMulY * lMulY); CalcEntityCanvasMinMaxXY(ARenderInfo, CoordToCanvasX(X), CoordToCanvasY(Y)); CalcEntityCanvasMinMaxXY(ARenderInfo, @@ -8106,7 +8115,7 @@ begin begin OldTextX := lEntity.X; OldTextY := lEntity.Y; - lEntity.X := CoordToCanvasX(lEntity.X + X + lCurWidth, ADestX, AMulX); + lEntity.X := lEntity.X + X + lCurWidth; lEntity.Y := lEntity.Y + Y; lEntity.Render(ADest, lEntityRenderInfo, ADestX, ADestY + lHeight_px, AMulX, AMulY, ADoDraw); diff --git a/components/fpvectorial/htmlvectorialreader.pas b/components/fpvectorial/htmlvectorialreader.pas index 74af450d03..b3c9fd91e1 100644 --- a/components/fpvectorial/htmlvectorialreader.pas +++ b/components/fpvectorial/htmlvectorialreader.pas @@ -371,7 +371,7 @@ var lCurNode, lCurSubnode: TDOMNode; lNodeName, lNodeValue: DOMString; CurRow: TvTableRow; - Caption_Cell: TvTableCell; + Caption_Cell: TvTableCell = nil; CurCellPara: TvParagraph; // attributes i, lBorderNr: Integer; @@ -456,7 +456,8 @@ begin end; // the caption spans all columns - Caption_Cell.SpannedCols := CurTable.GetColCount(); + if Caption_Cell <> nil then + Caption_Cell.SpannedCols := CurTable.GetColCount(); end; function TvHTMLVectorialReader.ReadTableRowNode(ATable: TvTable; ANode: TDOMNode;