diff options
author | thestig <thestig@chromium.org> | 2016-04-26 22:41:36 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-26 22:41:36 -0700 |
commit | 12168d764be266a209bc3fd15dbe4223732ae319 (patch) | |
tree | e4a10cbf579ae2b5023474f995fdffbdb5ee9959 /core | |
parent | 931bf37379db7274d0e42f68cf358749cb05ba89 (diff) | |
download | pdfium-12168d764be266a209bc3fd15dbe4223732ae319.tar.xz |
CPDF_Document::LoadPattern() and friends always have a valid matrix.
So pass by const-ref instead of by pointer.
Review URL: https://codereview.chromium.org/1923153002
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_form.cpp | 18 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_pattern.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_pattern.h | 6 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_shadingpattern.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp | 5 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_tilingpattern.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/fpdf_page_doc.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/fpdf_page_parser.cpp | 88 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp | 87 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/include/cpdf_form.h | 13 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/pageint.h | 8 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_document.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/include/cpdf_document.h | 2 |
15 files changed, 110 insertions, 142 deletions
diff --git a/core/fpdfapi/fpdf_page/cpdf_form.cpp b/core/fpdfapi/fpdf_page/cpdf_form.cpp index 54698c60b6..570419f58f 100644 --- a/core/fpdfapi/fpdf_page/cpdf_form.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_form.cpp @@ -18,15 +18,13 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc, CPDF_Dictionary* pParentResources) { m_pDocument = pDoc; m_pFormStream = pFormStream; - m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL; + m_pFormDict = pFormStream ? pFormStream->GetDict() : nullptr; m_pResources = m_pFormDict->GetDictBy("Resources"); m_pPageResources = pPageResources; - if (!m_pResources) { + if (!m_pResources) m_pResources = pParentResources; - } - if (!m_pResources) { + if (!m_pResources) m_pResources = pPageResources; - } m_Transparency = 0; LoadTransInfo(); } @@ -34,23 +32,23 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc, CPDF_Form::~CPDF_Form() {} void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates, - CFX_Matrix* pParentMatrix, + const CFX_Matrix* pParentMatrix, CPDF_Type3Char* pType3Char, int level) { - if (m_ParseState == CONTENT_PARSED || m_ParseState == CONTENT_PARSING) { + if (m_ParseState == CONTENT_PARSED || m_ParseState == CONTENT_PARSING) return; - } + m_pParser.reset(new CPDF_ContentParser); m_pParser->Start(this, pGraphicStates, pParentMatrix, pType3Char, level); m_ParseState = CONTENT_PARSING; } void CPDF_Form::ParseContent(CPDF_AllStates* pGraphicStates, - CFX_Matrix* pParentMatrix, + const CFX_Matrix* pParentMatrix, CPDF_Type3Char* pType3Char, int level) { StartParse(pGraphicStates, pParentMatrix, pType3Char, level); - ContinueParse(NULL); + ContinueParse(nullptr); } CPDF_Form* CPDF_Form::Clone() const { diff --git a/core/fpdfapi/fpdf_page/cpdf_pattern.cpp b/core/fpdfapi/fpdf_page/cpdf_pattern.cpp index 838f4af09b..f8bc9a555f 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pattern.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_pattern.cpp @@ -9,10 +9,10 @@ CPDF_Pattern::CPDF_Pattern(PatternType type, CPDF_Document* pDoc, CPDF_Object* pObj, - const CFX_Matrix* pParentMatrix) - : m_PatternType(type), m_pDocument(pDoc), m_pPatternObj(pObj) { - if (pParentMatrix) - m_ParentMatrix = *pParentMatrix; -} + const CFX_Matrix& parentMatrix) + : m_PatternType(type), + m_pDocument(pDoc), + m_pPatternObj(pObj), + m_ParentMatrix(parentMatrix) {} CPDF_Pattern::~CPDF_Pattern() {} diff --git a/core/fpdfapi/fpdf_page/cpdf_pattern.h b/core/fpdfapi/fpdf_page/cpdf_pattern.h index d6ef49c7fb..983c9eab3f 100644 --- a/core/fpdfapi/fpdf_page/cpdf_pattern.h +++ b/core/fpdfapi/fpdf_page/cpdf_pattern.h @@ -27,19 +27,19 @@ class CPDF_Pattern { CPDF_Document* document() { return m_pDocument; } CPDF_Object* pattern_obj() { return m_pPatternObj; } CFX_Matrix* pattern_to_form() { return &m_Pattern2Form; } - CFX_Matrix* parent_matrix() { return &m_ParentMatrix; } + const CFX_Matrix& parent_matrix() const { return m_ParentMatrix; } protected: CPDF_Pattern(PatternType type, CPDF_Document* pDoc, CPDF_Object* pObj, - const CFX_Matrix* pParentMatrix); + const CFX_Matrix& parentMatrix); const PatternType m_PatternType; CPDF_Document* const m_pDocument; CPDF_Object* const m_pPatternObj; CFX_Matrix m_Pattern2Form; - CFX_Matrix m_ParentMatrix; + const CFX_Matrix m_ParentMatrix; }; #endif // CORE_FPDFAPI_FPDF_PAGE_CPDF_PATTERN_H_ diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp index 457de9667a..b7174b4451 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.cpp @@ -25,7 +25,7 @@ ShadingType ToShadingType(int type) { CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, FX_BOOL bShading, - const CFX_Matrix* parentMatrix) + const CFX_Matrix& parentMatrix) : CPDF_Pattern(SHADING, pDoc, bShading ? nullptr : pPatternObj, @@ -40,8 +40,7 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); m_Pattern2Form = pDict->GetMatrixBy("Matrix"); m_pShadingObj = pDict->GetDirectObjectBy("Shading"); - if (parentMatrix) - m_Pattern2Form.Concat(*parentMatrix); + m_Pattern2Form.Concat(parentMatrix); } for (size_t i = 0; i < FX_ArraySize(m_pFunctions); ++i) m_pFunctions[i] = nullptr; diff --git a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h index 7e5a24d4fe..1872764a61 100644 --- a/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h +++ b/core/fpdfapi/fpdf_page/cpdf_shadingpattern.h @@ -34,7 +34,7 @@ class CPDF_ShadingPattern : public CPDF_Pattern { CPDF_ShadingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, FX_BOOL bShading, - const CFX_Matrix* parentMatrix); + const CFX_Matrix& parentMatrix); ~CPDF_ShadingPattern() override; diff --git a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp index 3ace57063c..0b1eeab9f4 100644 --- a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.cpp @@ -13,13 +13,12 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, - const CFX_Matrix* parentMatrix) + const CFX_Matrix& parentMatrix) : CPDF_Pattern(TILING, pDoc, pPatternObj, parentMatrix) { CPDF_Dictionary* pDict = m_pPatternObj->GetDict(); m_Pattern2Form = pDict->GetMatrixBy("Matrix"); m_bColored = pDict->GetIntegerBy("PaintType") == 1; - if (parentMatrix) - m_Pattern2Form.Concat(*parentMatrix); + m_Pattern2Form.Concat(parentMatrix); } CPDF_TilingPattern::~CPDF_TilingPattern() { diff --git a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.h b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.h index 5936307271..3e62810363 100644 --- a/core/fpdfapi/fpdf_page/cpdf_tilingpattern.h +++ b/core/fpdfapi/fpdf_page/cpdf_tilingpattern.h @@ -21,7 +21,7 @@ class CPDF_TilingPattern : public CPDF_Pattern { public: CPDF_TilingPattern(CPDF_Document* pDoc, CPDF_Object* pPatternObj, - const CFX_Matrix* parentMatrix); + const CFX_Matrix& parentMatrix); ~CPDF_TilingPattern() override; CPDF_TilingPattern* AsTilingPattern() override { return this; } diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp index dfc21b47cb..8287ea562d 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp @@ -316,7 +316,7 @@ void CPDF_DocPageData::ReleaseColorSpace(CPDF_Object* pColorSpace) { CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, - const CFX_Matrix* matrix) { + const CFX_Matrix& matrix) { if (!pPatternObj) return nullptr; diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 1f10b4ea4e..93ea93dee7 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -12,6 +12,7 @@ #include "core/fpdfapi/fpdf_font/cpdf_type3font.h" #include "core/fpdfapi/fpdf_font/include/cpdf_font.h" #include "core/fpdfapi/fpdf_page/cpdf_allstates.h" +#include "core/fpdfapi/fpdf_page/cpdf_meshstream.h" #include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" #include "core/fpdfapi/fpdf_page/include/cpdf_form.h" #include "core/fpdfapi/fpdf_page/include/cpdf_formobject.h" @@ -33,6 +34,12 @@ namespace { +const int kSingleCoordinatePair = 1; +const int kTensorCoordinatePairs = 16; +const int kCoonsCoordinatePairs = 12; +const int kSingleColorPerPatch = 1; +const int kQuadColorsPerPatch = 4; + const char kPathOperatorSubpath = 'm'; const char kPathOperatorLine = 'l'; const char kPathOperatorCubicBezier1 = 'c'; @@ -90,6 +97,64 @@ CFX_ByteStringC PDF_FindFullName(const PDF_AbbrPair* table, : CFX_ByteStringC(); } +CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream, + ShadingType type, + const CFX_Matrix& matrix, + CPDF_Function** pFuncs, + int nFuncs, + CPDF_ColorSpace* pCS) { + if (!pStream || !pFuncs || !pCS) + return CFX_FloatRect(0, 0, 0, 0); + + CPDF_MeshStream stream; + if (!stream.Load(pStream, pFuncs, nFuncs, pCS)) + return CFX_FloatRect(0, 0, 0, 0); + + CFX_FloatRect rect; + bool bStarted = false; + bool bGouraud = type == kFreeFormGouraudTriangleMeshShading || + type == kLatticeFormGouraudTriangleMeshShading; + + int point_count = kSingleCoordinatePair; + if (type == kTensorProductPatchMeshShading) + point_count = kTensorCoordinatePairs; + else if (type == kCoonsPatchMeshShading) + point_count = kCoonsCoordinatePairs; + + int color_count = kSingleColorPerPatch; + if (type == kCoonsPatchMeshShading || type == kTensorProductPatchMeshShading) + color_count = kQuadColorsPerPatch; + + while (!stream.m_BitStream.IsEOF()) { + uint32_t flag = 0; + if (type != kLatticeFormGouraudTriangleMeshShading) + flag = stream.GetFlag(); + + if (!bGouraud && flag) { + point_count -= 4; + color_count -= 2; + } + + for (int i = 0; i < point_count; i++) { + FX_FLOAT x; + FX_FLOAT y; + stream.GetCoords(x, y); + if (bStarted) { + rect.UpdateRect(x, y); + } else { + rect.InitRect(x, y); + bStarted = true; + } + } + stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * + color_count); + if (bGouraud) + stream.m_BitStream.ByteAlign(); + } + rect.Transform(&matrix); + return rect; +} + } // namespace CFX_ByteStringC PDF_FindKeyAbbreviationForTesting(const CFX_ByteStringC& abbr) { @@ -124,7 +189,7 @@ CPDF_StreamContentParser::CPDF_StreamContentParser( CPDF_Document* pDocument, CPDF_Dictionary* pPageResources, CPDF_Dictionary* pParentResources, - CFX_Matrix* pmtContentToUser, + const CFX_Matrix* pmtContentToUser, CPDF_PageObjectHolder* pObjHolder, CPDF_Dictionary* pResources, CFX_FloatRect* pBBox, @@ -985,7 +1050,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Fill() { } } if (nvalues != nargs) { - CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE); + CPDF_Pattern* pPattern = FindPattern(GetString(0), false); if (pPattern) { m_pCurStates->m_ColorState.SetFillPattern(pPattern, values, nvalues); } @@ -1013,7 +1078,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { } } if (nvalues != nargs) { - CPDF_Pattern* pPattern = FindPattern(GetString(0), FALSE); + CPDF_Pattern* pPattern = FindPattern(GetString(0), false); if (pPattern) { m_pCurStates->m_ColorState.SetStrokePattern(pPattern, values, nvalues); } @@ -1023,15 +1088,8 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() { FX_Free(values); } -CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream, - ShadingType type, - const CFX_Matrix* pMatrix, - CPDF_Function** pFuncs, - int nFuncs, - CPDF_ColorSpace* pCS); - void CPDF_StreamContentParser::Handle_ShadeFill() { - CPDF_Pattern* pPattern = FindPattern(GetString(0), TRUE); + CPDF_Pattern* pPattern = FindPattern(GetString(0), true); if (!pPattern) return; @@ -1051,7 +1109,7 @@ void CPDF_StreamContentParser::Handle_ShadeFill() { pObj->m_ClipPath.IsNull() ? m_BBox : pObj->m_ClipPath.GetClipBox(); if (pShading->IsMeshShading()) { bbox.Intersect(GetShadingBBox(ToStream(pShading->m_pShadingObj), - pShading->m_ShadingType, &pObj->m_Matrix, + pShading->m_ShadingType, pObj->m_Matrix, pShading->m_pFunctions, pShading->m_nFuncs, pShading->m_pCS)); } @@ -1164,15 +1222,15 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace( } CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name, - FX_BOOL bShading) { + bool bShading) { CPDF_Object* pPattern = FindResourceObj(bShading ? "Shading" : "Pattern", name); if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) { m_bResourceMissing = TRUE; - return NULL; + return nullptr; } return m_pDocument->LoadPattern(pPattern, bShading, - &m_pCurStates->m_ParentMatrix); + m_pCurStates->m_ParentMatrix); } void CPDF_StreamContentParser::ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y) { diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp index dff4bb6182..47c0336ea9 100644 --- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp +++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp @@ -664,7 +664,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage) { void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, - CFX_Matrix* pParentMatrix, + const CFX_Matrix* pParentMatrix, CPDF_Type3Char* pType3Char, int level) { m_pType3Char = pType3Char; diff --git a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp deleted file mode 100644 index 68ac8c849d..0000000000 --- a/core/fpdfapi/fpdf_page/fpdf_page_pattern.cpp +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "core/fpdfapi/fpdf_page/pageint.h" - -#include <algorithm> - -#include "core/fpdfapi/fpdf_page/cpdf_meshstream.h" -#include "core/fpdfapi/fpdf_page/cpdf_shadingpattern.h" -#include "core/fpdfapi/fpdf_page/include/cpdf_form.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_array.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_dictionary.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" -#include "core/fpdfapi/fpdf_parser/include/cpdf_stream.h" - -namespace { - -const int kSingleCoordinatePair = 1; -const int kTensorCoordinatePairs = 16; -const int kCoonsCoordinatePairs = 12; - -const int kSingleColorPerPatch = 1; -const int kQuadColorsPerPatch = 4; - -} // namespace - - - -CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream, - ShadingType type, - const CFX_Matrix* pMatrix, - CPDF_Function** pFuncs, - int nFuncs, - CPDF_ColorSpace* pCS) { - if (!pStream || !pStream->IsStream() || !pFuncs || !pCS) - return CFX_FloatRect(0, 0, 0, 0); - - CPDF_MeshStream stream; - if (!stream.Load(pStream, pFuncs, nFuncs, pCS)) - return CFX_FloatRect(0, 0, 0, 0); - - CFX_FloatRect rect; - bool bStarted = false; - bool bGouraud = type == kFreeFormGouraudTriangleMeshShading || - type == kLatticeFormGouraudTriangleMeshShading; - - int point_count = kSingleCoordinatePair; - if (type == kTensorProductPatchMeshShading) - point_count = kTensorCoordinatePairs; - else if (type == kCoonsPatchMeshShading) - point_count = kCoonsCoordinatePairs; - - int color_count = kSingleColorPerPatch; - if (type == kCoonsPatchMeshShading || type == kTensorProductPatchMeshShading) - color_count = kQuadColorsPerPatch; - - while (!stream.m_BitStream.IsEOF()) { - uint32_t flag = 0; - if (type != kLatticeFormGouraudTriangleMeshShading) - flag = stream.GetFlag(); - - if (!bGouraud && flag) { - point_count -= 4; - color_count -= 2; - } - - for (int i = 0; i < point_count; i++) { - FX_FLOAT x, y; - stream.GetCoords(x, y); - if (bStarted) { - rect.UpdateRect(x, y); - } else { - rect.InitRect(x, y); - bStarted = TRUE; - } - } - stream.m_BitStream.SkipBits(stream.m_nComps * stream.m_nCompBits * - color_count); - if (bGouraud) - stream.m_BitStream.ByteAlign(); - } - rect.Transform(pMatrix); - return rect; -} diff --git a/core/fpdfapi/fpdf_page/include/cpdf_form.h b/core/fpdfapi/fpdf_page/include/cpdf_form.h index 542ab498a6..d36a976176 100644 --- a/core/fpdfapi/fpdf_page/include/cpdf_form.h +++ b/core/fpdfapi/fpdf_page/include/cpdf_form.h @@ -25,17 +25,18 @@ class CPDF_Form : public CPDF_PageObjectHolder { ~CPDF_Form(); - void StartParse(CPDF_AllStates* pGraphicStates, - CFX_Matrix* pParentMatrix, - CPDF_Type3Char* pType3Char, - int level = 0); - void ParseContent(CPDF_AllStates* pGraphicStates, - CFX_Matrix* pParentMatrix, + const CFX_Matrix* pParentMatrix, CPDF_Type3Char* pType3Char, int level = 0); CPDF_Form* Clone() const; + + private: + void StartParse(CPDF_AllStates* pGraphicStates, + const CFX_Matrix* pParentMatrix, + CPDF_Type3Char* pType3Char, + int level = 0); }; #endif // CORE_FPDFAPI_FPDF_PAGE_INCLUDE_CPDF_FORM_H_ diff --git a/core/fpdfapi/fpdf_page/pageint.h b/core/fpdfapi/fpdf_page/pageint.h index 24ed226aa0..2dcf2e246f 100644 --- a/core/fpdfapi/fpdf_page/pageint.h +++ b/core/fpdfapi/fpdf_page/pageint.h @@ -105,7 +105,7 @@ class CPDF_StreamContentParser { CPDF_StreamContentParser(CPDF_Document* pDoc, CPDF_Dictionary* pPageResources, CPDF_Dictionary* pParentResources, - CFX_Matrix* pmtContentToUser, + const CFX_Matrix* pmtContentToUser, CPDF_PageObjectHolder* pObjectHolder, CPDF_Dictionary* pResources, CFX_FloatRect* pBBox, @@ -157,7 +157,7 @@ class CPDF_StreamContentParser { void RestoreStates(CPDF_AllStates* pState); CPDF_Font* FindFont(const CFX_ByteString& name); CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name); - CPDF_Pattern* FindPattern(const CFX_ByteString& name, FX_BOOL bShading); + CPDF_Pattern* FindPattern(const CFX_ByteString& name, bool bShading); CPDF_Object* FindResourceObj(const CFX_ByteStringC& type, const CFX_ByteString& name); @@ -288,7 +288,7 @@ class CPDF_ContentParser { void Start(CPDF_Page* pPage); void Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, - CFX_Matrix* pParentMatrix, + const CFX_Matrix* pParentMatrix, CPDF_Type3Char* pType3Char, int level); void Continue(IFX_Pause* pPause); @@ -330,7 +330,7 @@ class CPDF_DocPageData { void ReleaseColorSpace(CPDF_Object* pColorSpace); CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, - const CFX_Matrix* matrix); + const CFX_Matrix& matrix); void ReleasePattern(CPDF_Object* pPatternObj); CPDF_Image* GetImage(CPDF_Object* pImageStream); void ReleaseImage(CPDF_Object* pImageStream); diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp index c92e177dcc..ead1ac0455 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp @@ -753,7 +753,7 @@ CPDF_ColorSpace* CPDF_Document::LoadColorSpace(CPDF_Object* pCSObj, CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj, FX_BOOL bShading, - const CFX_Matrix* matrix) { + const CFX_Matrix& matrix) { return m_pDocPage->GetPattern(pPatternObj, bShading, matrix); } diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_document.h b/core/fpdfapi/fpdf_parser/include/cpdf_document.h index 38c0fdda30..687619b763 100644 --- a/core/fpdfapi/fpdf_parser/include/cpdf_document.h +++ b/core/fpdfapi/fpdf_parser/include/cpdf_document.h @@ -70,7 +70,7 @@ class CPDF_Document : public CFX_PrivateData, public CPDF_IndirectObjectHolder { CPDF_Pattern* LoadPattern(CPDF_Object* pObj, FX_BOOL bShading, - const CFX_Matrix* matrix = NULL); + const CFX_Matrix& matrix); CPDF_Image* LoadImageF(CPDF_Object* pObj); CPDF_StreamAcc* LoadFontFile(CPDF_Stream* pStream); |