summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-10 13:52:25 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-10 13:52:25 -0800
commite238549d212e97fe01dba3740949a98172c21454 (patch)
tree22fceab5e0a35b6d12a10f0504b0f4065f05b09e /core/src
parent0db900952c2aa76db801c9198923ce1b3d7c017d (diff)
downloadpdfium-e238549d212e97fe01dba3740949a98172c21454.tar.xz
Banish CFX_PtryArray to XFA side only.
The m_Operators array represents a heterogeneous instruction stream, so leave it as a void* for now. R=thestig@chromium.org, thestig@chromimum.org Review URL: https://codereview.chromium.org/1676413002 .
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp18
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.cpp21
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.h4
3 files changed, 19 insertions, 24 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index d1991adab2..5460615042 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -68,7 +68,7 @@ class CPDF_PSProc {
~CPDF_PSProc();
FX_BOOL Parse(CPDF_SimpleParser& parser);
FX_BOOL Execute(CPDF_PSEngine* pEngine);
- CFX_PtrArray m_Operators;
+ std::vector<void*> m_Operators;
};
#define PSENGINE_STACKSIZE 100
class CPDF_PSEngine {
@@ -90,8 +90,7 @@ class CPDF_PSEngine {
CPDF_PSProc m_MainProc;
};
CPDF_PSProc::~CPDF_PSProc() {
- int size = m_Operators.GetSize();
- for (int i = 0; i < size; i++) {
+ for (size_t i = 0; i < m_Operators.size(); i++) {
if (m_Operators[i] == (void*)PSOP_PROC) {
delete (CPDF_PSProc*)m_Operators[i + 1];
i++;
@@ -102,8 +101,7 @@ CPDF_PSProc::~CPDF_PSProc() {
}
}
FX_BOOL CPDF_PSProc::Execute(CPDF_PSEngine* pEngine) {
- int size = m_Operators.GetSize();
- for (int i = 0; i < size; i++) {
+ for (size_t i = 0; i < m_Operators.size(); i++) {
PDF_PSOP op = (PDF_PSOP)(uintptr_t)m_Operators[i];
if (op == PSOP_PROC) {
i++;
@@ -193,8 +191,8 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) {
}
if (word == "{") {
CPDF_PSProc* pProc = new CPDF_PSProc;
- m_Operators.Add((void*)PSOP_PROC);
- m_Operators.Add(pProc);
+ m_Operators.push_back((void*)PSOP_PROC);
+ m_Operators.push_back(pProc);
if (!pProc->Parse(parser)) {
return FALSE;
}
@@ -202,7 +200,7 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) {
int i = 0;
while (_PDF_PSOpNames[i].name) {
if (word == CFX_ByteStringC(_PDF_PSOpNames[i].name)) {
- m_Operators.Add((void*)_PDF_PSOpNames[i].op);
+ m_Operators.push_back((void*)_PDF_PSOpNames[i].op);
break;
}
i++;
@@ -210,8 +208,8 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) {
if (!_PDF_PSOpNames[i].name) {
FX_FLOAT* pd = FX_Alloc(FX_FLOAT, 1);
*pd = FX_atof(word);
- m_Operators.Add((void*)PSOP_CONST);
- m_Operators.Add(pd);
+ m_Operators.push_back((void*)PSOP_CONST);
+ m_Operators.push_back(pd);
}
}
}
diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp
index d4de2b812e..2b33228dd6 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/src/fxge/android/fpf_skiafontmgr.cpp
@@ -5,7 +5,7 @@
// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
#include "core/include/fxcrt/fx_ext.h"
-#include "fx_fpf.h"
+#include "core/src/fxge/android/fx_fpf.h"
#if _FX_OS_ == _FX_ANDROID_
#define FPF_SKIAMATCHWEIGHT_NAME1 62
@@ -217,19 +217,15 @@ static FX_BOOL FPF_SkiaMaybeArabic(const CFX_ByteStringC& bsFacename) {
}
CFPF_SkiaFontMgr::CFPF_SkiaFontMgr() : m_bLoaded(FALSE), m_FTLibrary(NULL) {}
CFPF_SkiaFontMgr::~CFPF_SkiaFontMgr() {
- void* pkey = NULL;
- CFPF_SkiaFont* pValue = NULL;
for (const auto& pair : m_FamilyFonts) {
if (pair.second)
pair.second->Release();
}
m_FamilyFonts.clear();
- for (int32_t i = m_FontFaces.GetUpperBound(); i >= 0; i--) {
- CFPF_SkiaFontDescriptor* pFont =
- (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(i);
- delete pFont;
+ for (auto it = m_FontFaces.rbegin(); it != m_FontFaces.end(); ++it) {
+ delete *it;
}
- m_FontFaces.RemoveAll();
+ m_FontFaces.clear();
if (m_FTLibrary) {
FXFT_Done_FreeType(m_FTLibrary);
}
@@ -275,8 +271,8 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
int32_t nItem = -1;
int32_t nMax = -1;
int32_t nGlyphNum = 0;
- for (int32_t i = m_FontFaces.GetUpperBound(); i >= 0; i--) {
- CFPF_SkiaPathFont* pFontDes = (CFPF_SkiaPathFont*)m_FontFaces.ElementAt(i);
+ for (auto it = m_FontFaces.rbegin(); it != m_FontFaces.rend(); ++it) {
+ CFPF_SkiaPathFont* pFontDes = *it;
if (!(pFontDes->m_dwCharsets & FPF_SkiaGetCharset(uCharset))) {
continue;
}
@@ -326,8 +322,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname,
}
}
if (nItem > -1) {
- CFPF_SkiaFontDescriptor* pFontDes =
- (CFPF_SkiaFontDescriptor*)m_FontFaces.ElementAt(nItem);
+ CFPF_SkiaFontDescriptor* pFontDes = m_FontFaces[nItem];
CFPF_SkiaFont* pFont = new CFPF_SkiaFont;
if (pFont->InitFont(this, pFontDes, bsFamilyname, dwStyle, uCharset)) {
m_FamilyFonts[dwHash] = pFont;
@@ -438,7 +433,7 @@ void CFPF_SkiaFontMgr::ScanFile(const CFX_ByteStringC& file) {
CFPF_SkiaPathFont* pFontDesc = new CFPF_SkiaPathFont;
pFontDesc->SetPath(file.GetCStr());
ReportFace(face, pFontDesc);
- m_FontFaces.Add(pFontDesc);
+ m_FontFaces.push_back(pFontDesc);
FXFT_Done_Face(face);
}
}
diff --git a/core/src/fxge/android/fpf_skiafontmgr.h b/core/src/fxge/android/fpf_skiafontmgr.h
index 4625e8c605..f3ef9109f0 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.h
+++ b/core/src/fxge/android/fpf_skiafontmgr.h
@@ -10,6 +10,7 @@
#if _FX_OS_ == _FX_ANDROID_
#include <map>
+#include <vector>
#include "core/include/fxge/fpf.h"
@@ -111,9 +112,10 @@ class CFPF_SkiaFontMgr : public IFPF_FontMgr {
void ScanFile(const CFX_ByteStringC& file);
void ReportFace(FXFT_Face face, CFPF_SkiaFontDescriptor* pFontDesc);
void OutputSystemFonts();
+
FX_BOOL m_bLoaded;
- CFX_PtrArray m_FontFaces;
FXFT_Library m_FTLibrary;
+ std::vector<CFPF_SkiaFontDescriptor*> m_FontFaces;
std::map<FX_DWORD, CFPF_SkiaFont*> m_FamilyFonts;
};