From 24e733ef26280268ac6ede6d73fac7475aedd1a9 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 16 Oct 2015 14:18:50 -0700 Subject: fxcrt convergence - XFA side. Take extern tables portion only of fx_bidi change. Take itoa fixes and corresponding unit test. Merge typo in skia font mgr. Kill some null checks after new. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1409223002 . --- core/src/fxge/android/fpf_skiafontmgr.cpp | 2 +- core/src/fxge/android/fpf_skiamodule.cpp | 3 --- core/src/fxge/android/fx_android_imp.cpp | 3 --- core/src/fxge/apple/fx_mac_imp.cpp | 3 --- core/src/fxge/dib/fx_dib_convert.cpp | 3 --- core/src/fxge/dib/fx_dib_engine.cpp | 3 --- core/src/fxge/dib/fx_dib_transform.cpp | 6 ------ core/src/fxge/ge/fx_ge_fontmap.cpp | 6 ------ core/src/fxge/ge/fx_ge_linux.cpp | 6 +++--- core/src/fxge/skia/fx_skia_device.cpp | 2 +- core/src/fxge/win32/fx_win32_dwrite.cpp | 4 ---- core/src/fxge/win32/fx_win32_gdipext.cpp | 6 ++++++ core/src/fxge/win32/fx_win32_print.cpp | 9 --------- 13 files changed, 11 insertions(+), 45 deletions(-) (limited to 'core/src/fxge') diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp index 521460bea3..7e7aee3c06 100644 --- a/core/src/fxge/android/fpf_skiafontmgr.cpp +++ b/core/src/fxge/android/fpf_skiafontmgr.cpp @@ -337,7 +337,7 @@ IFPF_Font* CFPF_SkiaFontMgr::CreateFont(const CFX_ByteStringC& bsFamilyname, m_FamilyFonts.SetAt((void*)(uintptr_t)dwHash, (void*)pFont); return pFont->Retain(); } - pFont->Release() + pFont->Release(); } return NULL; } diff --git a/core/src/fxge/android/fpf_skiamodule.cpp b/core/src/fxge/android/fpf_skiamodule.cpp index a421a0e944..fdc3398d30 100644 --- a/core/src/fxge/android/fpf_skiamodule.cpp +++ b/core/src/fxge/android/fpf_skiamodule.cpp @@ -25,9 +25,6 @@ void CFPF_SkiaDeviceModule::Destroy() { IFPF_FontMgr* CFPF_SkiaDeviceModule::GetFontMgr() { if (!m_pFontMgr) { m_pFontMgr = new CFPF_SkiaFontMgr; - if (!m_pFontMgr) { - return NULL; - } if (!m_pFontMgr->InitFTLibrary()) { delete m_pFontMgr; return NULL; diff --git a/core/src/fxge/android/fx_android_imp.cpp b/core/src/fxge/android/fx_android_imp.cpp index 43fe3b197f..073a665560 100644 --- a/core/src/fxge/android/fx_android_imp.cpp +++ b/core/src/fxge/android/fx_android_imp.cpp @@ -14,9 +14,6 @@ void CFX_GEModule::InitPlatform() { IFPF_FontMgr* pFontMgr = pDeviceModule->GetFontMgr(); if (pFontMgr) { CFX_AndroidFontInfo* pFontInfo = new CFX_AndroidFontInfo; - if (!pFontInfo) { - return; - } pFontInfo->Init(pFontMgr); m_pFontMgr->SetSystemFontInfo(pFontInfo); } diff --git a/core/src/fxge/apple/fx_mac_imp.cpp b/core/src/fxge/apple/fx_mac_imp.cpp index 07e3d02c4c..41333f8bf4 100644 --- a/core/src/fxge/apple/fx_mac_imp.cpp +++ b/core/src/fxge/apple/fx_mac_imp.cpp @@ -96,9 +96,6 @@ void* CFX_MacFontInfo::MapFont(int weight, } IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) { CFX_MacFontInfo* pInfo = new CFX_MacFontInfo; - if (!pInfo) { - return NULL; - } pInfo->AddPath("~/Library/Fonts"); pInfo->AddPath("/Library/Fonts"); pInfo->AddPath("/System/Library/Fonts"); diff --git a/core/src/fxge/dib/fx_dib_convert.cpp b/core/src/fxge/dib/fx_dib_convert.cpp index 93e741158c..3884d0fc8e 100644 --- a/core/src/fxge/dib/fx_dib_convert.cpp +++ b/core/src/fxge/dib/fx_dib_convert.cpp @@ -1094,9 +1094,6 @@ CFX_DIBitmap* CFX_DIBSource::CloneConvert(FXDIB_Format dest_format, return pClone; } CFX_DIBitmap* pClone = new CFX_DIBitmap; - if (!pClone) { - return NULL; - } if (!pClone->Create(m_Width, m_Height, dest_format)) { delete pClone; return NULL; diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index 33c0333788..56bb5abafa 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -840,9 +840,6 @@ FX_BOOL CFX_ImageStretcher::StartStretch() { m_pStretchEngine = new CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, m_Flags); - if (!m_pStretchEngine) { - return FALSE; - } m_pStretchEngine->StartStretchHorz(); if (m_pSource->GetWidth() * m_pSource->GetHeight() < MAX_PROGRESSIVE_STRETCH_PIXELS) { diff --git a/core/src/fxge/dib/fx_dib_transform.cpp b/core/src/fxge/dib/fx_dib_transform.cpp index 7a33f1d9f8..d368a95c35 100644 --- a/core/src/fxge/dib/fx_dib_transform.cpp +++ b/core/src/fxge/dib/fx_dib_transform.cpp @@ -79,9 +79,6 @@ CFX_DIBitmap* CFX_DIBSource::SwapXY(FX_BOOL bXFlip, return NULL; } CFX_DIBitmap* pTransBitmap = new CFX_DIBitmap; - if (!pTransBitmap) { - return NULL; - } int result_height = dest_clip.Height(), result_width = dest_clip.Width(); if (!pTransBitmap->Create(result_width, result_height, GetFormat())) { delete pTransBitmap; @@ -424,9 +421,6 @@ FX_BOOL CFX_ImageTransformer::Continue(IFX_Pause* pPause) { } int stretch_pitch = m_Storer.GetBitmap()->GetPitch(); CFX_DIBitmap* pTransformed = new CFX_DIBitmap; - if (!pTransformed) { - return FALSE; - } FXDIB_Format transformF = _GetTransformedFormat(m_Stretcher.m_pSource); if (!pTransformed->Create(m_ResultWidth, m_ResultHeight, transformF)) { delete pTransformed; diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index e9c9d768c8..b332ffdea2 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -138,9 +138,6 @@ FXFT_Face CFX_FontMgr::AddCachedFace(const CFX_ByteString& face_name, FX_DWORD size, int face_index) { CTTFontDesc* pFontDesc = new CTTFontDesc; - if (!pFontDesc) { - return NULL; - } pFontDesc->m_Type = 1; pFontDesc->m_SingleFace.m_pFace = NULL; pFontDesc->m_SingleFace.m_bBold = weight; @@ -336,9 +333,6 @@ FXFT_Face CFX_FontMgr::AddCachedTTCFace(int ttc_size, FX_DWORD size, int font_offset) { CTTFontDesc* pFontDesc = new CTTFontDesc; - if (!pFontDesc) { - return NULL; - } pFontDesc->m_Type = 2; pFontDesc->m_pFontData = pData; for (int i = 0; i < 16; i++) { diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index 609777fbb5..72971f7f5d 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -91,7 +91,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, } } break; case FXFONT_GB2312_CHARSET: { - for (int32_t i = 0; i < FX_ArraySize(g_LinuxGbFontList); ++i) { + for (size_t i = 0; i < FX_ArraySize(g_LinuxGbFontList); ++i) { auto it = m_FontList.find(g_LinuxGbFontList[i]); if (it != m_FontList.end()) { return it->second; @@ -99,7 +99,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, } } break; case FXFONT_CHINESEBIG5_CHARSET: { - for (int32_t i = 0; i < FX_ArraySize(g_LinuxB5FontList); ++i) { + for (size_t i = 0; i < FX_ArraySize(g_LinuxB5FontList); ++i) { auto it = m_FontList.find(g_LinuxB5FontList[i]); if (it != m_FontList.end()) { return it->second; @@ -107,7 +107,7 @@ void* CFX_LinuxFontInfo::MapFont(int weight, } } break; case FXFONT_HANGEUL_CHARSET: { - for (int32_t i = 0; i < FX_ArraySize(g_LinuxHGFontList); ++i) { + for (size_t i = 0; i < FX_ArraySize(g_LinuxHGFontList); ++i) { auto it = m_FontList.find(g_LinuxHGFontList[i]); if (it != m_FontList.end()) { return it->second; diff --git a/core/src/fxge/skia/fx_skia_device.cpp b/core/src/fxge/skia/fx_skia_device.cpp index d7f448ebf6..fcd8e9871e 100644 --- a/core/src/fxge/skia/fx_skia_device.cpp +++ b/core/src/fxge/skia/fx_skia_device.cpp @@ -626,4 +626,4 @@ CFX_SkiaDevice::~CFX_SkiaDevice() { delete GetBitmap(); } -#endif \ No newline at end of file +#endif diff --git a/core/src/fxge/win32/fx_win32_dwrite.cpp b/core/src/fxge/win32/fx_win32_dwrite.cpp index 845eb14576..5a3c16c2af 100644 --- a/core/src/fxge/win32/fx_win32_dwrite.cpp +++ b/core/src/fxge/win32/fx_win32_dwrite.cpp @@ -64,7 +64,6 @@ class CDwFontFileLoader final : public IDWriteFontFileLoader { static IDWriteFontFileLoader* GetLoader() { if (instance_ == NULL) { instance_ = new CDwFontFileLoader(); - return instance_; } return instance_; } @@ -191,9 +190,6 @@ FX_BOOL CDWriteExt::DwCreateRenderingTarget(CFX_DIBitmap* pBitmap, } *(CDwGdiTextRenderer**)renderTarget = new CDwGdiTextRenderer(pBitmap, pBitmapRenderTarget, pRenderingParams); - if (*(CDwGdiTextRenderer**)renderTarget == NULL) { - goto failed; - } SafeRelease(&pGdiInterop); SafeRelease(&pBitmapRenderTarget); SafeRelease(&pRenderingParams); diff --git a/core/src/fxge/win32/fx_win32_gdipext.cpp b/core/src/fxge/win32/fx_win32_gdipext.cpp index ce65a26301..cae6c67823 100644 --- a/core/src/fxge/win32/fx_win32_gdipext.cpp +++ b/core/src/fxge/win32/fx_win32_gdipext.cpp @@ -5,20 +5,26 @@ // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com #include "../../../include/fxge/fx_ge.h" + #if _FX_OS_ == _FX_WIN32_DESKTOP_ || _FX_OS_ == _FX_WIN64_DESKTOP_ #include #include + namespace Gdiplus { using std::min; using std::max; } // namespace Gdiplus + #include #include "../../../include/fxge/fx_ge_win32.h" #include "win32_int.h" + using namespace Gdiplus; using namespace Gdiplus::DllExports; + #define GdiFillType2Gdip(fill_type) \ (fill_type == ALTERNATE ? FillModeAlternate : FillModeWinding) + static CombineMode GdiCombineMode2Gdip(int mode) { switch (mode) { case RGN_AND: diff --git a/core/src/fxge/win32/fx_win32_print.cpp b/core/src/fxge/win32/fx_win32_print.cpp index de5b4c54be..18fe1eb6fa 100644 --- a/core/src/fxge/win32/fx_win32_print.cpp +++ b/core/src/fxge/win32/fx_win32_print.cpp @@ -170,12 +170,6 @@ static CFX_DIBitmap* Transform1bppBitmap(const CFX_DIBSource* pSrc, int result_width = result_rect.Width(); int result_height = result_rect.Height(); CFX_DIBitmap* pTempBitmap = new CFX_DIBitmap; - if (!pTempBitmap) { - if (pSrcBitmap != src_bitmap) { - delete pSrcBitmap; - } - return NULL; - } if (!pTempBitmap->Create(result_width, result_height, pSrc->GetFormat())) { delete pTempBitmap; if (pSrcBitmap != src_bitmap) { @@ -324,9 +318,6 @@ FX_BOOL CPSPrinterDriver::Init(HDC hDC, int pslevel, FX_BOOL bCmykOutput) { m_Height = ::GetDeviceCaps(m_hDC, VERTRES); m_nBitsPerPixel = ::GetDeviceCaps(m_hDC, BITSPIXEL); m_pPSOutput = new CPSOutput(hDC); - if (!m_pPSOutput) { - return FALSE; - } ((CPSOutput*)m_pPSOutput)->Init(); m_PSRenderer.Init(m_pPSOutput, pslevel, m_Width, m_Height, bCmykOutput); m_bCmykOutput = bCmykOutput; -- cgit v1.2.3