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
|
From f701ff3ce04a4e7e757a9f3ee62b4967749455dd Mon Sep 17 00:00:00 2001
From: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
Date: Tue, 5 Jun 2018 14:27:55 +0200
Subject: [PATCH 14/14] svx: update PDFium patch and code
---
pdfium/fpdfsdk/cpdfsdk_helpers.h | 2 ++
pdfium/fpdfsdk/fpdf_editimg.cpp | 2 +-
pdfium/fpdfsdk/fpdf_editpage.cpp | 19 ++++++++++++-------
pdfium/public/fpdf_edit.h | 16 ++++++++--------
4 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/pdfium/fpdfsdk/cpdfsdk_helpers.h b/pdfium/fpdfsdk/cpdfsdk_helpers.h
index 477bb74..c907ad8 100644
--- a/pdfium/fpdfsdk/cpdfsdk_helpers.h
+++ b/pdfium/fpdfsdk/cpdfsdk_helpers.h
@@ -40,6 +40,8 @@ class CPDF_TextPage;
class CPDF_TextPageFind;
class IPDFSDK_PauseAdapter;
class FX_PATHPOINT;
+class CPDF_TextObject;
+class CPDF_FormObject;
#ifdef PDF_ENABLE_XFA
class CPDFXFA_Context;
diff --git a/pdfium/fpdfsdk/fpdf_editimg.cpp b/pdfium/fpdfsdk/fpdf_editimg.cpp
index 3f400c7..968b84a 100644
--- a/pdfium/fpdfsdk/fpdf_editimg.cpp
+++ b/pdfium/fpdfsdk/fpdf_editimg.cpp
@@ -203,7 +203,7 @@ FPDFImageObj_GetBitmapBgra(FPDF_PAGEOBJECT image_object) {
RetainPtr<CFX_DIBitmap> pBitmap;
pBitmap = pSource->CloneConvert(FXDIB_Argb);
- return pBitmap.Leak();
+ return FPDFBitmapFromCFXDIBitmap(pBitmap.Leak());
}
FPDF_EXPORT unsigned long FPDF_CALLCONV
diff --git a/pdfium/fpdfsdk/fpdf_editpage.cpp b/pdfium/fpdfsdk/fpdf_editpage.cpp
index 29c8b01..a52e1a9 100644
--- a/pdfium/fpdfsdk/fpdf_editpage.cpp
+++ b/pdfium/fpdfsdk/fpdf_editpage.cpp
@@ -718,7 +718,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFTextObj_GetText(FPDF_PAGEOBJECT text_object,
int ret_count = byte_str_len / sizeof(unsigned short);
ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator.
- memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len);
+ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len);
return ret_count;
}
@@ -758,7 +758,7 @@ FPDFTextObj_GetTextProcessed(FPDF_PAGEOBJECT text_object,
int ret_count = byte_str_len / kBytesPerCharacter;
ASSERT(ret_count <= char_count + 1); // +1 to account for the NUL terminator.
- memcpy(result, byte_str.GetBuffer(byte_str_len), byte_str_len);
+ memcpy(result, byte_str.GetBuffer(byte_str_len).data(), byte_str_len);
return ret_count;
}
@@ -801,10 +801,15 @@ FPDFTextObj_GetColor(FPDF_PAGEOBJECT text_object,
return false;
}
- const uint32_t RGB = bStroke ? pTxtObj->m_ColorState.GetStrokeRGB() : pTxtObj->m_ColorState.GetFillRGB();
- *R = FXSYS_GetRValue(RGB);
- *G = FXSYS_GetGValue(RGB);
- *B = FXSYS_GetBValue(RGB);
+ const CPDF_Color* pColor = bStroke ? pTxtObj->m_ColorState.GetStrokeColor() : pTxtObj->m_ColorState.GetFillColor();
+ if (pColor == nullptr)
+ return false;
+
+ int r, g, b;
+ pColor->GetRGB(&r, &g, &b);
+ *R = r;
+ *G = g;
+ *B = b;
*A = static_cast<unsigned int>(
(pTxtObj->m_GeneralState.GetStrokeAlpha() * 255.f) + 0.5f);
@@ -834,7 +839,7 @@ FPDFFormObj_GetSubObject(FPDF_PAGEOBJECT form_object, int index)
const CFX_Matrix& matrix = pFrmObj->form_matrix();
const CPDF_PageObjectList* pObjectList = pFrmObj->form()->GetPageObjectList();
if (pObjectList)
- return pObjectList->GetPageObjectByIndex(index);
+ return FPDFPageObjectFromCPDFPageObject(pObjectList->GetPageObjectByIndex(index));
}
return nullptr;
--
2.16.3
|