From 207299b5d46e3e0612dd6a0264fb7647177312bb Mon Sep 17 00:00:00 2001 From: John Abd-El-Malek Date: Mon, 15 Dec 2014 12:13:45 -0800 Subject: XFA: merge patch from issue 801913002 and 804463003 Simplify PDFium by removing code that's not used in the open source repo. -remove parameter from FPDF_InitLibrary -remove a bunch of ifdefs that are unused Fix build after previous commit. TBR=tsepez@chromium.org BUG= Review URL: https://codereview.chromium.org/809513002 --- core/src/fxge/agg/agg23/fx_agg_driver.cpp | 2 +- core/src/fxge/apple/fx_apple_platform.cpp | 2 +- core/src/fxge/apple/fx_mac_imp.cpp | 6 ----- core/src/fxge/dib/fx_dib_engine.cpp | 11 -------- core/src/fxge/dib/fx_dib_main.cpp | 10 -------- .../fxft2.5.01/src/psnames/fxft_psmodule.c | 2 -- core/src/fxge/ge/fx_ge_font.cpp | 30 +--------------------- core/src/fxge/ge/fx_ge_fontmap.cpp | 4 +-- core/src/fxge/ge/fx_ge_linux.cpp | 27 +------------------ core/src/fxge/ge/fx_ge_text.cpp | 14 +++------- core/src/fxge/win32/fx_win32_device.cpp | 6 ----- 11 files changed, 8 insertions(+), 106 deletions(-) (limited to 'core/src/fxge') diff --git a/core/src/fxge/agg/agg23/fx_agg_driver.cpp b/core/src/fxge/agg/agg23/fx_agg_driver.cpp index f0f6e5ee66..8cea42d661 100644 --- a/core/src/fxge/agg/agg23/fx_agg_driver.cpp +++ b/core/src/fxge/agg/agg23/fx_agg_driver.cpp @@ -214,7 +214,7 @@ CFX_AggDeviceDriver::~CFX_AggDeviceDriver() } DestroyPlatform(); } -#if ((_FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_)|| defined(_FPDFAPI_MINI_)) +#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ void CFX_AggDeviceDriver::InitPlatform() { } diff --git a/core/src/fxge/apple/fx_apple_platform.cpp b/core/src/fxge/apple/fx_apple_platform.cpp index 7bc1232900..a13323d8ce 100644 --- a/core/src/fxge/apple/fx_apple_platform.cpp +++ b/core/src/fxge/apple/fx_apple_platform.cpp @@ -14,7 +14,7 @@ #include "../dib/dib_int.h" #include "../agg/include/fx_agg_driver.h" #include "../../../include/fxge/fx_freetype.h" -#if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ && (!defined(_FPDFAPI_MINI_))) +#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ void CFX_AggDeviceDriver::InitPlatform() { CQuartz2D & quartz2d = ((CApplePlatform *) CFX_GEModule::Get()->GetPlatformData())->_quartz2d; diff --git a/core/src/fxge/apple/fx_mac_imp.cpp b/core/src/fxge/apple/fx_mac_imp.cpp index a21aa5ded5..5acedc0bd9 100644 --- a/core/src/fxge/apple/fx_mac_imp.cpp +++ b/core/src/fxge/apple/fx_mac_imp.cpp @@ -25,7 +25,6 @@ Base14Substs[] = { {"Times-BoldItalic", "Times New Roman Bold Italic"}, {"Times-Italic", "Times New Roman Italic"}, }; -#if !defined(_FPDFAPI_MINI_) class CFX_MacFontInfo : public CFX_FolderFontInfo { public: @@ -86,10 +85,8 @@ void* CFX_MacFontInfo::MapFont(int weight, FX_BOOL bItalic, int charset, int pit } return NULL; } -#endif IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { -#if !defined(_FPDFAPI_MINI_) CFX_MacFontInfo* pInfo = FX_NEW CFX_MacFontInfo; if (!pInfo) { return NULL; @@ -98,9 +95,6 @@ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() pInfo->AddPath("/Library/Fonts"); pInfo->AddPath("/System/Library/Fonts"); return pInfo; -#else - return NULL; -#endif } void CFX_GEModule::InitPlatform() { diff --git a/core/src/fxge/dib/fx_dib_engine.cpp b/core/src/fxge/dib/fx_dib_engine.cpp index b436f88bd6..f4c0ef16be 100644 --- a/core/src/fxge/dib/fx_dib_engine.cpp +++ b/core/src/fxge/dib/fx_dib_engine.cpp @@ -311,11 +311,7 @@ FX_BOOL CStretchEngine::StartStretchHorz() if (m_DestWidth == 0 || m_pDestScanline == NULL || m_SrcClip.Height() > (int)((1U << 29) / m_InterPitch) || m_SrcClip.Height() == 0) { return FALSE; } -#ifndef _FPDFAPI_MINI_ m_pInterBuf = FX_AllocNL(unsigned char, m_SrcClip.Height() * m_InterPitch); -#else - m_pInterBuf = FX_Alloc(unsigned char, m_SrcClip.Height() * m_InterPitch); -#endif if (m_pInterBuf == NULL) { return FALSE; } @@ -766,11 +762,7 @@ FX_BOOL CFX_ImageStretcher::Continue(IFX_Pause* pPause) return ContinueStretch(pPause); } } -#ifndef _FPDFAPI_MINI_ #define MAX_PROGRESSIVE_STRETCH_PIXELS 1000000 -#else -#define MAX_PROGRESSIVE_STRETCH_PIXELS 100000 -#endif FX_BOOL CFX_ImageStretcher::StartStretch() { m_pStretchEngine = FX_NEW CStretchEngine(m_pDest, m_DestFormat, m_DestWidth, m_DestHeight, m_ClipRect, m_pSource, m_Flags); @@ -793,9 +785,6 @@ FX_BOOL CFX_ImageStretcher::ContinueStretch(IFX_Pause* pPause) } FX_BOOL CFX_ImageStretcher::StartQuickStretch() { -#ifdef _FPDFAPI_MINI_ - m_pSource->SetDownSampleSize(m_DestWidth, m_DestHeight); -#endif m_bFlipX = FALSE; m_bFlipY = FALSE; if (m_DestWidth < 0) { diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp index 7e8cb0c3db..2cb41f62b7 100644 --- a/core/src/fxge/dib/fx_dib_main.cpp +++ b/core/src/fxge/dib/fx_dib_main.cpp @@ -431,7 +431,6 @@ FX_BOOL CFX_DIBitmap::TransferBitmap(int dest_left, int dest_top, int width, int } return TRUE; } -#ifndef _FPDFAPI_MINI_ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int height, const CFX_DIBSource* pMask, FX_DWORD color, int src_left, int src_top, int alpha_flag, void* pIccTransform) { @@ -526,7 +525,6 @@ FX_BOOL CFX_DIBitmap::TransferMask(int dest_left, int dest_top, int width, int h } return TRUE; } -#endif void CFX_DIBSource::CopyPalette(const FX_DWORD* pSrc, FX_DWORD size) { if (pSrc == NULL || GetBPP() > 8) { @@ -1053,7 +1051,6 @@ FX_BOOL CFX_DIBitmap::MultiplyAlpha(int alpha) } return TRUE; } -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const { if (m_pBuffer == NULL) { @@ -1090,7 +1087,6 @@ FX_DWORD CFX_DIBitmap::GetPixel(int x, int y) const } return 0; } -#endif void CFX_DIBitmap::SetPixel(int x, int y, FX_DWORD color) { if (m_pBuffer == NULL) { @@ -1176,9 +1172,7 @@ void CFX_DIBitmap::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bp if (bFlipX) { src_x = m_Width - src_x - 1; } -#ifdef FOXIT_CHROME_BUILD src_x %= m_Width; -#endif dest_scan[i] = (scanline[src_x / 8] & (1 << (7 - src_x % 8))) ? 255 : 0; } } else if (src_Bpp == 1) { @@ -1188,9 +1182,7 @@ void CFX_DIBitmap::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bp if (bFlipX) { src_x = m_Width - src_x - 1; } -#ifdef FOXIT_CHROME_BUILD src_x %= m_Width; -#endif int dest_pos = i; if (m_pPalette) { if (!IsCmykImage()) { @@ -1215,9 +1207,7 @@ void CFX_DIBitmap::DownSampleScanline(int line, FX_LPBYTE dest_scan, int dest_bp for (int i = 0; i < clip_width; i ++) { FX_DWORD dest_x = clip_left + i; FX_DWORD src_x = bFlipX ? (m_Width - dest_x * m_Width / dest_width - 1) * src_Bpp : (dest_x * m_Width / dest_width) * src_Bpp; -#ifdef FOXIT_CHROME_BUILD src_x %= m_Width * src_Bpp; -#endif int dest_pos = i * src_Bpp; for (int b = 0; b < src_Bpp; b ++) { dest_scan[dest_pos + b] = scanline[src_x + b]; diff --git a/core/src/fxge/fx_freetype/fxft2.5.01/src/psnames/fxft_psmodule.c b/core/src/fxge/fx_freetype/fxft2.5.01/src/psnames/fxft_psmodule.c index 595aa87671..3380e3938a 100644 --- a/core/src/fxge/fx_freetype/fxft2.5.01/src/psnames/fxft_psmodule.c +++ b/core/src/fxge/fx_freetype/fxft2.5.01/src/psnames/fxft_psmodule.c @@ -168,7 +168,6 @@ int FXFT_unicode_from_adobe_name( const char* glyph_name ) } #endif -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) static int xyq_search_node(char* glyph_name, int name_offset, int table_offset, FT_UInt32 unicode) { int i, count; @@ -221,7 +220,6 @@ void FXFT_adobe_name_from_unicode(char* glyph_name, FT_UInt32 unicode) // failed, clear the buffer glyph_name[0] = 0; } -#endif /* ft_qsort callback to sort the unicode map */ FT_CALLBACK_DEF( int ) diff --git a/core/src/fxge/ge/fx_ge_font.cpp b/core/src/fxge/ge/fx_ge_font.cpp index e3c68e0f65..f702e89c6c 100644 --- a/core/src/fxge/ge/fx_ge_font.cpp +++ b/core/src/fxge/ge/fx_ge_font.cpp @@ -54,16 +54,6 @@ FX_BOOL CFX_Font::LoadClone(const CFX_Font* pFont) m_dwSize = pFont->m_dwSize; m_pFontData = pFont->m_pFontData; m_pGsubData = pFont->m_pGsubData; -#ifdef FOXIT_CHROME_BUILD - if (pFont->m_pFontDataAllocation) { - m_pFontDataAllocation = FX_Alloc(FX_BYTE, m_dwSize); - if (!m_pFontDataAllocation) { - return FALSE; - } - m_pFontData = m_pFontDataAllocation; - FXSYS_memcpy32(m_pFontDataAllocation, pFont->m_pFontDataAllocation, m_dwSize); - } -#endif m_pPlatformFont = pFont->m_pPlatformFont; m_pPlatformFontCollection = pFont->m_pPlatformFontCollection; m_pDwFont = pFont->m_pDwFont; @@ -78,22 +68,11 @@ CFX_Font::~CFX_Font() delete m_pSubstFont; m_pSubstFont = NULL; } -#ifdef FOXIT_CHROME_BUILD - if (m_pFontDataAllocation) { - FX_Free(m_pFontDataAllocation); - m_pFontDataAllocation = NULL; - } -#endif if (m_bLogic) { m_OtfFontData.DetachBuffer(); return; } if (m_Face) { -#ifdef FOXIT_CHROME_BUILD - if (FXFT_Get_Face_External_Stream(m_Face)) { - FXFT_Clear_Face_External_Stream(m_Face); - } -#endif if(m_bEmbedded) { DeleteFace(); } else { @@ -108,7 +87,7 @@ CFX_Font::~CFX_Font() FX_Free(m_pGsubData); m_pGsubData = NULL; } -#if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ && (!defined(_FPDFAPI_MINI_))) +#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ ReleasePlatformResource(); #endif } @@ -194,9 +173,7 @@ FX_BOOL CFX_Font::LoadFile(IFX_FileRead* pFile, int nFaceIndex, int* pFaceCount) return FALSE; if (pFaceCount) *pFaceCount = (int)m_Face->num_faces; -#ifndef FOXIT_CHROME_BUILD m_pOwnedStream = stream; -#endif FXFT_Set_Pixel_Sizes(m_Face, 0, 64); return TRUE; } @@ -235,7 +212,6 @@ static FXFT_Face FT_LoadFont(FX_LPBYTE pData, int size) } FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) { -#ifdef FOXIT_CHROME_BUILD m_pFontDataAllocation = FX_Alloc(FX_BYTE, size); if (!m_pFontDataAllocation) { return FALSE; @@ -243,10 +219,6 @@ FX_BOOL CFX_Font::LoadEmbedded(FX_LPCBYTE data, FX_DWORD size) FXSYS_memcpy32(m_pFontDataAllocation, data, size); m_Face = FT_LoadFont((FX_LPBYTE)m_pFontDataAllocation, size); m_pFontData = (FX_LPBYTE)m_pFontDataAllocation; -#else - m_Face = FT_LoadFont((FX_LPBYTE)data, size); - m_pFontData = (FX_LPBYTE)data; -#endif m_bEmbedded = TRUE; m_dwSize = size; return m_Face != NULL; diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp index fe790d8664..e27c51fcbb 100644 --- a/core/src/fxge/ge/fx_ge_fontmap.cpp +++ b/core/src/fxge/ge/fx_ge_fontmap.cpp @@ -1373,13 +1373,12 @@ CFontFileFaceInfo::~CFontFileFaceInfo() m_Face = NULL; } extern FX_BOOL _LoadFile(FXFT_Library library, FXFT_Face* Face, IFX_FileRead* pFile, FXFT_Stream* stream); -#if defined(_FPDFAPI_MINI_) || _FX_OS_ == _FX_ANDROID_ +#if _FX_OS_ == _FX_ANDROID_ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { return NULL; } #endif -#if !defined(_FPDFAPI_MINI_) CFX_FolderFontInfo::CFX_FolderFontInfo() { } @@ -1616,4 +1615,3 @@ FX_BOOL CFX_FolderFontInfo::GetFontCharset(void* hFont, int& charset) { return FALSE; } -#endif diff --git a/core/src/fxge/ge/fx_ge_linux.cpp b/core/src/fxge/ge/fx_ge_linux.cpp index 735ecac0c8..ad0a70ab1f 100644 --- a/core/src/fxge/ge/fx_ge_linux.cpp +++ b/core/src/fxge/ge/fx_ge_linux.cpp @@ -7,32 +7,7 @@ #include "../../../include/fxge/fx_ge.h" #include "../agg/include/fx_agg_driver.h" #include "text_int.h" -#if !defined(_FPDFAPI_MINI_) && _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ -#if (_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ && (!defined(_FPDFAPI_MINI_))) -void CFX_AggDeviceDriver::InitPlatform() -{ -} -void CFX_AggDeviceDriver::DestroyPlatform() -{ -} -void CFX_FaceCache::InitPlatform() -{ -} -FX_BOOL CFX_AggDeviceDriver::DrawDeviceText(int nChars, const FXTEXT_CHARPOS* pCharPos, CFX_Font* pFont, - CFX_FontCache* pCache, const CFX_AffineMatrix* pObject2Device, - FX_FLOAT font_size, FX_DWORD argb) -{ - return FALSE; -} -CFX_GlyphBitmap* CFX_FaceCache::RenderGlyph_Nativetext(CFX_Font* pFont, FX_DWORD glyph_index, const CFX_AffineMatrix* pMatrix, - int dest_width, int anti_alias) -{ - return NULL; -} -void CFX_Font::ReleasePlatformResource() -{ -} -#endif +#if _FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ static const struct { FX_LPCSTR m_pName; FX_LPCSTR m_pSubstName; diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp index 440ecdd696..0724c10edf 100644 --- a/core/src/fxge/ge/fx_ge_text.cpp +++ b/core/src/fxge/ge/fx_ge_text.cpp @@ -135,9 +135,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar if (!(text_flags & FXTEXT_PRINTGRAPHICTEXT)) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!(text_flags & FXFONT_CIDFONT) && pFont->GetPsName().Find(CFX_WideString::FromLocal("+ZJHL")) == -1) -#ifdef FOXIT_CHROME_BUILD if (pFont->GetPsName() != CFX_WideString::FromLocal("CNAAJI+cmex10")) -#endif #endif if (m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache, pText2Device, font_size, fill_color, alpha_flag, pIccTransform)) { return TRUE; @@ -150,9 +148,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, const FXTEXT_CHARPOS* pChar } else if (!(text_flags & FXTEXT_NO_NATIVETEXT)) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if (!(text_flags & FXFONT_CIDFONT)) -#ifdef FOXIT_CHROME_BUILD if (pFont->GetPsName() != CFX_WideString::FromLocal("CNAAJI+cmex10")) -#endif #endif if (m_pDeviceDriver->DrawDeviceText(nChars, pCharPos, pFont, pCache, pText2Device, font_size, fill_color, alpha_flag, pIccTransform)) { return TRUE; @@ -1070,7 +1066,7 @@ CFX_FaceCache::~CFX_FaceCache() } m_PathMap.RemoveAll(); } -#if ((_FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_)|| defined(_FPDFAPI_MINI_)) +#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ void CFX_FaceCache::InitPlatform() { } @@ -1105,7 +1101,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD return NULL; } _CFX_UniqueKeyGen keygen; -#if ((_FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_)|| defined(_FPDFAPI_MINI_)) +#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ if (pFont->GetSubstFont()) keygen.Generate(9, (int)(pMatrix->a * 10000), (int)(pMatrix->b * 10000), (int)(pMatrix->c * 10000), (int)(pMatrix->d * 10000), dest_width, anti_alias, @@ -1133,7 +1129,7 @@ const CFX_GlyphBitmap* CFX_FaceCache::LoadGlyphBitmap(CFX_Font* pFont, FX_DWORD } #endif CFX_ByteStringC FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen); -#if ((_FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_)|| defined(_FPDFAPI_MINI_)) +#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ return LookUpGlyphBitmap(pFont, pMatrix, FaceGlyphsKey, glyph_index, bFontStyle, dest_width, anti_alias); #else if (text_flags & FXTEXT_NO_NATIVETEXT) { @@ -1186,11 +1182,7 @@ CFX_SizeGlyphCache::~CFX_SizeGlyphCache() } m_GlyphMap.RemoveAll(); } -#if defined(_FPDFAPI_MINI_) -#define CONTRAST_RAMP_STEP 16 -#else #define CONTRAST_RAMP_STEP 1 -#endif void CFX_Font::AdjustMMParams(int glyph_index, int dest_width, int weight) { FXFT_MM_Var pMasters = NULL; diff --git a/core/src/fxge/win32/fx_win32_device.cpp b/core/src/fxge/win32/fx_win32_device.cpp index d82102462a..3ee9441bc3 100644 --- a/core/src/fxge/win32/fx_win32_device.cpp +++ b/core/src/fxge/win32/fx_win32_device.cpp @@ -391,12 +391,10 @@ FX_BOOL CWin32FontInfo::GetFontCharset(void* hFont, int& charset) charset = tm.tmCharSet; return TRUE; } -#ifndef _FPDFAPI_MINI_ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault() { return FX_NEW CWin32FontInfo; } -#endif void CFX_GEModule::InitPlatform() { CWin32Platform* pPlatformData = FX_NEW CWin32Platform; @@ -979,11 +977,9 @@ FX_BOOL CGdiDisplayDriver::GetDIBits(CFX_DIBitmap* pBitmap, int left, int top, v ret = FALSE; } } -#ifndef _FPDFAPI_MINI_ if (pBitmap->HasAlpha() && ret) { pBitmap->LoadChannel(FXDIB_Alpha, 0xff); } -#endif DeleteObject(hbmp); DeleteObject(hDCMemory); return ret; @@ -1175,11 +1171,9 @@ IFX_RenderDeviceDriver* CFX_WindowsDevice::CreateDriver(HDC hDC, FX_BOOL bCmykOu } else { device_class = FXDC_DISPLAY; } -#ifndef _FPDFAPI_MINI_ if (device_class == FXDC_PRINTER) { return FX_NEW CGdiPrinterDriver(hDC); } -#endif return FX_NEW CGdiDisplayDriver(hDC); } CFX_WinBitmapDevice::CFX_WinBitmapDevice(int width, int height, FXDIB_Format format) -- cgit v1.2.3