Index: core/fpdfdoc/cpvt_generateap.cpp |
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp |
index d37aaf3acbc514d5723b809766a1992363a960a3..41a82b6e478813aac6bd4b31242b088df11fbf61 100644 |
--- a/core/fpdfdoc/cpvt_generateap.cpp |
+++ b/core/fpdfdoc/cpvt_generateap.cpp |
@@ -56,7 +56,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pFontDict = pDRFontDict->GetDictFor(sFontName.Mid(1)); |
if (!pFontDict) { |
- pFontDict = new CPDF_Dictionary; |
+ pFontDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); |
pFontDict->SetNameFor("Type", "Font"); |
pFontDict->SetNameFor("Subtype", "Type1"); |
pFontDict->SetNameFor("BaseFont", "Helvetica"); |
@@ -161,7 +161,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, |
rcBody.Normalize(); |
CPDF_Dictionary* pAPDict = pAnnotDict->GetDictFor("AP"); |
if (!pAPDict) { |
- pAPDict = new CPDF_Dictionary; |
+ pAPDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); |
pAnnotDict->SetFor("AP", pAPDict); |
} |
CPDF_Stream* pNormalStream = pAPDict->GetStreamFor("N"); |
@@ -178,7 +178,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, |
if (pStreamResList) { |
CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDictFor("Font"); |
if (!pStreamResFontList) { |
- pStreamResFontList = new CPDF_Dictionary; |
+ pStreamResFontList = new CPDF_Dictionary(pDoc->GetByteStringPool()); |
pStreamResList->SetFor("Font", pStreamResFontList); |
} |
if (!pStreamResFontList->KeyExist(sFontName)) |
@@ -429,7 +429,7 @@ bool GenerateWidgetAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pStreamResFontList = |
pStreamResList->GetDictFor("Font"); |
if (!pStreamResFontList) { |
- pStreamResFontList = new CPDF_Dictionary; |
+ pStreamResFontList = new CPDF_Dictionary(pDoc->GetByteStringPool()); |
pStreamResList->SetFor("Font", pStreamResFontList); |
} |
if (!pStreamResFontList->KeyExist(sFontName)) |
@@ -538,7 +538,8 @@ CFX_ByteString GetPopupContentsString(CPDF_Document* pDoc, |
CPDF_Dictionary* GenerateExtGStateDict(const CPDF_Dictionary& pAnnotDict, |
const CFX_ByteString& sExtGSDictName, |
const CFX_ByteString& sBlendMode) { |
- CPDF_Dictionary* pGSDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pGSDict = |
+ new CPDF_Dictionary(pAnnotDict.GetByteStringPool()); |
pGSDict->SetStringFor("Type", "ExtGState"); |
FX_FLOAT fOpacity = |
@@ -548,31 +549,34 @@ CPDF_Dictionary* GenerateExtGStateDict(const CPDF_Dictionary& pAnnotDict, |
pGSDict->SetBooleanFor("AIS", false); |
pGSDict->SetStringFor("BM", sBlendMode); |
- CPDF_Dictionary* pExtGStateDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pExtGStateDict = |
+ new CPDF_Dictionary(pAnnotDict.GetByteStringPool()); |
pExtGStateDict->SetFor(sExtGSDictName, pGSDict); |
- |
return pExtGStateDict; |
} |
CPDF_Dictionary* GenerateResourceFontDict(CPDF_Document* pDoc, |
const CFX_ByteString& sFontDictName) { |
- CPDF_Dictionary* pFontDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pFontDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); |
pFontDict->SetNameFor("Type", "Font"); |
pFontDict->SetNameFor("Subtype", "Type1"); |
pFontDict->SetNameFor("BaseFont", "Helvetica"); |
pFontDict->SetNameFor("Encoding", "WinAnsiEncoding"); |
pDoc->AddIndirectObject(pFontDict); |
- CPDF_Dictionary* pResourceFontDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pResourceFontDict = |
+ new CPDF_Dictionary(pDoc->GetByteStringPool()); |
pResourceFontDict->SetReferenceFor(sFontDictName, pDoc, pFontDict); |
- |
return pResourceFontDict; |
} |
// Takes ownership of |pExtGStateDict| and |pResourceFontDict|. |
-CPDF_Dictionary* GenerateResourceDict(CPDF_Dictionary* pExtGStateDict, |
+CPDF_Dictionary* GenerateResourceDict(CPDF_Document* pDoc, |
+ CPDF_Dictionary* pExtGStateDict, |
CPDF_Dictionary* pResourceFontDict) { |
- CPDF_Dictionary* pResourceDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pResourceDict = |
+ new CPDF_Dictionary(pDoc->GetByteStringPool()); |
+ |
if (pExtGStateDict) |
pResourceDict->SetFor("ExtGState", pExtGStateDict); |
@@ -588,13 +592,12 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc, |
const CFX_ByteTextBuf& sAppStream, |
CPDF_Dictionary* pResourceDict, |
bool bIsTextMarkupAnnotation) { |
- CPDF_Dictionary* pAPDict = new CPDF_Dictionary; |
+ CPDF_Dictionary* pAPDict = new CPDF_Dictionary(pDoc->GetByteStringPool()); |
pAnnotDict->SetFor("AP", pAPDict); |
CPDF_Stream* pNormalStream = new CPDF_Stream(nullptr, 0, nullptr); |
int32_t objnum = pDoc->AddIndirectObject(pNormalStream); |
pAnnotDict->GetDictFor("AP")->SetReferenceFor("N", pDoc, objnum); |
- |
pNormalStream->SetData(sAppStream.GetBuffer(), sAppStream.GetSize(), FALSE, |
FALSE); |
@@ -607,7 +610,6 @@ void GenerateAndSetAPDict(CPDF_Document* pDoc, |
? CPDF_Annot::RectFromQuadPoints(pAnnotDict) |
: pAnnotDict->GetRectFor("Rect"); |
pStreamDict->SetRectFor("BBox", rect); |
- |
pStreamDict->SetFor("Resources", pResourceDict); |
} |
@@ -785,7 +787,7 @@ bool CPVT_GenerateAP::GenerateCircleAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pExtGStateDict = |
GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Normal"); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pExtGStateDict, nullptr); |
+ GenerateResourceDict(pDoc, pExtGStateDict, nullptr); |
GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pResourceDict, |
false /*IsTextMarkupAnnotation*/); |
return true; |
@@ -812,7 +814,7 @@ bool CPVT_GenerateAP::GenerateHighlightAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pExtGStateDict = |
GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Multiply"); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pExtGStateDict, nullptr); |
+ GenerateResourceDict(pDoc, pExtGStateDict, nullptr); |
GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pResourceDict, |
true /*IsTextMarkupAnnotation*/); |
@@ -867,7 +869,7 @@ bool CPVT_GenerateAP::GenerateInkAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pExtGStateDict = |
GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Normal"); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pExtGStateDict, nullptr); |
+ GenerateResourceDict(pDoc, pExtGStateDict, nullptr); |
GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pResourceDict, |
false /*IsTextMarkupAnnotation*/); |
return true; |
@@ -890,7 +892,7 @@ bool CPVT_GenerateAP::GenerateTextAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pExtGStateDict = |
GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Normal"); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pExtGStateDict, nullptr); |
+ GenerateResourceDict(pDoc, pExtGStateDict, nullptr); |
GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pResourceDict, |
false /*IsTextMarkupAnnotation*/); |
return true; |
@@ -917,7 +919,7 @@ bool CPVT_GenerateAP::GenerateUnderlineAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pExtGStateDict = |
GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Normal"); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pExtGStateDict, nullptr); |
+ GenerateResourceDict(pDoc, pExtGStateDict, nullptr); |
GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pResourceDict, |
true /*IsTextMarkupAnnotation*/); |
return true; |
@@ -950,7 +952,7 @@ bool CPVT_GenerateAP::GeneratePopupAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pResourceFontDict = |
GenerateResourceFontDict(pDoc, sFontName); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pResourceFontDict, pExtGStateDict); |
+ GenerateResourceDict(pDoc, pResourceFontDict, pExtGStateDict); |
CPDF_Font* pDefFont = pDoc->LoadFont(pResourceFontDict); |
if (!pDefFont) |
@@ -1004,7 +1006,7 @@ bool CPVT_GenerateAP::GenerateSquareAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pExtGStateDict = |
GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Normal"); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pExtGStateDict, nullptr); |
+ GenerateResourceDict(pDoc, pExtGStateDict, nullptr); |
GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pResourceDict, |
false /*IsTextMarkupAnnotation*/); |
return true; |
@@ -1053,7 +1055,7 @@ bool CPVT_GenerateAP::GenerateSquigglyAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pExtGStateDict = |
GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Normal"); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pExtGStateDict, nullptr); |
+ GenerateResourceDict(pDoc, pExtGStateDict, nullptr); |
GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pResourceDict, |
true /*IsTextMarkupAnnotation*/); |
return true; |
@@ -1080,7 +1082,7 @@ bool CPVT_GenerateAP::GenerateStrikeOutAP(CPDF_Document* pDoc, |
CPDF_Dictionary* pExtGStateDict = |
GenerateExtGStateDict(*pAnnotDict, sExtGSDictName, "Normal"); |
CPDF_Dictionary* pResourceDict = |
- GenerateResourceDict(pExtGStateDict, nullptr); |
+ GenerateResourceDict(pDoc, pExtGStateDict, nullptr); |
GenerateAndSetAPDict(pDoc, pAnnotDict, sAppStream, pResourceDict, |
true /*IsTextMarkupAnnotation*/); |
return true; |