-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcode.patch
233 lines (217 loc) · 10.7 KB
/
code.patch
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
diff --git a/build_overrides/partition_alloc.gni b/build_overrides/partition_alloc.gni
index 56f913c7f..a7d81e7b0 100644
--- a/build_overrides/partition_alloc.gni
+++ b/build_overrides/partition_alloc.gni
@@ -11,6 +11,9 @@ _is_using_sanitizers = is_asan || is_hwasan || is_lsan || is_tsan || is_msan
# TODO(https://crbug.com/pdfium/2068) - make work with windows.
_use_shim = !_is_using_sanitizers && !is_win
+# Overriden for GDAL: _use_shim=true causes crashes at runtime
+_use_shim = false
+
# See base/allocator/partition_allocator/external_builds.md
use_allocator_shim_default = _use_shim
use_partition_alloc_as_malloc_default = _use_shim
diff --git a/core/fpdfapi/page/cpdf_occontext.cpp b/core/fpdfapi/page/cpdf_occontext.cpp
index 7d2b35fa7..a18f35487 100644
--- a/core/fpdfapi/page/cpdf_occontext.cpp
+++ b/core/fpdfapi/page/cpdf_occontext.cpp
@@ -171,7 +171,7 @@ bool CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary* pOCGDict) const {
return bState;
}
-bool CPDF_OCContext::CheckPageObjectVisible(const CPDF_PageObject* pObj) const {
+bool CPDF_OCContextInterface::CheckPageObjectVisible(const CPDF_PageObject* pObj) const {
const CPDF_ContentMarks* pMarks = pObj->GetContentMarks();
for (size_t i = 0; i < pMarks->CountItems(); ++i) {
const CPDF_ContentMarkItem* item = pMarks->GetItem(i);
diff --git a/core/fpdfapi/page/cpdf_occontext.h b/core/fpdfapi/page/cpdf_occontext.h
index c0012d1ec..bcd2dd7a9 100644
--- a/core/fpdfapi/page/cpdf_occontext.h
+++ b/core/fpdfapi/page/cpdf_occontext.h
@@ -19,14 +19,20 @@ class CPDF_Dictionary;
class CPDF_Document;
class CPDF_PageObject;
-class CPDF_OCContext final : public Retainable {
+class CPDF_OCContextInterface : public Retainable {
+ public:
+ virtual ~CPDF_OCContextInterface() = default;
+ virtual bool CheckOCGDictVisible(const CPDF_Dictionary* pOCGDict) const = 0;
+ bool CheckPageObjectVisible(const CPDF_PageObject* pObj) const;
+};
+
+class CPDF_OCContext final : public CPDF_OCContextInterface {
public:
enum UsageType { kView = 0, kDesign, kPrint, kExport };
CONSTRUCT_VIA_MAKE_RETAIN;
- bool CheckOCGDictVisible(const CPDF_Dictionary* pOCGDict) const;
- bool CheckPageObjectVisible(const CPDF_PageObject* pObj) const;
+ bool CheckOCGDictVisible(const CPDF_Dictionary* pOCGDict) const override;
private:
CPDF_OCContext(CPDF_Document* pDoc, UsageType eUsageType);
diff --git a/core/fpdfapi/render/cpdf_renderoptions.h b/core/fpdfapi/render/cpdf_renderoptions.h
index 12eb91ad8..462b5c827 100644
--- a/core/fpdfapi/render/cpdf_renderoptions.h
+++ b/core/fpdfapi/render/cpdf_renderoptions.h
@@ -72,7 +72,7 @@ class CPDF_RenderOptions {
void SetDrawAnnots(bool draw) { m_bDrawAnnots = draw; }
bool GetDrawAnnots() const { return m_bDrawAnnots; }
- void SetOCContext(RetainPtr<CPDF_OCContext> context) {
+ void SetOCContext(RetainPtr<CPDF_OCContextInterface> context) {
m_pOCContext = context;
}
@@ -81,7 +81,7 @@ class CPDF_RenderOptions {
bool m_bDrawAnnots = false;
Options m_Options;
ColorScheme m_ColorScheme = {};
- RetainPtr<CPDF_OCContext> m_pOCContext;
+ RetainPtr<CPDF_OCContextInterface> m_pOCContext;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_RENDEROPTIONS_H_
diff --git a/core/fxge/agg/fx_agg_driver.cpp b/core/fxge/agg/fx_agg_driver.cpp
index 592764341..447013841 100644
--- a/core/fxge/agg/fx_agg_driver.cpp
+++ b/core/fxge/agg/fx_agg_driver.cpp
@@ -989,7 +989,7 @@ void CFX_AggDeviceDriver::InitPlatform() {}
void CFX_AggDeviceDriver::DestroyPlatform() {}
bool CFX_AggDeviceDriver::DrawDeviceText(
- pdfium::span<const TextCharPos> pCharPos,
+ const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/agg/fx_agg_driver.h b/core/fxge/agg/fx_agg_driver.h
index 523bb0ca9..9452a3ab4 100644
--- a/core/fxge/agg/fx_agg_driver.h
+++ b/core/fxge/agg/fx_agg_driver.h
@@ -91,7 +91,7 @@ class CFX_AggDeviceDriver final : public RenderDeviceDriverIface {
BlendMode blend_type) override;
bool ContinueDIBits(CFX_ImageRenderer* handle,
PauseIndicatorIface* pPause) override;
- bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos,
+ bool DrawDeviceText(const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/cfx_renderdevice.cpp b/core/fxge/cfx_renderdevice.cpp
index ef404a967..95e63cae4 100644
--- a/core/fxge/cfx_renderdevice.cpp
+++ b/core/fxge/cfx_renderdevice.cpp
@@ -1004,7 +1004,7 @@ bool CFX_RenderDevice::SetBitsWithMask(const RetainPtr<CFX_DIBBase>& pBitmap,
}
#endif
-bool CFX_RenderDevice::DrawNormalText(pdfium::span<const TextCharPos> pCharPos,
+bool CFX_RenderDevice::DrawNormalText(const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
float font_size,
const CFX_Matrix& mtText2Device,
diff --git a/core/fxge/cfx_renderdevice.h b/core/fxge/cfx_renderdevice.h
index 5782f9558..1b465e368 100644
--- a/core/fxge/cfx_renderdevice.h
+++ b/core/fxge/cfx_renderdevice.h
@@ -153,7 +153,7 @@ class CFX_RenderDevice {
BlendMode blend_mode);
bool ContinueDIBits(CFX_ImageRenderer* handle, PauseIndicatorIface* pPause);
- bool DrawNormalText(pdfium::span<const TextCharPos> pCharPos,
+ bool DrawNormalText(const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
float font_size,
const CFX_Matrix& mtText2Device,
diff --git a/core/fxge/renderdevicedriver_iface.cpp b/core/fxge/renderdevicedriver_iface.cpp
index b549ea256..c4c00257b 100644
--- a/core/fxge/renderdevicedriver_iface.cpp
+++ b/core/fxge/renderdevicedriver_iface.cpp
@@ -50,7 +50,7 @@ bool RenderDeviceDriverIface::ContinueDIBits(CFX_ImageRenderer* handle,
}
bool RenderDeviceDriverIface::DrawDeviceText(
- pdfium::span<const TextCharPos> pCharPos,
+ const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/renderdevicedriver_iface.h b/core/fxge/renderdevicedriver_iface.h
index a25eca38e..a7cf5114d 100644
--- a/core/fxge/renderdevicedriver_iface.h
+++ b/core/fxge/renderdevicedriver_iface.h
@@ -96,7 +96,7 @@ class RenderDeviceDriverIface {
BlendMode blend_type) = 0;
virtual bool ContinueDIBits(CFX_ImageRenderer* handle,
PauseIndicatorIface* pPause);
- virtual bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos,
+ virtual bool DrawDeviceText(const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/win32/cgdi_printer_driver.cpp b/core/fxge/win32/cgdi_printer_driver.cpp
index 28bc516bc..fbd312c8b 100644
--- a/core/fxge/win32/cgdi_printer_driver.cpp
+++ b/core/fxge/win32/cgdi_printer_driver.cpp
@@ -155,7 +155,7 @@ bool CGdiPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pSource,
}
bool CGdiPrinterDriver::DrawDeviceText(
- pdfium::span<const TextCharPos> pCharPos,
+ const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/win32/cgdi_printer_driver.h b/core/fxge/win32/cgdi_printer_driver.h
index 5c4cfc067..3e0551957 100644
--- a/core/fxge/win32/cgdi_printer_driver.h
+++ b/core/fxge/win32/cgdi_printer_driver.h
@@ -43,7 +43,7 @@ class CGdiPrinterDriver final : public CGdiDeviceDriver {
const FXDIB_ResampleOptions& options,
std::unique_ptr<CFX_ImageRenderer>* handle,
BlendMode blend_type) override;
- bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos,
+ bool DrawDeviceText(const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/win32/cps_printer_driver.cpp b/core/fxge/win32/cps_printer_driver.cpp
index f30b80ddb..ef12db962 100644
--- a/core/fxge/win32/cps_printer_driver.cpp
+++ b/core/fxge/win32/cps_printer_driver.cpp
@@ -201,7 +201,7 @@ bool CPSPrinterDriver::StartDIBits(const RetainPtr<CFX_DIBBase>& pBitmap,
}
bool CPSPrinterDriver::DrawDeviceText(
- pdfium::span<const TextCharPos> pCharPos,
+ const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/win32/cps_printer_driver.h b/core/fxge/win32/cps_printer_driver.h
index 4e2849760..8f32e0033 100644
--- a/core/fxge/win32/cps_printer_driver.h
+++ b/core/fxge/win32/cps_printer_driver.h
@@ -67,7 +67,7 @@ class CPSPrinterDriver final : public RenderDeviceDriverIface {
const FXDIB_ResampleOptions& options,
std::unique_ptr<CFX_ImageRenderer>* handle,
BlendMode blend_type) override;
- bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos,
+ bool DrawDeviceText(const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/win32/ctext_only_printer_driver.cpp b/core/fxge/win32/ctext_only_printer_driver.cpp
index 7689f3f3c..b6ae57ff0 100644
--- a/core/fxge/win32/ctext_only_printer_driver.cpp
+++ b/core/fxge/win32/ctext_only_printer_driver.cpp
@@ -125,7 +125,7 @@ bool CTextOnlyPrinterDriver::StartDIBits(
}
bool CTextOnlyPrinterDriver::DrawDeviceText(
- pdfium::span<const TextCharPos> pCharPos,
+ const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,
diff --git a/core/fxge/win32/ctext_only_printer_driver.h b/core/fxge/win32/ctext_only_printer_driver.h
index e029a7cc4..93b1760dc 100644
--- a/core/fxge/win32/ctext_only_printer_driver.h
+++ b/core/fxge/win32/ctext_only_printer_driver.h
@@ -58,7 +58,7 @@ class CTextOnlyPrinterDriver final : public RenderDeviceDriverIface {
const FXDIB_ResampleOptions& options,
std::unique_ptr<CFX_ImageRenderer>* handle,
BlendMode blend_type) override;
- bool DrawDeviceText(pdfium::span<const TextCharPos> pCharPos,
+ bool DrawDeviceText(const pdfium::span<const TextCharPos>& pCharPos,
CFX_Font* pFont,
const CFX_Matrix& mtObject2Device,
float font_size,