Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Unified Diff: core/fpdfapi/fpdf_page/cpdf_image.cpp

Issue 2345063002: Use string pools in some dictionaries (Closed)
Patch Set: windows compile Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h ('k') | core/fpdfapi/fpdf_page/fpdf_page_doc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfapi/fpdf_page/cpdf_image.cpp
diff --git a/core/fpdfapi/fpdf_page/cpdf_image.cpp b/core/fpdfapi/fpdf_page/cpdf_image.cpp
index 4112ad86ee79fe02857096ae8dba0feaa0b69bd7..91f1268eae2204ffc0865a7b92a2c5fdebe088b8 100644
--- a/core/fpdfapi/fpdf_page/cpdf_image.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_image.cpp
@@ -85,7 +85,8 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) {
return nullptr;
}
- CPDF_Dictionary* pDict = new CPDF_Dictionary;
+ CPDF_Dictionary* pDict =
+ new CPDF_Dictionary(m_pDocument->GetByteStringPool());
pDict->SetNameFor("Type", "XObject");
pDict->SetNameFor("Subtype", "Image");
pDict->SetIntegerFor("Width", width);
@@ -108,7 +109,8 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, uint32_t size) {
pDict->SetIntegerFor("BitsPerComponent", bits);
pDict->SetNameFor("Filter", "DCTDecode");
if (!color_trans) {
- CPDF_Dictionary* pParms = new CPDF_Dictionary;
+ CPDF_Dictionary* pParms =
+ new CPDF_Dictionary(m_pDocument->GetByteStringPool());
pDict->SetFor("DecodeParms", pParms);
pParms->SetIntegerFor("ColorTransform", 0);
}
@@ -150,7 +152,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
int32_t src_pitch = pBitmap->GetPitch();
int32_t bpp = pBitmap->GetBPP();
- CPDF_Dictionary* pDict = new CPDF_Dictionary;
+ CPDF_Dictionary* pDict =
+ new CPDF_Dictionary(m_pDocument->GetByteStringPool());
pDict->SetNameFor("Type", "XObject");
pDict->SetNameFor("Subtype", "Image");
pDict->SetIntegerFor("Width", BitmapWidth);
@@ -213,8 +216,9 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
ptr[2] = (uint8_t)argb;
ptr += 3;
}
- CPDF_Stream* pCTS =
- new CPDF_Stream(pColorTable, iPalette * 3, new CPDF_Dictionary);
+ CPDF_Stream* pCTS = new CPDF_Stream(
+ pColorTable, iPalette * 3,
+ new CPDF_Dictionary(m_pDocument->GetByteStringPool()));
pCS->AddReference(m_pDocument, m_pDocument->AddIndirectObject(pCTS));
pDict->SetReferenceFor("ColorSpace", m_pDocument,
m_pDocument->AddIndirectObject(pCS));
@@ -249,7 +253,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap, int32_t iCompress) {
int32_t maskHeight = pMaskBitmap->GetHeight();
uint8_t* mask_buf = nullptr;
FX_STRSIZE mask_size = 0;
- CPDF_Dictionary* pMaskDict = new CPDF_Dictionary;
+ CPDF_Dictionary* pMaskDict =
+ new CPDF_Dictionary(m_pDocument->GetByteStringPool());
pMaskDict->SetNameFor("Type", "XObject");
pMaskDict->SetNameFor("Subtype", "Image");
pMaskDict->SetIntegerFor("Width", maskWidth);
« no previous file with comments | « core/fpdfapi/fpdf_font/include/cpdf_fontencoding.h ('k') | core/fpdfapi/fpdf_page/fpdf_page_doc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698