summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-04-22 17:21:30 -0400
committerAshod Nakashian <ashod.nakashian@collabora.co.uk>2018-06-04 12:36:28 -0400
commit397aa7177e23d848ae7db5e8db32fd05da838660 (patch)
tree5421822c9dcebc0c0eb1cc735c5f06ead8551538
parent401638823f6657ec9f585df4d0a7c953d9d299e7 (diff)
svx: support no fill and no stroke paths in PDF import
Change-Id: Ida5daa71d469805fd52e08e804fb9fa182d7d008 (cherry picked from commit e25ed0d0690ee8d5f07c98ccbb79868415fef5fb)
-rw-r--r--svx/source/svdraw/svdpdf.cxx37
1 files changed, 25 insertions, 12 deletions
diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx
index 4b5d6af2d449..90d2ba45ed54 100644
--- a/svx/source/svdraw/svdpdf.cxx
+++ b/svx/source/svdraw/svdpdf.cxx
@@ -1417,11 +1417,24 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd
float fWidth = 1;
FPDFPath_GetStrokeWidth(pPageObject, &fWidth);
- SAL_WARN("sd.filter", "Path Stroke Width: " << fWidth);
- const double dWidth = fabs(sqrt2(a, c) * fWidth);
- SAL_WARN("sd.filter", "Path Stroke Width scaled: " << dWidth);
+ const double dWidth = 0.5 * fabs(sqrt2(mCurMatrix.a(), mCurMatrix.c()) * fWidth);
mnLineWidth = lcl_ToLogic(lcl_PointToPixel(dWidth));
mnLineWidth /= 2;
+ SAL_WARN("sd.filter", "Path Stroke Width: " << fWidth << ", scaled: " << dWidth
+ << ", Logical: " << mnLineWidth);
+
+ int nFillMode = FPDF_FILLMODE_ALTERNATE;
+ FPDF_BOOL bStroke = true;
+ if (FPDFPath_GetDrawMode(pPageObject, &nFillMode, &bStroke))
+ {
+ SAL_WARN("sd.filter", "Got PATH FillMode: " << nFillMode << ", Storke: " << bStroke);
+ if (nFillMode == FPDF_FILLMODE_ALTERNATE)
+ mpVD->SetDrawMode(DrawModeFlags::Default);
+ else if (nFillMode == FPDF_FILLMODE_WINDING)
+ mpVD->SetDrawMode(DrawModeFlags::Default);
+ else
+ mpVD->SetDrawMode(DrawModeFlags::NoFill);
+ }
unsigned int nR;
unsigned int nG;
@@ -1431,15 +1444,15 @@ void ImpSdrPdfImport::ImportPath(FPDF_PAGEOBJECT pPageObject, int nPageObjectInd
SAL_WARN("sd.filter", "Got PATH fill color: " << nR << ", " << nG << ", " << nB << ", " << nA);
mpVD->SetFillColor(Color(nR, nG, nB));
- FPDFPath_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA);
- SAL_WARN("sd.filter",
- "Got PATH stroke color: " << nR << ", " << nG << ", " << nB << ", " << nA);
- mpVD->SetLineColor(Color(nR, nG, nB));
-
- // int nFillMode = 0; // No fill.
- // bool bStroke = false;
- // FPDFPath_GetDrawMode(pPageObject, &nFillMode, &bStroke);
- // mpVD->Setstroke(Color(r, g, b));
+ if (bStroke)
+ {
+ FPDFPath_GetStrokeColor(pPageObject, &nR, &nG, &nB, &nA);
+ SAL_WARN("sd.filter",
+ "Got PATH stroke color: " << nR << ", " << nG << ", " << nB << ", " << nA);
+ mpVD->SetLineColor(Color(nR, nG, nB));
+ }
+ else
+ mpVD->SetLineColor(COL_TRANSPARENT);
// if(!mbLastObjWasPolyWithoutLine || !CheckLastPolyLineAndFillMerge(basegfx::B2DPolyPolygon(aSource)))