diff options
author | Tom Sepez <tsepez@chromium.org> | 2015-04-16 08:31:30 -0700 |
---|---|---|
committer | Tom Sepez <tsepez@chromium.org> | 2015-04-16 08:31:30 -0700 |
commit | 026623249c78ba305c874cc093a035ef5a4cd1b4 (patch) | |
tree | 5540055c26b89a0747b0ebe2193732e82d5872a7 /core/src | |
parent | 6c0d01b0244af7d8f9a896e626c7a7d5476a7373 (diff) | |
download | pdfium-026623249c78ba305c874cc093a035ef5a4cd1b4.tar.xz |
Remove checks in fxge/ge now that FX_NEW can't return 0.
R=thestig@chromium.org
Review URL: https://codereview.chromium.org/1081443004
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/fxge/ge/fx_ge.cpp | 9 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_font.cpp | 9 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_fontmap.cpp | 20 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_linux.cpp | 5 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_ps.cpp | 5 | ||||
-rw-r--r-- | core/src/fxge/ge/fx_ge_text.cpp | 35 |
6 files changed, 17 insertions, 66 deletions
diff --git a/core/src/fxge/ge/fx_ge.cpp b/core/src/fxge/ge/fx_ge.cpp index d044d721e6..755aad565e 100644 --- a/core/src/fxge/ge/fx_ge.cpp +++ b/core/src/fxge/ge/fx_ge.cpp @@ -33,11 +33,8 @@ CFX_GEModule* CFX_GEModule::Get() } void CFX_GEModule::Create() { - g_pGEModule = FX_NEW CFX_GEModule; - if (!g_pGEModule) { - return; - } - g_pGEModule->m_pFontMgr = FX_NEW CFX_FontMgr; + g_pGEModule = new CFX_GEModule; + g_pGEModule->m_pFontMgr = new CFX_FontMgr; g_pGEModule->InitPlatform(); g_pGEModule->SetTextGamma(2.2f); } @@ -55,7 +52,7 @@ void CFX_GEModule::Destroy() CFX_FontCache* CFX_GEModule::GetFontCache() { if (m_pFontCache == NULL) { - m_pFontCache = FX_NEW CFX_FontCache(); + m_pFontCache = new CFX_FontCache(); } return m_pFontCache; } diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index ea59a48185..104a23998d 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -68,10 +68,7 @@ FX_BOOL CFX_Font::LoadSubst(const CFX_ByteString& face_name, FX_BOOL bTrueType, { m_bEmbedded = FALSE; m_bVertical = bVertical; - m_pSubstFont = FX_NEW CFX_SubstFont; - if (!m_pSubstFont) { - return FALSE; - } + m_pSubstFont = new CFX_SubstFont; m_Face = CFX_GEModule::Get()->GetFontMgr()->FindSubstFont(face_name, bTrueType, flags, weight, italic_angle, CharsetCP, m_pSubstFont); #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ @@ -442,7 +439,5 @@ FX_DWORD CFX_UnicodeEncoding::GlyphFromCharCodeEx(FX_DWORD charcode, int encodin } IFX_FontEncoding* FXGE_CreateUnicodeEncoding(CFX_Font* pFont) { - CFX_UnicodeEncoding* pEncoding = NULL; - pEncoding = FX_NEW CFX_UnicodeEncoding(pFont); - return pEncoding; + return new CFX_UnicodeEncoding(pFont); } diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index 079c485b01..43b971ffc3 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -61,10 +61,7 @@ FX_BOOL CTTFontDesc::ReleaseFace(FXFT_Face face) } CFX_FontMgr::CFX_FontMgr() { - m_pBuiltinMapper = FX_NEW CFX_FontMapper; - if (!m_pBuiltinMapper) { - return; - } + m_pBuiltinMapper = new CFX_FontMapper; m_pBuiltinMapper->m_pFontMgr = this; m_pExtMapper = NULL; m_FTLibrary = NULL; @@ -136,10 +133,7 @@ FXFT_Face CFX_FontMgr::GetCachedFace(const CFX_ByteString& face_name, FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, int weight, FX_BOOL bItalic, FX_LPBYTE pData, FX_DWORD size, int face_index) { - CTTFontDesc* pFontDesc = FX_NEW CTTFontDesc; - if (!pFontDesc) { - return NULL; - } + CTTFontDesc* pFontDesc = new CTTFontDesc; pFontDesc->m_Type = 1; pFontDesc->m_SingleFace.m_pFace = NULL; pFontDesc->m_SingleFace.m_bBold = weight; @@ -337,10 +331,7 @@ FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, FX_DWORD checksum, { CFX_ByteString key; key.Format("%d:%d", ttc_size, checksum); - CTTFontDesc* pFontDesc = FX_NEW CTTFontDesc; - if (!pFontDesc) { - return NULL; - } + CTTFontDesc* pFontDesc = new CTTFontDesc; pFontDesc->m_Type = 2; pFontDesc->m_pFontData = pData; for (int i = 0; i < 16; i ++) { @@ -1416,10 +1407,7 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path, FXSYS_FILE* pFile, FX_ if (m_FontList.Lookup(facename, p)) { return; } - CFontFaceInfo* pInfo = FX_NEW CFontFaceInfo; - if (!pInfo) { - return; - } + CFontFaceInfo* pInfo = new CFontFaceInfo; pInfo->m_FilePath = path; pInfo->m_FaceName = facename; pInfo->m_FontTables = tables; diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index ad0a70ab1f..b9cfc8ef54 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -208,10 +208,7 @@ void* CFX_LinuxFontInfo::FindFont(int weight, FX_BOOL bItalic, int charset, int } IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { - CFX_LinuxFontInfo* pInfo = FX_NEW CFX_LinuxFontInfo; - if (!pInfo) { - return NULL; - } + CFX_LinuxFontInfo* pInfo = new CFX_LinuxFontInfo; if (!pInfo->ParseFontCfg()) { pInfo->AddPath("/usr/share/fonts"); pInfo->AddPath("/usr/share/X11/fonts/Type1"); diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp index 9da224602e..ad572115c5 100644 --- a/core/src/fxge/ge/fx_ge_ps.cpp +++ b/core/src/fxge/ge/fx_ge_ps.cpp @@ -526,10 +526,7 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache, CFX_Font* pFont, } } if (m_PSFontList.GetSize() == 0 || m_PSFontList[m_PSFontList.GetSize() - 1]->m_nGlyphs == 256) { - CPSFont* pPSFont = FX_NEW CPSFont; - if (!pPSFont) { - return; - } + CPSFont* pPSFont = new CPSFont; pPSFont->m_nGlyphs = 0; m_PSFontList.Add(pPSFont); CFX_ByteTextBuf buf; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index 2e13c0416c..21eebb7630 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -984,19 +984,8 @@ CFX_FaceCache* CFX_FontCache::GetCachedFace(CFX_Font* pFont) counted_face_cache->m_nCount++; return counted_face_cache->m_Obj; } - CFX_FaceCache* face_cache = NULL; - face_cache = FX_NEW CFX_FaceCache(bExternal ? NULL : (FXFT_Face)face); - if (face_cache == NULL) { - return NULL; - } - counted_face_cache = FX_NEW CFX_CountedFaceCache; - if (!counted_face_cache) { - if (face_cache) { - delete face_cache; - face_cache = NULL; - } - return NULL; - } + CFX_FaceCache* face_cache = new CFX_FaceCache(bExternal ? NULL : (FXFT_Face)face); + counted_face_cache = new CFX_CountedFaceCache; counted_face_cache->m_nCount = 2; counted_face_cache->m_Obj = face_cache; map.SetAt((FXFT_Face)face, counted_face_cache); @@ -1081,10 +1070,7 @@ CFX_GlyphBitmap* CFX_FaceCache::LookUpGlyphBitmap(CFX_Font* pFont, const CFX_Aff { CFX_SizeGlyphCache* pSizeCache = NULL; if (!m_SizeMap.Lookup(FaceGlyphsKey, (void*&)pSizeCache)) { - pSizeCache = FX_NEW CFX_SizeGlyphCache; - if (pSizeCache == NULL) { - return NULL; - } + pSizeCache = new CFX_SizeGlyphCache; m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); } CFX_GlyphBitmap* pGlyphBitmap = NULL; @@ -1153,10 +1139,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD } else { pGlyphBitmap = RenderGlyph_Nativetext(pFont, glyph_index, pMatrix, dest_width, anti_alias); if (pGlyphBitmap) { - pSizeCache = FX_NEW CFX_SizeGlyphCache; - if (pSizeCache == NULL) { - return NULL; - } + pSizeCache = new CFX_SizeGlyphCache; m_SizeMap.SetAt(FaceGlyphsKey, pSizeCache); pSizeCache->m_GlyphMap.SetAt((FX_LPVOID)(FX_UINTPTR)glyph_index, pGlyphBitmap); return pGlyphBitmap; @@ -1378,10 +1361,7 @@ CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph(CFX_Font* pFont, FX_DWORD glyph_inde return NULL; } int dib_width = bmwidth; - CFX_GlyphBitmap* pGlyphBitmap = FX_NEW CFX_GlyphBitmap; - if (!pGlyphBitmap) { - return NULL; - } + CFX_GlyphBitmap* pGlyphBitmap = new CFX_GlyphBitmap; pGlyphBitmap->m_Bitmap.Create(dib_width, bmheight, anti_alias == FXFT_RENDER_MODE_MONO ? FXDIB_1bppMask : FXDIB_8bppMask); pGlyphBitmap->m_Left = FXFT_Get_Glyph_BitmapLeft(m_Face); @@ -1676,10 +1656,7 @@ CFX_PathData* CFX_Font::LoadGlyphPath(FX_DWORD glyph_index, int dest_width) if (params.m_PointCount == 0) { return NULL; } - CFX_PathData* pPath = FX_NEW CFX_PathData; - if (!pPath) { - return NULL; - } + CFX_PathData* pPath = new CFX_PathData; pPath->SetPointCount(params.m_PointCount); params.m_bCount = FALSE; params.m_PointCount = 0; |