diff options
author | Ashod Nakashian <ashod.nakashian@collabora.co.uk> | 2018-04-14 11:40:18 -0400 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2018-06-07 10:45:25 +0200 |
commit | ca74d60cb6fb96ee417d204ffb7a3d4e795c0305 (patch) | |
tree | 1335b0389f9a5e24155a6e62be237317d6ce6682 /external/pdfium | |
parent | fab3ca134f687fed35d9abcd2a11e654cd84a1db (diff) |
svx: correct the positioning of PDF Paths and the stroke width
Change-Id: I5b150721cc1b61b028f282062c1466ef6a67fcae
(cherry picked from commit 37a40d8025ac70f84937de2b1d0f596d08088cbd)
Diffstat (limited to 'external/pdfium')
-rw-r--r-- | external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 | 103 | ||||
-rw-r--r-- | external/pdfium/UnpackedTarball_pdfium.mk | 1 |
2 files changed, 104 insertions, 0 deletions
diff --git a/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 b/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 new file mode 100644 index 000000000000..946a21cb42a4 --- /dev/null +++ b/external/pdfium/0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 @@ -0,0 +1,103 @@ +From 92e382401059237c84c13114d4612ceaa5b0c214 Mon Sep 17 00:00:00 2001 +From: Ashod Nakashian <ashod.nakashian@collabora.co.uk> +Date: Tue, 5 Jun 2018 11:32:12 +0200 +Subject: [PATCH 08/14] svx: correct the positioning of PDF Paths and the + stroke width + +--- + pdfium/core/fpdfapi/page/cpdf_page.cpp | 3 +++ + pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp | 2 +- + pdfium/core/fxge/cfx_pathdata.cpp | 2 ++ + pdfium/fpdfsdk/fpdf_editpath.cpp | 16 ++++++++-------- + 4 files changed, 14 insertions(+), 9 deletions(-) + +diff --git a/pdfium/core/fpdfapi/page/cpdf_page.cpp b/pdfium/core/fpdfapi/page/cpdf_page.cpp +index eee6673..00657d6 100644 +--- a/pdfium/core/fpdfapi/page/cpdf_page.cpp ++++ b/pdfium/core/fpdfapi/page/cpdf_page.cpp +@@ -37,12 +37,14 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument, + CFX_FloatRect mediabox = GetBox("MediaBox"); + if (mediabox.IsEmpty()) + mediabox = CFX_FloatRect(0, 0, 612, 792); ++ fprintf(stderr, "Page mediabox: %f, %f, %f, %f\n", mediabox.left, mediabox.right, mediabox.top, mediabox.bottom); + + m_BBox = GetBox("CropBox"); + if (m_BBox.IsEmpty()) + m_BBox = mediabox; + else + m_BBox.Intersect(mediabox); ++ fprintf(stderr, "Page cropbox: %f, %f, %f, %f\n", m_BBox.left, m_BBox.right, m_BBox.top, m_BBox.bottom); + + m_PageSize.width = m_BBox.Width(); + m_PageSize.height = m_BBox.Height(); +@@ -50,6 +52,7 @@ CPDF_Page::CPDF_Page(CPDF_Document* pDocument, + int rotate = GetPageRotation(); + if (rotate % 2) + std::swap(m_PageSize.width, m_PageSize.height); ++ fprintf(stderr, "Page rotate: %d, Page Width: %f, Page Height: %f\n", rotate, m_PageSize.width, m_PageSize.height); + + switch (rotate) { + case 0: +diff --git a/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp b/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp +index 87301d3..bf82d55 100644 +--- a/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp ++++ b/pdfium/core/fpdfapi/render/cpdf_renderstatus.cpp +@@ -1767,7 +1767,7 @@ bool CPDF_RenderStatus::ProcessText(CPDF_TextObject* textobj, + return true; + + float font_size = textobj->m_TextState.GetFontSize(); +- fprintf(stderr, "Font size: %f, matrix a: %f, b: %f, c: %f, d: %f, e: %f, f: %f\n", font_size, text_matrix.a, text_matrix.b, text_matrix.c, text_matrix.d, text_matrix.e, text_matrix.f); ++// fprintf(stderr, "Font size: %f, matrix a: %f, b: %f, c: %f, d: %f, e: %f, f: %f\n", font_size, text_matrix.a, text_matrix.b, text_matrix.c, text_matrix.d, text_matrix.e, text_matrix.f); + if (bPattern) { + DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, + &text_matrix, bFill, bStroke); +diff --git a/pdfium/core/fxge/cfx_pathdata.cpp b/pdfium/core/fxge/cfx_pathdata.cpp +index ac1ff42..a483edf 100644 +--- a/pdfium/core/fxge/cfx_pathdata.cpp ++++ b/pdfium/core/fxge/cfx_pathdata.cpp +@@ -199,6 +199,7 @@ void CFX_PathData::Append(const CFX_PathData* pSrc, const CFX_Matrix* pMatrix) { + void CFX_PathData::AppendPoint(const CFX_PointF& point, + FXPT_TYPE type, + bool closeFigure) { ++ fprintf(stderr, "Append: %f, %f (%s)\n", point.x, point.y, closeFigure ? "CLOSE" : "OPEN"); + m_Points.push_back(FX_PATHPOINT(point, type, closeFigure)); + } + +@@ -294,6 +295,7 @@ CFX_FloatRect CFX_PathData::GetBoundingBox(float line_width, + void CFX_PathData::Transform(const CFX_Matrix* pMatrix) { + if (!pMatrix) + return; ++ fprintf(stderr, "XForm: %f, %f %f, %f, %f, %f\n", pMatrix->a, pMatrix->b, pMatrix->c, pMatrix->d, pMatrix->e, pMatrix->f); + for (auto& point : m_Points) + point.m_Point = pMatrix->Transform(point.m_Point); + } +diff --git a/pdfium/fpdfsdk/fpdf_editpath.cpp b/pdfium/fpdfsdk/fpdf_editpath.cpp +index f41db64..017dbcd 100644 +--- a/pdfium/fpdfsdk/fpdf_editpath.cpp ++++ b/pdfium/fpdfsdk/fpdf_editpath.cpp +@@ -308,14 +308,14 @@ FPDFPath_GetMatrix(FPDF_PAGEOBJECT path_object, + if (!path_object || !a || !b || !c || !d || !e || !f) + return false; + +- auto* pPathObj = CPDFPageObjectFromFPDFPageObject(path_object); +- CFX_Matrix* pMatrix = pPathObj->m_GeneralState.GetMutableMatrix(); +- *a = pMatrix->a; +- *b = pMatrix->b; +- *c = pMatrix->c; +- *d = pMatrix->d; +- *e = pMatrix->e; +- *f = pMatrix->f; ++ CPDF_PathObject* pPathObj = CPDFPathObjectFromFPDFPageObject(path_object); ++ const CFX_Matrix& pMatrix = pPathObj->m_Matrix; ++ *a = pMatrix.a; ++ *b = pMatrix.b; ++ *c = pMatrix.c; ++ *d = pMatrix.d; ++ *e = pMatrix.e; ++ *f = pMatrix.f; + + return true; + } +-- +2.16.3 + diff --git a/external/pdfium/UnpackedTarball_pdfium.mk b/external/pdfium/UnpackedTarball_pdfium.mk index f0ee740ddf94..979df64d03c4 100644 --- a/external/pdfium/UnpackedTarball_pdfium.mk +++ b/external/pdfium/UnpackedTarball_pdfium.mk @@ -21,6 +21,7 @@ pdfium_patches += 0004-svx-support-PDF-text-color.patch.2 pdfium_patches += 0005-svx-support-Paths-in-PDFs-while-importing.patch.2 pdfium_patches += 0006-svx-improve-path-importing-from-PDF.patch.2 pdfium_patches += 0007-svx-improved-text-importing-from-PDF.patch.2 +pdfium_patches += 0008-svx-correct-the-positioning-of-PDF-Paths-and-the-str.patch.2 $(eval $(call gb_UnpackedTarball_UnpackedTarball,pdfium)) |