1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
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
|