7#include "core/fpdfapi/page/cpdf_streamcontentparser.h"
15#include "core/fpdfapi/font/cpdf_font.h"
16#include "core/fpdfapi/font/cpdf_type3font.h"
17#include "core/fpdfapi/page/cpdf_allstates.h"
18#include "core/fpdfapi/page/cpdf_docpagedata.h"
19#include "core/fpdfapi/page/cpdf_form.h"
20#include "core/fpdfapi/page/cpdf_formobject.h"
21#include "core/fpdfapi/page/cpdf_image.h"
22#include "core/fpdfapi/page/cpdf_imageobject.h"
23#include "core/fpdfapi/page/cpdf_meshstream.h"
24#include "core/fpdfapi/page/cpdf_pageobject.h"
25#include "core/fpdfapi/page/cpdf_pathobject.h"
26#include "core/fpdfapi/page/cpdf_shadingobject.h"
27#include "core/fpdfapi/page/cpdf_shadingpattern.h"
28#include "core/fpdfapi/page/cpdf_streamparser.h"
29#include "core/fpdfapi/page/cpdf_textobject.h"
30#include "core/fpdfapi/parser/cpdf_array.h"
31#include "core/fpdfapi/parser/cpdf_dictionary.h"
32#include "core/fpdfapi/parser/cpdf_document.h"
33#include "core/fpdfapi/parser/cpdf_name.h"
34#include "core/fpdfapi/parser/cpdf_number.h"
35#include "core/fpdfapi/parser/cpdf_reference.h"
36#include "core/fpdfapi/parser/cpdf_stream.h"
37#include "core/fpdfapi/parser/fpdf_parser_utility.h"
38#include "core/fxcrt/autonuller.h"
39#include "core/fxcrt/bytestring.h"
40#include "core/fxcrt/fx_safe_types.h"
41#include "core/fxcrt/scoped_set_insertion.h"
42#include "core/fxcrt/stl_util.h"
43#include "core/fxge/cfx_graphstate.h"
44#include "core/fxge/cfx_graphstatedata.h"
45#include "third_party/base/check.h"
46#include "third_party/base/containers/contains.h"
47#include "third_party/base/containers/span.h"
48#include "third_party/base/notreached.h"
52constexpr int kMaxFormLevel = 40;
55constexpr int kFormCountLimit = 8192;
57constexpr int kSingleCoordinatePair = 1;
58constexpr int kTensorCoordinatePairs = 16;
59constexpr int kCoonsCoordinatePairs = 12;
60constexpr int kSingleColorPerPatch = 1;
61constexpr int kQuadColorsPerPatch = 4;
63const char kPathOperatorSubpath =
'm';
64const char kPathOperatorLine =
'l';
65const char kPathOperatorCubicBezier1 =
'c';
66const char kPathOperatorCubicBezier2 =
'v';
67const char kPathOperatorCubicBezier3 =
'y';
68const char kPathOperatorClosePath =
'h';
69const char kPathOperatorRectangle[] =
"re";
71using OpCodes = std::map<uint32_t,
void (CPDF_StreamContentParser::*)()>;
72OpCodes* g_opcodes =
nullptr;
77 RetainPtr<
const CPDF_Stream> pStream = ToStream(pShading->GetShadingObject());
88 bool update_rect =
false;
94 point_count = kTensorCoordinatePairs;
96 point_count = kCoonsCoordinatePairs;
98 point_count = kSingleCoordinatePair;
102 color_count = kQuadColorsPerPatch;
104 color_count = kSingleColorPerPatch;
114 if (!bGouraud && flag) {
119 for (
int i = 0; i < point_count; ++i) {
123 CFX_PointF origin = stream.ReadCoords();
131 FX_SAFE_UINT32 nBits = stream.Components();
133 nBits *= color_count;
134 if (!nBits.IsValid())
146 const char* full_name;
149const AbbrPair kInlineKeyAbbr[] = {
150 {
"BPC",
"BitsPerComponent"}, {
"CS",
"ColorSpace"}, {
"D",
"Decode"},
151 {
"DP",
"DecodeParms"}, {
"F",
"Filter"}, {
"H",
"Height"},
152 {
"IM",
"ImageMask"}, {
"I",
"Interpolate"}, {
"W",
"Width"},
155const AbbrPair kInlineValueAbbr[] = {
156 {
"G",
"DeviceGray"}, {
"RGB",
"DeviceRGB"},
157 {
"CMYK",
"DeviceCMYK"}, {
"I",
"Indexed"},
158 {
"AHx",
"ASCIIHexDecode"}, {
"A85",
"ASCII85Decode"},
159 {
"LZW",
"LZWDecode"}, {
"Fl",
"FlateDecode"},
160 {
"RL",
"RunLengthDecode"}, {
"CCF",
"CCITTFaxDecode"},
161 {
"DCT",
"DCTDecode"},
164struct AbbrReplacementOp {
167 ByteStringView replacement;
170ByteStringView FindFullName(pdfium::span<
const AbbrPair> table,
171 ByteStringView abbr) {
172 for (
const auto& pair : table) {
173 if (pair.abbr == abbr)
174 return ByteStringView(pair.full_name);
176 return ByteStringView();
181void ReplaceAbbrInDictionary(CPDF_Dictionary* pDict) {
182 std::vector<AbbrReplacementOp> replacements;
185 for (
const auto& it : locker) {
186 ByteString key = it.first;
187 ByteStringView fullname =
188 FindFullName(kInlineKeyAbbr, key.AsStringView());
189 if (!fullname.IsEmpty()) {
190 AbbrReplacementOp op;
191 op.is_replace_key =
true;
192 op.key = std::move(key);
193 op.replacement = fullname;
194 replacements.push_back(op);
197 RetainPtr<CPDF_Object> value = it.second;
198 if (value->IsName()) {
199 ByteString name = value->GetString();
200 fullname = FindFullName(kInlineValueAbbr, name.AsStringView());
201 if (!fullname.IsEmpty()) {
202 AbbrReplacementOp op;
203 op.is_replace_key =
false;
205 op.replacement = fullname;
206 replacements.push_back(op);
209 ReplaceAbbr(std::move(value));
213 for (
const auto& op : replacements) {
214 if (op.is_replace_key)
215 pDict->ReplaceKey(op.key, ByteString(op.replacement));
217 pDict->SetNewFor<CPDF_Name>(op.key, ByteString(op.replacement));
221void ReplaceAbbrInArray(CPDF_Array* pArray) {
222 for (size_t i = 0; i < pArray->size(); ++i) {
224 if (pElement->IsName()) {
225 ByteString name = pElement->GetString();
226 ByteStringView fullname =
227 FindFullName(kInlineValueAbbr, name.AsStringView());
228 if (!fullname.IsEmpty())
229 pArray->SetNewAt<CPDF_Name>(i, ByteString(fullname));
231 ReplaceAbbr(
std::move(pElement));
237 CPDF_Dictionary* pDict = pObj->AsMutableDictionary();
239 ReplaceAbbrInDictionary(pDict);
243 CPDF_Array* pArray = pObj->AsMutableArray();
245 ReplaceAbbrInArray(pArray);
253 g_opcodes =
new OpCodes({
254 {FXBSTR_ID(
'"', 0, 0, 0),
255 &CPDF_StreamContentParser::Handle_NextLineShowText_Space},
256 {FXBSTR_ID(
'\'', 0, 0, 0),
257 &CPDF_StreamContentParser::Handle_NextLineShowText},
258 {FXBSTR_ID(
'B', 0, 0, 0),
259 &CPDF_StreamContentParser::Handle_FillStrokePath},
260 {FXBSTR_ID(
'B',
'*', 0, 0),
261 &CPDF_StreamContentParser::Handle_EOFillStrokePath},
262 {FXBSTR_ID(
'B',
'D',
'C', 0),
263 &CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary},
264 {FXBSTR_ID(
'B',
'I', 0, 0), &CPDF_StreamContentParser::Handle_BeginImage},
265 {FXBSTR_ID(
'B',
'M',
'C', 0),
266 &CPDF_StreamContentParser::Handle_BeginMarkedContent},
267 {FXBSTR_ID(
'B',
'T', 0, 0), &CPDF_StreamContentParser::Handle_BeginText},
268 {FXBSTR_ID(
'C',
'S', 0, 0),
269 &CPDF_StreamContentParser::Handle_SetColorSpace_Stroke},
270 {FXBSTR_ID(
'D',
'P', 0, 0),
271 &CPDF_StreamContentParser::Handle_MarkPlace_Dictionary},
272 {FXBSTR_ID(
'D',
'o', 0, 0),
273 &CPDF_StreamContentParser::Handle_ExecuteXObject},
274 {FXBSTR_ID(
'E',
'I', 0, 0), &CPDF_StreamContentParser::Handle_EndImage},
275 {FXBSTR_ID(
'E',
'M',
'C', 0),
276 &CPDF_StreamContentParser::Handle_EndMarkedContent},
277 {FXBSTR_ID(
'E',
'T', 0, 0), &CPDF_StreamContentParser::Handle_EndText},
278 {FXBSTR_ID(
'F', 0, 0, 0), &CPDF_StreamContentParser::Handle_FillPathOld},
279 {FXBSTR_ID(
'G', 0, 0, 0),
280 &CPDF_StreamContentParser::Handle_SetGray_Stroke},
281 {FXBSTR_ID(
'I',
'D', 0, 0),
282 &CPDF_StreamContentParser::Handle_BeginImageData},
283 {FXBSTR_ID(
'J', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetLineCap},
284 {FXBSTR_ID(
'K', 0, 0, 0),
285 &CPDF_StreamContentParser::Handle_SetCMYKColor_Stroke},
286 {FXBSTR_ID(
'M', 0, 0, 0),
287 &CPDF_StreamContentParser::Handle_SetMiterLimit},
288 {FXBSTR_ID(
'M',
'P', 0, 0), &CPDF_StreamContentParser::Handle_MarkPlace},
289 {FXBSTR_ID(
'Q', 0, 0, 0),
290 &CPDF_StreamContentParser::Handle_RestoreGraphState},
291 {FXBSTR_ID(
'R',
'G', 0, 0),
292 &CPDF_StreamContentParser::Handle_SetRGBColor_Stroke},
293 {FXBSTR_ID(
'S', 0, 0, 0), &CPDF_StreamContentParser::Handle_StrokePath},
294 {FXBSTR_ID(
'S',
'C', 0, 0),
295 &CPDF_StreamContentParser::Handle_SetColor_Stroke},
296 {FXBSTR_ID(
'S',
'C',
'N', 0),
297 &CPDF_StreamContentParser::Handle_SetColorPS_Stroke},
298 {FXBSTR_ID(
'T',
'*', 0, 0),
299 &CPDF_StreamContentParser::Handle_MoveToNextLine},
300 {FXBSTR_ID(
'T',
'D', 0, 0),
301 &CPDF_StreamContentParser::Handle_MoveTextPoint_SetLeading},
302 {FXBSTR_ID(
'T',
'J', 0, 0),
303 &CPDF_StreamContentParser::Handle_ShowText_Positioning},
304 {FXBSTR_ID(
'T',
'L', 0, 0),
305 &CPDF_StreamContentParser::Handle_SetTextLeading},
306 {FXBSTR_ID(
'T',
'c', 0, 0),
307 &CPDF_StreamContentParser::Handle_SetCharSpace},
308 {FXBSTR_ID(
'T',
'd', 0, 0),
309 &CPDF_StreamContentParser::Handle_MoveTextPoint},
310 {FXBSTR_ID(
'T',
'f', 0, 0), &CPDF_StreamContentParser::Handle_SetFont},
311 {FXBSTR_ID(
'T',
'j', 0, 0), &CPDF_StreamContentParser::Handle_ShowText},
312 {FXBSTR_ID(
'T',
'm', 0, 0),
313 &CPDF_StreamContentParser::Handle_SetTextMatrix},
314 {FXBSTR_ID(
'T',
'r', 0, 0),
315 &CPDF_StreamContentParser::Handle_SetTextRenderMode},
316 {FXBSTR_ID(
'T',
's', 0, 0),
317 &CPDF_StreamContentParser::Handle_SetTextRise},
318 {FXBSTR_ID(
'T',
'w', 0, 0),
319 &CPDF_StreamContentParser::Handle_SetWordSpace},
320 {FXBSTR_ID(
'T',
'z', 0, 0),
321 &CPDF_StreamContentParser::Handle_SetHorzScale},
322 {FXBSTR_ID(
'W', 0, 0, 0), &CPDF_StreamContentParser::Handle_Clip},
323 {FXBSTR_ID(
'W',
'*', 0, 0), &CPDF_StreamContentParser::Handle_EOClip},
324 {FXBSTR_ID(
'b', 0, 0, 0),
325 &CPDF_StreamContentParser::Handle_CloseFillStrokePath},
326 {FXBSTR_ID(
'b',
'*', 0, 0),
327 &CPDF_StreamContentParser::Handle_CloseEOFillStrokePath},
328 {FXBSTR_ID(
'c', 0, 0, 0), &CPDF_StreamContentParser::Handle_CurveTo_123},
329 {FXBSTR_ID(
'c',
'm', 0, 0),
330 &CPDF_StreamContentParser::Handle_ConcatMatrix},
331 {FXBSTR_ID(
'c',
's', 0, 0),
332 &CPDF_StreamContentParser::Handle_SetColorSpace_Fill},
333 {FXBSTR_ID(
'd', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetDash},
334 {FXBSTR_ID(
'd',
'0', 0, 0),
335 &CPDF_StreamContentParser::Handle_SetCharWidth},
336 {FXBSTR_ID(
'd',
'1', 0, 0),
337 &CPDF_StreamContentParser::Handle_SetCachedDevice},
338 {FXBSTR_ID(
'f', 0, 0, 0), &CPDF_StreamContentParser::Handle_FillPath},
339 {FXBSTR_ID(
'f',
'*', 0, 0), &CPDF_StreamContentParser::Handle_EOFillPath},
340 {FXBSTR_ID(
'g', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetGray_Fill},
341 {FXBSTR_ID(
'g',
's', 0, 0),
342 &CPDF_StreamContentParser::Handle_SetExtendGraphState},
343 {FXBSTR_ID(
'h', 0, 0, 0), &CPDF_StreamContentParser::Handle_ClosePath},
344 {FXBSTR_ID(
'i', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetFlat},
345 {FXBSTR_ID(
'j', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetLineJoin},
346 {FXBSTR_ID(
'k', 0, 0, 0),
347 &CPDF_StreamContentParser::Handle_SetCMYKColor_Fill},
348 {FXBSTR_ID(
'l', 0, 0, 0), &CPDF_StreamContentParser::Handle_LineTo},
349 {FXBSTR_ID(
'm', 0, 0, 0), &CPDF_StreamContentParser::Handle_MoveTo},
350 {FXBSTR_ID(
'n', 0, 0, 0), &CPDF_StreamContentParser::Handle_EndPath},
351 {FXBSTR_ID(
'q', 0, 0, 0),
352 &CPDF_StreamContentParser::Handle_SaveGraphState},
353 {FXBSTR_ID(
'r',
'e', 0, 0), &CPDF_StreamContentParser::Handle_Rectangle},
354 {FXBSTR_ID(
'r',
'g', 0, 0),
355 &CPDF_StreamContentParser::Handle_SetRGBColor_Fill},
356 {FXBSTR_ID(
'r',
'i', 0, 0),
357 &CPDF_StreamContentParser::Handle_SetRenderIntent},
358 {FXBSTR_ID(
's', 0, 0, 0),
359 &CPDF_StreamContentParser::Handle_CloseStrokePath},
360 {FXBSTR_ID(
's',
'c', 0, 0),
361 &CPDF_StreamContentParser::Handle_SetColor_Fill},
362 {FXBSTR_ID(
's',
'c',
'n', 0),
363 &CPDF_StreamContentParser::Handle_SetColorPS_Fill},
364 {FXBSTR_ID(
's',
'h', 0, 0), &CPDF_StreamContentParser::Handle_ShadeFill},
365 {FXBSTR_ID(
'v', 0, 0, 0), &CPDF_StreamContentParser::Handle_CurveTo_23},
366 {FXBSTR_ID(
'w', 0, 0, 0), &CPDF_StreamContentParser::Handle_SetLineWidth},
367 {FXBSTR_ID(
'y', 0, 0, 0), &CPDF_StreamContentParser::Handle_CurveTo_13},
379 RetainPtr<CPDF_Dictionary> pPageResources,
380 RetainPtr<CPDF_Dictionary> pParentResources,
397 if (pmtContentToUser)
398 m_mtContentToUser
= *pmtContentToUser;
400 *m_pCurStates = *pStates;
402 m_pCurStates->mutable_general_state().Emplace();
403 m_pCurStates->mutable_graph_state().Emplace();
404 m_pCurStates->mutable_text_state().Emplace();
405 m_pCurStates->mutable_color_state().Emplace();
409 m_ContentMarksStack.push(std::make_unique<CPDF_ContentMarks>());
417 if (m_ParamCount == kParamBufSize) {
419 if (m_ParamStartPos == kParamBufSize) {
422 if (m_ParamBuf[m_ParamStartPos].m_Type == ContentParam::Type::kObject)
423 m_ParamBuf[m_ParamStartPos].m_pObject.Reset();
425 return m_ParamStartPos;
427 int index = m_ParamStartPos + m_ParamCount;
428 if (index >= kParamBufSize) {
429 index -= kParamBufSize;
436 ContentParam& param = m_ParamBuf[GetNextParamPos()];
437 param.m_Type = ContentParam::Type::kName;
438 param.m_Name = PDF_NameDecode(bsName);
442 ContentParam& param = m_ParamBuf[GetNextParamPos()];
443 param.m_Type = ContentParam::Type::kNumber;
448 ContentParam& param = m_ParamBuf[GetNextParamPos()];
449 param.m_Type = ContentParam::Type::kObject;
450 param.m_pObject =
std::move(pObj);
454 uint32_t index = m_ParamStartPos;
455 for (uint32_t i = 0; i < m_ParamCount; i++) {
456 if (m_ParamBuf[index].m_Type == ContentParam::Type::kObject)
457 m_ParamBuf[index].m_pObject.Reset();
459 if (index == kParamBufSize)
467 if (index >= m_ParamCount) {
470 int real_index = m_ParamStartPos + m_ParamCount - index - 1;
471 if (real_index >= kParamBufSize) {
472 real_index -= kParamBufSize;
474 ContentParam& param = m_ParamBuf[real_index];
475 if (param.m_Type == ContentParam::Type::kNumber) {
476 param.m_Type = ContentParam::Type::kObject;
478 param.m_Number.IsInteger()
479 ? pdfium::MakeRetain<CPDF_Number>(param.m_Number.GetSigned())
480 : pdfium::MakeRetain<CPDF_Number>(param.m_Number.GetFloat());
481 return param.m_pObject;
483 if (param.m_Type == ContentParam::Type::kName) {
484 param.m_Type = ContentParam::Type::kObject;
485 param.m_pObject = m_pDocument->New<CPDF_Name>(param.m_Name);
486 return param.m_pObject;
488 if (param.m_Type == ContentParam::Type::kObject)
489 return param.m_pObject;
491 NOTREACHED_NORETURN();
495 if (index >= m_ParamCount)
498 int real_index = m_ParamStartPos + m_ParamCount - index - 1;
499 if (real_index >= kParamBufSize)
500 real_index -= kParamBufSize;
502 const ContentParam& param = m_ParamBuf[real_index];
503 if (param.m_Type == ContentParam::Type::kName)
506 if (param.m_Type == ContentParam::Type::kObject && param.m_pObject)
507 return param.m_pObject->GetString();
513 if (index >= m_ParamCount)
516 int real_index = m_ParamStartPos + m_ParamCount - index - 1;
517 if (real_index >= kParamBufSize)
518 real_index -= kParamBufSize;
520 const ContentParam& param = m_ParamBuf[real_index];
521 if (param.m_Type == ContentParam::Type::kNumber)
522 return param.m_Number.GetFloat();
524 if (param.m_Type == ContentParam::Type::kObject && param.m_pObject)
525 return param.m_pObject->GetNumber();
531 std::vector<
float> values(count);
532 for (size_t i = 0; i < count; ++i)
533 values[i] = GetNumber(count - i - 1);
538 return CFX_PointF(GetNumber(index + 1), GetNumber(index));
542 return CFX_Matrix(GetNumber(5)
, GetNumber(4)
, GetNumber(3)
, GetNumber(2)
,
543 GetNumber(1)
, GetNumber(0)
);
550 pObj->mutable_general_state() = m_pCurStates->general_state();
551 pObj->mutable_clip_path() = m_pCurStates->clip_path();
552 pObj->SetContentMarks(*m_ContentMarksStack.top());
554 pObj->mutable_color_state() = m_pCurStates->color_state();
557 pObj->mutable_graph_state() = m_pCurStates->graph_state();
560 pObj->mutable_text_state() = m_pCurStates->text_state();
565 auto it = g_opcodes->find(op.GetID());
566 if (it != g_opcodes->end()) {
567 (
this->*it->second)();
581 AddPathPointAndClose(m_PathStart, CFX_Path::Point::Type::kLine);
594 ByteString tag = GetString(1);
595 std::unique_ptr<CPDF_ContentMarks> new_marks =
596 m_ContentMarksStack.top()->Clone();
598 if (pProperty->IsName()) {
599 ByteString property_name = pProperty->GetString();
600 RetainPtr<CPDF_Dictionary> pHolder = FindResourceHolder(
"Properties");
601 if (!pHolder || !pHolder->GetDictFor(property_name))
603 new_marks->AddMarkWithPropertiesHolder(tag,
std::move(pHolder),
605 }
else if (pProperty->IsDictionary()) {
606 new_marks->AddMarkWithDirectDict(tag, ToDictionary(pProperty));
610 m_ContentMarksStack.push(std::move(new_marks));
615 auto pDict = m_pDocument->New<CPDF_Dictionary>();
619 if (m_pSyntax->GetWord() !=
"ID") {
620 m_pSyntax->SetPos(savePos);
627 auto word = m_pSyntax->GetWord();
628 ByteString key(word.Last(word.GetLength() - 1));
629 auto pObj = m_pSyntax->ReadNextObject(
false,
false, 0);
630 if (pObj && !pObj->IsInline()) {
631 pDict->SetNewFor<CPDF_Reference>(key, m_pDocument, pObj->GetObjNum());
633 pDict->SetFor(key,
std::move(pObj));
638 if (pDict->KeyExist(
"ColorSpace")) {
639 pCSObj = pDict->GetDirectObjectFor(
"ColorSpace");
640 if (pCSObj->IsName()) {
641 ByteString name = pCSObj->GetString();
642 if (name
!= "DeviceRGB" && name
!= "DeviceGray" && name
!= "DeviceCMYK") {
643 pCSObj = FindResourceObj(
"ColorSpace", name);
644 if (pCSObj && pCSObj->IsInline())
645 pDict->SetFor(
"ColorSpace", pCSObj->Clone());
649 pDict->SetNewFor<CPDF_Name>(
"Subtype",
"Image");
651 m_pSyntax->ReadInlineStream(m_pDocument, std::move(pDict), pCSObj.Get());
660 if (m_pSyntax->GetWord() ==
"EI")
663 CPDF_ImageObject* pObj = AddImageFromStream(
std::move(pStream),
"");
666 if (pObj && pObj->GetImage()->IsMask())
667 m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
671 std::unique_ptr<CPDF_ContentMarks> new_marks =
672 m_ContentMarksStack.top()->Clone();
673 new_marks->AddMark(GetString(0));
674 m_ContentMarksStack.push(std::move(new_marks));
678 m_pCurStates->set_text_matrix(CFX_Matrix());
679 OnChangeTextMatrix();
680 m_pCurStates->ResetTextPosition();
684 AddPathPoint(GetPoint(4), CFX_Path::Point::Type::kBezier);
685 AddPathPoint(GetPoint(2), CFX_Path::Point::Type::kBezier);
686 AddPathPoint(GetPoint(0), CFX_Path::Point::Type::kBezier);
690 m_pCurStates->prepend_to_current_transformation_matrix(GetMatrix());
691 OnChangeTextMatrix();
699 m_pCurStates->mutable_color_state().GetMutableFillColor()->SetColorSpace(
708 m_pCurStates->mutable_color_state().GetMutableStrokeColor()->SetColorSpace(
713 RetainPtr<CPDF_Array> pArray = ToArray(GetObject(1));
717 m_pCurStates->SetLineDash(pArray.Get(), GetNumber(0), 1.0f);
721 m_Type3Data[0] = GetNumber(1);
722 m_Type3Data[1] = GetNumber(0);
727 for (
int i = 0; i < 6; i++) {
728 m_Type3Data[i] = GetNumber(5 - i);
734 ByteString name = GetString(0);
735 if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() &&
736 m_pLastImage->GetStream()->GetObjNum()) {
737 CPDF_ImageObject* pObj = AddLastImage();
740 if (pObj && pObj->GetImage()->IsMask())
741 m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
745 RetainPtr<CPDF_Stream> pXObject(ToStream(FindResourceObj(
"XObject", name)));
750 if (pXObject->GetDict())
751 type = pXObject->GetDict()->GetByteStringFor(
"Subtype");
753 if (type
== "Form") {
754 if (m_RecursionState->form_count > kFormCountLimit) {
758 const bool is_first = m_RecursionState->form_count == 0;
759 ++m_RecursionState->form_count;
760 AddForm(
std::move(pXObject), name);
762 m_RecursionState->form_count = 0;
767 if (type
== "Image") {
768 CPDF_ImageObject* pObj =
770 ? AddImageFromStream(ToStream(pXObject->Clone()), name)
771 : AddImageFromStreamObjNum(pXObject->GetObjNum(), name);
773 m_LastImageName = std::move(name);
775 m_pLastImage = pObj->GetImage();
776 if (m_pLastImage->IsMask())
777 m_pObjectHolder->AddImageMaskBoundingBox(pObj->GetRect());
783 const ByteString& name) {
785 status.mutable_general_state() = m_pCurStates->general_state();
786 status.mutable_graph_state() = m_pCurStates->graph_state();
787 status.mutable_color_state() = m_pCurStates->color_state();
788 status.mutable_text_state() = m_pCurStates->text_state();
789 auto form = std::make_unique<CPDF_Form>(
790 m_pDocument, m_pPageResources, std::move(pStream), m_pResources.Get());
791 form->ParseContent(&status,
nullptr, m_RecursionState);
794 m_pCurStates->current_transformation_matrix() * m_mtContentToUser;
795 auto pFormObj =
std::make_unique<CPDF_FormObject>(GetCurrentStreamIndex(),
796 std::move(form), matrix);
797 pFormObj->SetResourceName(name);
798 if (!m_pObjectHolder->BackgroundAlphaNeeded() &&
799 pFormObj->form()->BackgroundAlphaNeeded()) {
800 m_pObjectHolder->SetBackgroundAlphaNeeded(
true);
802 pFormObj->CalcBoundingBox();
803 SetGraphicStates(pFormObj.get(),
true,
true,
true);
804 m_pObjectHolder->AppendPageObject(std::move(pFormObj));
809 const ByteString& name) {
813 auto pImageObj =
std::make_unique<CPDF_ImageObject>(GetCurrentStreamIndex());
814 pImageObj->SetResourceName(name);
816 pdfium::MakeRetain<CPDF_Image>(m_pDocument, std::move(pStream)));
818 return AddImageObject(std::move(pImageObj));
822 uint32_t stream_obj_num,
823 const ByteString& name) {
824 auto pImageObj =
std::make_unique<CPDF_ImageObject>(GetCurrentStreamIndex());
825 pImageObj->SetResourceName(name);
827 CPDF_DocPageData::FromDocument(m_pDocument)->GetImage(stream_obj_num));
829 return AddImageObject(std::move(pImageObj));
833 DCHECK(m_pLastImage);
835 auto pImageObj =
std::make_unique<CPDF_ImageObject>(GetCurrentStreamIndex());
836 pImageObj->SetResourceName(m_LastImageName);
837 pImageObj->SetImage(CPDF_DocPageData::FromDocument(m_pDocument)
838 ->GetImage(m_pLastImage->GetStream()->GetObjNum()));
840 return AddImageObject(std::move(pImageObj));
844 std::unique_ptr<CPDF_ImageObject> pImageObj) {
845 SetGraphicStates(pImageObj.get(), pImageObj->GetImage()->IsMask(),
false,
849 m_pCurStates->current_transformation_matrix() * m_mtContentToUser;
850 pImageObj->SetImageMatrix(ImageMatrix);
852 CPDF_ImageObject* pRet = pImageObj.get();
853 m_pObjectHolder->AppendPageObject(std::move(pImageObj));
858 DCHECK(m_ParamCount > 0);
859 return GetNumbers(m_ParamCount);
863 DCHECK(m_ParamCount > 0);
864 const uint32_t nvalues = m_ParamCount - 1;
865 std::vector<
float> values(nvalues);
866 for (size_t i = 0; i < nvalues; ++i)
867 values[i] = GetNumber(m_ParamCount - i - 1);
878 if (m_ContentMarksStack.size() > 1)
879 m_ContentMarksStack.pop();
883 if (m_ClipTextList.empty())
886 if (TextRenderingModeIsClipMode(m_pCurStates->text_state().GetTextMode())) {
887 m_pCurStates->mutable_clip_path().AppendTexts(&m_ClipTextList);
890 m_ClipTextList.clear();
906 m_pCurStates->mutable_color_state().SetFillColor(
907 CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceGray),
912 m_pCurStates->mutable_color_state().SetStrokeColor(
913 CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceGray),
918 ByteString name = GetString(0);
920 ToDictionary(FindResourceObj(
"ExtGState", name));
925 m_pCurStates->mutable_general_state().AppendGraphicsResourceName(
927 m_pCurStates->ProcessExtGS(pGS.Get(),
this);
931 if (m_PathPoints.empty())
934 if (m_PathStart.x != m_PathCurrent.x || m_PathStart.y != m_PathCurrent.y) {
935 AddPathPointAndClose(m_PathStart, CFX_Path::Point::Type::kLine);
937 m_PathPoints.back().m_CloseFigure =
true;
942 m_pCurStates->mutable_general_state().SetFlatness(GetNumber(0));
948 m_pCurStates->mutable_graph_state().SetLineJoin(
949 static_cast<CFX_GraphStateData::LineJoin>(GetInteger(0)));
953 m_pCurStates->mutable_graph_state().SetLineCap(
954 static_cast<CFX_GraphStateData::LineCap>(GetInteger(0)));
958 if (m_ParamCount != 4)
961 m_pCurStates->mutable_color_state().SetFillColor(
962 CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceCMYK),
967 if (m_ParamCount != 4)
970 m_pCurStates->mutable_color_state().SetStrokeColor(
971 CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceCMYK),
976 if (m_ParamCount != 2)
979 AddPathPoint(GetPoint(0), CFX_Path::Point::Type::kLine);
983 if (m_ParamCount != 2)
986 AddPathPoint(GetPoint(0), CFX_Path::Point::Type::kMove);
991 m_pCurStates->mutable_graph_state().SetMiterLimit(GetNumber(0));
1001 m_StateStack.push_back(std::make_unique<CPDF_AllStates>(*m_pCurStates));
1005 if (m_StateStack.empty())
1007 *m_pCurStates = *m_StateStack.back();
1008 m_StateStack.pop_back();
1012 float x = GetNumber(3);
1013 float y = GetNumber(2);
1014 float w = GetNumber(1);
1015 float h = GetNumber(0);
1016 AddPathRect(x, y, w, h);
1028 if (m_ParamCount != 3)
1031 m_pCurStates->mutable_color_state().SetFillColor(
1032 CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceRGB),
1037 if (m_ParamCount != 3)
1040 m_pCurStates->mutable_color_state().SetStrokeColor(
1041 CPDF_ColorSpace::GetStockCS(CPDF_ColorSpace::Family::kDeviceRGB),
1057 int nargs =
std::min(m_ParamCount, 4U);
1058 m_pCurStates->mutable_color_state().SetFillColor(
nullptr, GetNumbers(nargs));
1062 int nargs =
std::min(m_ParamCount, 4U);
1063 m_pCurStates->mutable_color_state().SetStrokeColor(
nullptr,
1072 if (!pLastParam->IsName()) {
1073 m_pCurStates->mutable_color_state().SetFillColor(
nullptr, GetColors());
1083 std::vector<
float> values = GetNamedColors();
1084 m_pCurStates->mutable_color_state().SetFillPattern(std::move(pPattern),
1093 if (!pLastParam->IsName()) {
1094 m_pCurStates->mutable_color_state().SetStrokeColor(
nullptr, GetColors());
1104 std::vector<
float> values = GetNamedColors();
1105 m_pCurStates->mutable_color_state().SetStrokePattern(std::move(pPattern),
1110 RetainPtr<CPDF_ShadingPattern> pShading = FindShading(GetString(0));
1114 if (!pShading->IsShadingObject() || !pShading->Load())
1118 m_pCurStates->current_transformation_matrix() * m_mtContentToUser;
1119 auto pObj =
std::make_unique<CPDF_ShadingObject>(GetCurrentStreamIndex(),
1121 SetGraphicStates(pObj.get(),
false,
false,
false);
1123 pObj->clip_path().HasRef() ? pObj->clip_path().GetClipBox() : m_BBox;
1124 if (pShading->IsMeshShading())
1125 bbox
.Intersect(GetShadingBBox(pShading.Get(), pObj->matrix())
);
1126 pObj->SetRect(bbox);
1127 m_pObjectHolder->AppendPageObject(std::move(pObj));
1131 m_pCurStates->mutable_text_state().SetCharSpace(GetNumber(0));
1135 m_pCurStates->MoveTextPoint(GetPoint(0));
1139 Handle_MoveTextPoint();
1140 m_pCurStates->set_text_leading(-GetNumber(0));
1144 m_pCurStates->mutable_text_state().SetFontSize(GetNumber(0));
1147 m_pCurStates->mutable_text_state().SetFont(std::move(pFont));
1151 const ByteString& type) {
1155 RetainPtr<CPDF_Dictionary> pDict = m_pResources->GetMutableDictFor(type);
1159 if (m_pResources == m_pPageResources || !m_pPageResources)
1162 return m_pPageResources->GetMutableDictFor(type);
1166 const ByteString& type,
1167 const ByteString& name) {
1168 RetainPtr<CPDF_Dictionary> pHolder = FindResourceHolder(type);
1169 return pHolder ? pHolder->GetMutableDirectObjectFor(name) :
nullptr;
1173 const ByteString& name) {
1175 ToDictionary(FindResourceObj(
"Font", name)));
1177 return CPDF_Font::GetStockFont(m_pDocument, CFX_Font::kDefaultAnsiFontName);
1180 ->GetFont(std::move(pFontDict));
1184 pFont->SetResourceName(name);
1185 if (pFont->IsType3Font()) {
1186 pFont->AsType3Font()->SetPageResources(m_pResources.Get());
1187 pFont->AsType3Font()->CheckType3FontMetrics();
1194 const ByteString& name) {
1195 if (name
== "Pattern")
1198 if (name
== "DeviceGray" || name
== "DeviceCMYK" || name
== "DeviceRGB") {
1199 ByteString defname =
"Default";
1200 defname += name.Last(name.GetLength() - 7);
1202 FindResourceObj(
"ColorSpace", defname);
1204 if (name
== "DeviceGray") {
1208 if (name
== "DeviceRGB")
1213 return CPDF_DocPageData::FromDocument(m_pDocument)
1214 ->GetColorSpace(pDefObj.Get(),
nullptr);
1219 return CPDF_DocPageData::FromDocument(m_pDocument)
1220 ->GetColorSpace(pCSObj.Get(),
nullptr);
1224 const ByteString& name) {
1226 if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream()))
1228 return CPDF_DocPageData::FromDocument(m_pDocument)
1229 ->GetPattern(std::move(pPattern), m_pCurStates->parent_matrix());
1233 const ByteString& name) {
1235 if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream()))
1237 return CPDF_DocPageData::FromDocument(m_pDocument)
1238 ->GetShading(std::move(pPattern), m_pCurStates->parent_matrix());
1243 const std::vector<
float>& kernings,
1249 if (fInitKerning != 0) {
1250 if (pFont->IsVertWriting())
1251 m_pCurStates->IncrementTextPositionY(-GetVerticalTextSize(fInitKerning));
1253 m_pCurStates->IncrementTextPositionX(
1254 -GetHorizontalTextSize(fInitKerning));
1260 pFont->IsType3Font() ? TextRenderingMode::MODE_FILL
1261 : m_pCurStates->text_state().GetTextMode();
1263 auto pText =
std::make_unique<CPDF_TextObject>(GetCurrentStreamIndex());
1264 pText->SetResourceName(pFont->GetResourceName());
1265 SetGraphicStates(pText.get(),
true,
true,
true);
1267 const CFX_Matrix& ctm = m_pCurStates->current_transformation_matrix();
1268 pdfium::span<
float> text_ctm =
1269 pText->mutable_text_state().GetMutableCTM();
1270 text_ctm[0] = ctm
.a;
1271 text_ctm[1] = ctm
.c;
1272 text_ctm[2] = ctm
.b;
1273 text_ctm[3] = ctm
.d;
1275 pText->SetSegments(pStrs, kernings, nSegs);
1276 pText->SetPosition(m_mtContentToUser.Transform(
1277 m_pCurStates->GetTransformedTextPosition()));
1279 const CFX_PointF position =
1280 pText->CalcPositionData(m_pCurStates->text_horz_scale());
1281 m_pCurStates->IncrementTextPositionX(position.x);
1282 m_pCurStates->IncrementTextPositionY(position.y);
1283 if (TextRenderingModeIsClipMode(text_mode))
1284 m_ClipTextList.push_back(pText->Clone());
1285 m_pObjectHolder->AppendPageObject(std::move(pText));
1287 if (!kernings.empty() && kernings[nSegs - 1] != 0) {
1288 if (pFont->IsVertWriting())
1289 m_pCurStates->IncrementTextPositionY(
1290 -GetVerticalTextSize(kernings[nSegs - 1]));
1292 m_pCurStates->IncrementTextPositionX(
1293 -GetHorizontalTextSize(kernings[nSegs - 1]));
1298 return GetVerticalTextSize(fKerning) * m_pCurStates->text_horz_scale();
1302 return fKerning * m_pCurStates->text_state().GetFontSize() / 1000;
1307 std::upper_bound(m_StreamStartOffsets.begin(), m_StreamStartOffsets.end(),
1308 m_pSyntax->GetPos() + m_StartParseOffset);
1309 return (it - m_StreamStartOffsets.begin()) - 1;
1313 ByteString str = GetString(0);
1315 AddTextObject(&str, 0, std::vector<
float>(), 1);
1319 RetainPtr<CPDF_Array> pArray = ToArray(GetObject(0));
1323 size_t n = pArray->size();
1325 for (size_t i = 0; i < n; i++) {
1327 if (pDirectObject && pDirectObject->IsString())
1331 for (size_t i = 0; i < n; i++) {
1332 float fKerning = pArray->GetFloatAt(i);
1334 m_pCurStates->IncrementTextPositionX(-GetHorizontalTextSize(fKerning));
1338 std::vector<ByteString> strs(nsegs);
1339 std::vector<
float> kernings(nsegs);
1340 size_t iSegment = 0;
1341 float fInitKerning = 0;
1342 for (size_t i = 0; i < n; i++) {
1347 if (pObj->IsString()) {
1348 ByteString str = pObj->GetString();
1351 strs[iSegment] =
std::move(str);
1352 kernings[iSegment++] = 0;
1354 float num = pObj->GetNumber();
1356 fInitKerning += num;
1358 kernings[iSegment - 1] += num;
1361 AddTextObject(strs.data(), fInitKerning, kernings, iSegment);
1365 m_pCurStates->set_text_leading(GetNumber(0));
1369 m_pCurStates->set_text_matrix(GetMatrix());
1370 OnChangeTextMatrix();
1371 m_pCurStates->ResetTextPosition();
1375 CFX_Matrix text_matrix(m_pCurStates->text_horz_scale(), 0.0f, 0.0f, 1.0f,
1377 text_matrix.Concat(m_pCurStates->text_matrix());
1378 text_matrix.Concat(m_pCurStates->current_transformation_matrix());
1380 pdfium::span<
float> pTextMatrix =
1381 m_pCurStates->mutable_text_state().GetMutableMatrix();
1382 pTextMatrix[0] = text_matrix
.a;
1383 pTextMatrix[1] = text_matrix
.c;
1384 pTextMatrix[2] = text_matrix
.b;
1385 pTextMatrix[3] = text_matrix
.d;
1390 if (SetTextRenderingModeFromInt(GetInteger(0), &mode))
1391 m_pCurStates->mutable_text_state().SetTextMode(mode);
1395 m_pCurStates->set_text_rise(GetNumber(0));
1399 m_pCurStates->mutable_text_state().SetWordSpace(GetNumber(0));
1403 if (m_ParamCount != 1) {
1406 m_pCurStates->set_text_horz_scale(GetNumber(0) / 100);
1407 OnChangeTextMatrix();
1411 m_pCurStates->MoveTextToNextLine();
1415 AddPathPoint(m_PathCurrent, CFX_Path::Point::Type::kBezier);
1416 AddPathPoint(GetPoint(2), CFX_Path::Point::Type::kBezier);
1417 AddPathPoint(GetPoint(0), CFX_Path::Point::Type::kBezier);
1421 m_pCurStates->mutable_graph_state().SetLineWidth(GetNumber(0));
1433 AddPathPoint(GetPoint(2), CFX_Path::Point::Type::kBezier);
1434 AddPathPoint(GetPoint(0), CFX_Path::Point::Type::kBezier);
1435 AddPathPoint(GetPoint(0), CFX_Path::Point::Type::kBezier);
1439 Handle_MoveToNextLine();
1444 m_pCurStates->mutable_text_state().SetWordSpace(GetNumber(2));
1445 m_pCurStates->mutable_text_state().SetCharSpace(GetNumber(1));
1446 Handle_NextLineShowText();
1455 if (type == CFX_Path::Point::Type::kMove && !m_PathPoints.empty() &&
1456 !m_PathPoints.back().m_CloseFigure &&
1457 m_PathPoints.back().m_Type == type && m_PathCurrent == point) {
1461 m_PathCurrent = point;
1463 m_PathStart = point;
1464 if (!m_PathPoints.empty() &&
1465 m_PathPoints.back().IsTypeAndOpen(CFX_Path::Point::Type::kMove)) {
1466 m_PathPoints.back().m_Point = point;
1469 }
else if (m_PathPoints.empty()) {
1472 m_PathPoints.emplace_back(point, type,
false);
1476 const CFX_PointF& point,
1478 m_PathCurrent = point;
1479 if (m_PathPoints.empty())
1482 m_PathPoints.emplace_back(point, type,
true);
1487 RenderType render_type) {
1488 std::vector<CFX_Path::Point> path_points;
1489 path_points.swap(m_PathPoints);
1493 if (path_points.empty())
1496 if (path_points.size() == 1) {
1500 m_pCurStates->mutable_clip_path().AppendPathWithAutoMerge(
1501 path, CFX_FillRenderOptions::FillType::kWinding);
1506 if (point.m_Type != CFX_Path::Point::Type::kMove || !point.m_CloseFigure ||
1507 m_pCurStates->graph_state().GetLineCap() !=
1508 CFX_GraphStateData::LineCap::kRound) {
1522 path_points.pop_back();
1525 for (
const auto& point : path_points) {
1526 if (point.m_CloseFigure)
1527 path.AppendPointAndClose(point.m_Point, point.m_Type);
1529 path.AppendPoint(point.m_Point, point.m_Type);
1533 m_pCurStates->current_transformation_matrix() * m_mtContentToUser;
1534 bool bStroke = render_type == RenderType::kStroke;
1536 auto pPathObj =
std::make_unique<CPDF_PathObject>(GetCurrentStreamIndex());
1537 pPathObj->set_stroke(bStroke);
1538 pPathObj->set_filltype(fill_type);
1539 pPathObj->path() = path;
1540 SetGraphicStates(pPathObj.get(),
true,
false,
true);
1541 pPathObj->SetPathMatrix(matrix);
1542 m_pObjectHolder->AppendPageObject(std::move(pPathObj));
1547 m_pCurStates->mutable_clip_path().AppendPathWithAutoMerge(path,
1553 pdfium::span<
const uint8_t> pData,
1554 uint32_t start_offset,
1556 const std::vector<uint32_t>& stream_start_offsets) {
1557 DCHECK(start_offset < pData.size());
1560 pdfium::span<
const uint8_t> pDataStart = pData.subspan(start_offset);
1561 m_StartParseOffset = start_offset;
1562 if (m_RecursionState->parsed_set.size() > kMaxFormLevel ||
1563 pdfium::Contains(m_RecursionState->parsed_set, pDataStart.data())) {
1564 return fxcrt::CollectionSize<uint32_t>(pDataStart);
1567 m_StreamStartOffsets = stream_start_offsets;
1570 &m_RecursionState->parsed_set, pDataStart.data());
1572 uint32_t init_obj_count = m_pObjectHolder->GetPageObjectCount();
1573 AutoNuller<std::unique_ptr<CPDF_StreamParser>> auto_clearer(&m_pSyntax);
1574 m_pSyntax = std::make_unique<CPDF_StreamParser>(
1575 pDataStart, m_pDocument->GetByteStringPool());
1578 uint32_t cost = m_pObjectHolder->GetPageObjectCount() - init_obj_count;
1579 if (max_cost && cost >= max_cost) {
1582 switch (m_pSyntax->ParseNextElement()) {
1583 case CPDF_StreamParser::ElementType::kEndOfData:
1584 return m_pSyntax->GetPos();
1585 case CPDF_StreamParser::ElementType::kKeyword:
1586 OnOperator(m_pSyntax->GetWord());
1589 case CPDF_StreamParser::ElementType::kNumber:
1590 AddNumberParam(m_pSyntax->GetWord());
1593 auto word = m_pSyntax->GetWord();
1594 AddNameParam(word.Last(word.GetLength() - 1));
1598 AddObjectParam(m_pSyntax->GetObject());
1601 return m_pSyntax->GetPos();
1605 float params[6] = {};
1607 int last_pos = m_pSyntax->GetPos();
1610 bool bProcessed =
true;
1615 ByteStringView strc = m_pSyntax->GetWord();
1616 int len = strc.GetLength();
1619 case kPathOperatorSubpath:
1620 AddPathPoint({params[0], params[1]},
1624 case kPathOperatorLine:
1625 AddPathPoint({params[0], params[1]},
1629 case kPathOperatorCubicBezier1:
1630 AddPathPoint({params[0], params[1]},
1632 AddPathPoint({params[2], params[3]},
1634 AddPathPoint({params[4], params[5]},
1638 case kPathOperatorCubicBezier2:
1639 AddPathPoint(m_PathCurrent, CFX_Path::Point::Type::kBezier);
1640 AddPathPoint({params[0], params[1]},
1642 AddPathPoint({params[2], params[3]},
1646 case kPathOperatorCubicBezier3:
1647 AddPathPoint({params[0], params[1]},
1649 AddPathPoint({params[2], params[3]},
1651 AddPathPoint({params[2], params[3]},
1655 case kPathOperatorClosePath:
1663 }
else if (len == 2) {
1664 if (strc[0] == kPathOperatorRectangle[0] &&
1665 strc[1] == kPathOperatorRectangle[1]) {
1666 AddPathRect(params[0], params[1], params[2], params[3]);
1675 last_pos = m_pSyntax->GetPos();
1691 m_pSyntax->SetPos(last_pos);
1699 ByteStringView abbr) {
1700 return FindFullName(kInlineKeyAbbr, abbr);
1705 ByteStringView abbr) {
1706 return FindFullName(kInlineValueAbbr, abbr);
CFX_FloatRect(const CFX_FloatRect &that)=default
constexpr CFX_FloatRect()=default
void UpdateRect(const CFX_PointF &point)
void Intersect(const CFX_FloatRect &other_rect)
CFX_FloatRect & operator=(const CFX_FloatRect &that)=default
CFX_Matrix & operator=(const CFX_Matrix &other)=default
CFX_FloatRect TransformRect(const CFX_FloatRect &rect) const
CFX_Matrix(float a1, float b1, float c1, float d1, float e1, float f1)
void Concat(const CFX_Matrix &right)
static RetainPtr< CPDF_ColorSpace > GetStockCS(Family family)
CPDF_DictionaryLocker(const CPDF_Dictionary *pDictionary)
uint32_t ComponentBits() const
bool CanReadCoords() const
void SkipBits(uint32_t nbits)
void AppendRect(float left, float bottom, float right, float top)
void Transform(const CFX_Matrix &matrix)
ShadingType GetShadingType() const
CPDF_StreamContentParser(CPDF_Document *pDoc, RetainPtr< CPDF_Dictionary > pPageResources, RetainPtr< CPDF_Dictionary > pParentResources, const CFX_Matrix *pmtContentToUser, CPDF_PageObjectHolder *pObjHolder, RetainPtr< CPDF_Dictionary > pResources, const CFX_FloatRect &rcBBox, const CPDF_AllStates *pStates, CPDF_Form::RecursionState *parse_state)
uint32_t Parse(pdfium::span< const uint8_t > pData, uint32_t start_offset, uint32_t max_cost, const std::vector< uint32_t > &stream_start_offsets)
~CPDF_StreamContentParser()
static void DestroyGlobals()
static ByteStringView FindValueAbbreviationForTesting(ByteStringView abbr)
RetainPtr< CPDF_Font > FindFont(const ByteString &name)
static ByteStringView FindKeyAbbreviationForTesting(ByteStringView abbr)
static void InitializeGlobals()
bool operator==(const char *ptr) const
bool operator!=(const char *ptr) const
@ kTensorProductPatchMeshShading
@ kLatticeFormGouraudTriangleMeshShading
@ kFreeFormGouraudTriangleMeshShading
bool TextRenderingModeIsStrokeMode(const TextRenderingMode &mode)