summaryrefslogtreecommitdiff
path: root/core/fxge
diff options
context:
space:
mode:
authornpm <npm@chromium.org>2016-10-11 13:21:34 -0700
committerCommit bot <commit-bot@chromium.org>2016-10-11 13:21:34 -0700
commita91b8d395ac8f6aed38cccfda1f38de11dd45bdd (patch)
tree97dc87ed807533cc7599dc8e100746b07dc62456 /core/fxge
parentf3fbe83a0f6c1dfb05722a6f0a4056c53548fb6e (diff)
downloadpdfium-a91b8d395ac8f6aed38cccfda1f38de11dd45bdd.tar.xz
Deleted unused members in CTTFontDesc
Review-Url: https://codereview.chromium.org/2408213002
Diffstat (limited to 'core/fxge')
-rw-r--r--core/fxge/ge/cfx_fontmgr.cpp24
-rw-r--r--core/fxge/ge/cttfontdesc.cpp12
-rw-r--r--core/fxge/ge/cttfontdesc.h11
3 files changed, 20 insertions, 27 deletions
diff --git a/core/fxge/ge/cfx_fontmgr.cpp b/core/fxge/ge/cfx_fontmgr.cpp
index 95a2b662ed..981a9be288 100644
--- a/core/fxge/ge/cfx_fontmgr.cpp
+++ b/core/fxge/ge/cfx_fontmgr.cpp
@@ -132,7 +132,7 @@ FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name,
CTTFontDesc* pFontDesc = it->second;
pFontData = pFontDesc->m_pFontData;
pFontDesc->m_RefCount++;
- return pFontDesc->m_SingleFace.m_pFace;
+ return pFontDesc->m_SingleFace;
}
FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
@@ -143,27 +143,25 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name,
int face_index) {
CTTFontDesc* pFontDesc = new CTTFontDesc;
pFontDesc->m_Type = 1;
- pFontDesc->m_SingleFace.m_pFace = nullptr;
- pFontDesc->m_SingleFace.m_bBold = weight;
- pFontDesc->m_SingleFace.m_bItalic = bItalic;
+ pFontDesc->m_SingleFace = nullptr;
pFontDesc->m_pFontData = pData;
pFontDesc->m_RefCount = 1;
InitFTLibrary();
FXFT_Library library = m_FTLibrary;
int ret = FXFT_New_Memory_Face(library, pData, size, face_index,
- &pFontDesc->m_SingleFace.m_pFace);
+ &pFontDesc->m_SingleFace);
if (ret) {
delete pFontDesc;
return nullptr;
}
- ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace.m_pFace, 64, 64);
+ ret = FXFT_Set_Pixel_Sizes(pFontDesc->m_SingleFace, 64, 64);
if (ret) {
delete pFontDesc;
return nullptr;
}
m_FaceMap[KeyNameFromFace(face_name, weight, bItalic)] = pFontDesc;
- return pFontDesc->m_SingleFace.m_pFace;
+ return pFontDesc->m_SingleFace;
}
FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size,
@@ -178,11 +176,11 @@ FXFT_Face CFX_FontMgr::GetCachedTTCFace(int ttc_size,
pFontData = pFontDesc->m_pFontData;
pFontDesc->m_RefCount++;
int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset);
- if (!pFontDesc->m_TTCFace.m_pFaces[face_index]) {
- pFontDesc->m_TTCFace.m_pFaces[face_index] =
+ if (!pFontDesc->m_TTCFaces[face_index]) {
+ pFontDesc->m_TTCFaces[face_index] =
GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index);
}
- return pFontDesc->m_TTCFace.m_pFaces[face_index];
+ return pFontDesc->m_TTCFaces[face_index];
}
FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size,
@@ -194,13 +192,13 @@ FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size,
pFontDesc->m_Type = 2;
pFontDesc->m_pFontData = pData;
for (int i = 0; i < 16; i++)
- pFontDesc->m_TTCFace.m_pFaces[i] = nullptr;
+ pFontDesc->m_TTCFaces[i] = nullptr;
pFontDesc->m_RefCount++;
m_FaceMap[KeyNameFromSize(ttc_size, checksum)] = pFontDesc;
int face_index = GetTTCIndex(pFontDesc->m_pFontData, ttc_size, font_offset);
- pFontDesc->m_TTCFace.m_pFaces[face_index] =
+ pFontDesc->m_TTCFaces[face_index] =
GetFixedFace(pFontDesc->m_pFontData, ttc_size, face_index);
- return pFontDesc->m_TTCFace.m_pFaces[face_index];
+ return pFontDesc->m_TTCFaces[face_index];
}
FXFT_Face CFX_FontMgr::GetFixedFace(const uint8_t* pData,
diff --git a/core/fxge/ge/cttfontdesc.cpp b/core/fxge/ge/cttfontdesc.cpp
index 1e4ece4dc1..269abfe7f7 100644
--- a/core/fxge/ge/cttfontdesc.cpp
+++ b/core/fxge/ge/cttfontdesc.cpp
@@ -10,12 +10,12 @@
CTTFontDesc::~CTTFontDesc() {
if (m_Type == 1) {
- if (m_SingleFace.m_pFace)
- FXFT_Done_Face(m_SingleFace.m_pFace);
+ if (m_SingleFace)
+ FXFT_Done_Face(m_SingleFace);
} else if (m_Type == 2) {
for (int i = 0; i < 16; i++) {
- if (m_TTCFace.m_pFaces[i])
- FXFT_Done_Face(m_TTCFace.m_pFaces[i]);
+ if (m_TTCFaces[i])
+ FXFT_Done_Face(m_TTCFaces[i]);
}
}
FX_Free(m_pFontData);
@@ -23,12 +23,12 @@ CTTFontDesc::~CTTFontDesc() {
int CTTFontDesc::ReleaseFace(FXFT_Face face) {
if (m_Type == 1) {
- if (m_SingleFace.m_pFace != face)
+ if (m_SingleFace != face)
return -1;
} else if (m_Type == 2) {
int i;
for (i = 0; i < 16; i++) {
- if (m_TTCFace.m_pFaces[i] == face)
+ if (m_TTCFaces[i] == face)
break;
}
if (i == 16)
diff --git a/core/fxge/ge/cttfontdesc.h b/core/fxge/ge/cttfontdesc.h
index 8fc2a34e71..d756cb947a 100644
--- a/core/fxge/ge/cttfontdesc.h
+++ b/core/fxge/ge/cttfontdesc.h
@@ -28,15 +28,10 @@ class CTTFontDesc {
int ReleaseFace(FXFT_Face face);
int m_Type;
+
union {
- struct {
- FX_BOOL m_bItalic;
- FX_BOOL m_bBold;
- FXFT_Face m_pFace;
- } m_SingleFace;
- struct {
- FXFT_Face m_pFaces[16];
- } m_TTCFace;
+ FXFT_Face m_SingleFace;
+ FXFT_Face m_TTCFaces[16];
};
uint8_t* m_pFontData;
int m_RefCount;