diff options
Diffstat (limited to 'core/src')
30 files changed, 11 insertions, 1433 deletions
diff --git a/core/src/fpdfapi/fpdf_basic_module.cpp b/core/src/fpdfapi/fpdf_basic_module.cpp index a446aa5d21..edccda5743 100644 --- a/core/src/fpdfapi/fpdf_basic_module.cpp +++ b/core/src/fpdfapi/fpdf_basic_module.cpp @@ -78,40 +78,6 @@ static CFX_ByteString _GetPath(const CFX_ByteString& folder, FX_LPCSTR name) } #endif } -void CPDF_ModuleMgr::SetModulePath(FX_LPCSTR module_name, FX_LPCSTR path) -{ - if (module_name == NULL || module_name[0] == 0) { - m_DefaultModulePath = path; - } else { - m_ModulePathList.SetAt(module_name, FX_NEW CFX_ByteString(path, -1)); - } -} -CFX_ByteString CPDF_ModuleMgr::GetModuleFilePath(FX_LPCSTR module_name, FX_LPCSTR name) -{ - CFX_ByteString* pPath = NULL; - if (m_ModulePathList.Lookup(module_name, (FX_LPVOID&)pPath)) { - return _GetPath(*pPath, name); - } - if (!m_DefaultModulePath.IsEmpty()) { - return _GetPath(m_DefaultModulePath, name); - } -#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ - FX_WCHAR app_path[260]; - ::GetModuleFileNameW(NULL, (LPWSTR)app_path, 260); - FX_INTPTR len = FXSYS_wcslen(app_path); - for (FX_INTPTR i = len; i >= 0; i --) - if (app_path[i] == '\\') { - app_path[i] = 0; - break; - } - CFX_ByteString path = CFX_ByteString::FromUnicode(app_path); - path += '\\'; - path += name; - return path; -#else - return name; -#endif -} void CPDF_ModuleMgr::NotifyModuleAvailable(FX_LPCSTR module_name) { if (FXSYS_strcmp(module_name, ADDIN_NAME_CJK) == 0) { diff --git a/core/src/fpdfapi/fpdf_font/font_int.h b/core/src/fpdfapi/fpdf_font/font_int.h index 3ce9664ceb..2922ed2308 100644 --- a/core/src/fpdfapi/fpdf_font/font_int.h +++ b/core/src/fpdfapi/fpdf_font/font_int.h @@ -18,10 +18,8 @@ private: CPDF_CMap* LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPrompt); CPDF_CID2UnicodeMap* LoadCID2UnicodeMap(int charset, FX_BOOL bPrompt); void DropAll(FX_BOOL bReload); -#ifndef _FPDFAPI_MINI_ FX_BOOL m_bPrompted; FX_LPVOID m_pPackage; -#endif CFX_MapByteStringToPtr m_CMaps; CPDF_CID2UnicodeMap* m_CID2UnicodeMaps[6]; }; @@ -178,9 +176,7 @@ protected: int m_Charset; const FX_WORD* m_pEmbeddedMap; FX_DWORD m_EmbeddedCount; -#ifndef _FPDFAPI_MINI_ CPDF_FXMP* m_pExternalMap; -#endif }; class CPDF_ToUnicodeMap : public CFX_Object { diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp index e5dabc33da..766fd352b4 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -19,40 +19,21 @@ extern FX_BOOL FT_UseTTCharmap(FXFT_Face face, int platform_id, int encoding_id) extern FX_LPCSTR GetAdobeCharName(int iBaseEncoding, const CFX_ByteString* pCharNames, int charcode); CPDF_CMapManager::CPDF_CMapManager() { -#ifndef _FPDFAPI_MINI_ m_bPrompted = FALSE; m_pPackage = NULL; -#endif FXSYS_memset32(m_CID2UnicodeMaps, 0, sizeof m_CID2UnicodeMaps); } CPDF_CMapManager::~CPDF_CMapManager() { DropAll(FALSE); -#ifndef _FPDFAPI_MINI_ if (m_pPackage) { FXFC_ClosePackage(m_pPackage); } -#endif } -#ifndef _FPDFAPI_MINI_ FX_LPVOID CPDF_CMapManager::GetPackage(FX_BOOL bPrompt) { -#ifndef FOXIT_CHROME_BUILD - if (m_pPackage == NULL) { - CFX_ByteString filename = CPDF_ModuleMgr::Get()->GetModuleFilePath(ADDIN_NAME_CJK, "FPDFCJK.BIN"); - m_pPackage = FXFC_LoadPackage(filename); - if (bPrompt && m_pPackage == NULL && !m_bPrompted) { - m_bPrompted = TRUE; - if (!CPDF_ModuleMgr::Get()->DownloadModule(ADDIN_NAME_CJK)) { - return NULL; - } - m_pPackage = FXFC_LoadPackage(filename); - } - } -#endif return m_pPackage; } -#endif CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK) { CPDF_CMap* pCMap; @@ -418,7 +399,6 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BO m_bLoaded = TRUE; return TRUE; } -#ifndef _FPDFAPI_MINI_ FX_LPVOID pPackage = pMgr->GetPackage(bPromptCJK); FX_LPBYTE pBuffer; FX_DWORD size; @@ -462,7 +442,6 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr, FX_LPCSTR pName, FX_BO } FX_Free(pBuffer); m_bLoaded = TRUE; -#endif return TRUE; } extern "C" { @@ -739,32 +718,22 @@ int CPDF_CMap::AppendChar(FX_LPSTR str, FX_DWORD charcode) const CPDF_CID2UnicodeMap::CPDF_CID2UnicodeMap() { m_EmbeddedCount = 0; -#ifndef _FPDFAPI_MINI_ m_pExternalMap = NULL; -#endif } CPDF_CID2UnicodeMap::~CPDF_CID2UnicodeMap() { -#ifndef _FPDFAPI_MINI_ if (m_pExternalMap) { delete m_pExternalMap; } -#endif } FX_BOOL CPDF_CID2UnicodeMap::Initialize() { -#ifndef _FPDFAPI_MINI_ m_pExternalMap = FX_NEW CPDF_FXMP; -#endif return TRUE; } FX_BOOL CPDF_CID2UnicodeMap::IsLoaded() { -#ifdef _FPDFAPI_MINI_ - return m_EmbeddedCount != 0; -#else return m_EmbeddedCount != 0 || (m_pExternalMap != NULL && m_pExternalMap->IsLoaded()); -#endif } FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(FX_WORD CID) { @@ -774,15 +743,11 @@ FX_WCHAR CPDF_CID2UnicodeMap::UnicodeFromCID(FX_WORD CID) if (CID < m_EmbeddedCount) { return m_pEmbeddedMap[CID]; } -#ifdef _FPDFAPI_MINI_ - return 0; -#else FX_LPCBYTE record = m_pExternalMap->GetRecord(CID); if (record == NULL) { return 0; } return *(FX_WORD*)record; -#endif } void FPDFAPI_LoadCID2UnicodeMap(int charset, const FX_WORD*& pMap, FX_DWORD& count); void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, int charset, FX_BOOL bPromptCJK) @@ -792,13 +757,11 @@ void CPDF_CID2UnicodeMap::Load(CPDF_CMapManager* pMgr, int charset, FX_BOOL bPro if (m_EmbeddedCount) { return; } -#ifndef _FPDFAPI_MINI_ FX_LPVOID pPackage = pMgr->GetPackage(bPromptCJK); if (pPackage == NULL) { return; } m_pExternalMap->LoadFile(pPackage, FX_BSTRC("CIDInfo_") + g_CharsetNames[charset]); -#endif } #include "ttgsubtable.h" CPDF_CIDFont::CPDF_CIDFont() @@ -1356,7 +1319,7 @@ int CPDF_CIDFont::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL *pVertGlyph) if (unicode == '\\') { unicode = '/'; } -#if !defined(_FPDFAPI_MINI_) && _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ +#if _FXM_PLATFORM_ != _FXM_PLATFORM_APPLE_ else if (unicode == 0xa5) { unicode = 0x5c; } diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp index 776d82e21c..08aada2a9c 100644 --- a/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp +++ b/core/src/fpdfapi/fpdf_font/fpdf_font_utility.cpp @@ -8,7 +8,6 @@ #include "../../../include/fpdfapi/fpdf_resource.h" #include "../../../include/fxcodec/fx_codec.h" #include "font_int.h" -#ifndef _FPDFAPI_MINI_ typedef struct { FXSYS_FILE* m_pFile; int m_nFiles; @@ -93,4 +92,3 @@ FX_LPBYTE CPDF_FXMP::GetRecord(FX_DWORD index) } return m_pTable + (index - m_pHeader->dwStartIndex) * m_pHeader->dwRecordSize; } -#endif diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp index b1fbe01b90..5d24ab742a 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp @@ -77,15 +77,6 @@ CPDF_Image::~CPDF_Image() { if (m_bInline) { if (m_pStream) { -#ifndef FOXIT_CHROME_BUILD - CPDF_Dictionary* pDict = m_pStream->GetDict(); - if (pDict) { - CPDF_Object* pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace")); - if (pCSObj && m_pDocument) { - m_pDocument->RemoveColorSpaceFromPageData(pCSObj); - } - } -#endif m_pStream->Release(); } if (m_pInlineDict) { @@ -107,9 +98,7 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) } m_pOC = pDict->GetDict(FX_BSTRC("OC")); m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) || pDict->GetInteger(FX_BSTRC("ImageMask")); -#ifndef _FPDFAPI_MINI_ m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate")); -#endif m_Height = pDict->GetInteger(FX_BSTRC("Height")); m_Width = pDict->GetInteger(FX_BSTRC("Width")); return TRUE; diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp index 7d8bd4842a..879c2f3c0e 100644 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp +++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp @@ -29,33 +29,9 @@ CPDF_StreamContentParser::CPDF_StreamContentParser() m_pLastImage = NULL; m_bReleaseLastDict = TRUE; m_pParentResources = NULL; -#ifdef _FPDFAPI_MINI_ - m_pObjectState = NULL; - m_pObjectStack = NULL; - m_pWordBuf = NULL; - m_pDictName = NULL; - m_pStreamBuf = NULL; - m_WordState = 0; - m_ObjectSize = 0; -#endif } FX_BOOL CPDF_StreamContentParser::Initialize() { -#ifdef _FPDFAPI_MINI_ - m_pObjectState = FX_Alloc(FX_BOOL, _FPDF_MAX_OBJECT_STACK_SIZE_); - FXSYS_memset32(m_pObjectState, 0, _FPDF_MAX_OBJECT_STACK_SIZE_ * sizeof(FX_BOOL)); - m_pObjectStack = FX_Alloc(CPDF_Object*, _FPDF_MAX_OBJECT_STACK_SIZE_); - FXSYS_memset32(m_pObjectStack, 0, _FPDF_MAX_OBJECT_STACK_SIZE_ * sizeof(CPDF_Object*)); - m_pWordBuf = FX_Alloc(FX_BYTE, 256); - FXSYS_memset32(m_pWordBuf, 0, 256 * sizeof(FX_BYTE)); - m_pDictName = FX_Alloc(FX_BYTE, 256); - FXSYS_memset32(m_pDictName, 0, 256 * sizeof(FX_BYTE)); - m_pStreamBuf = FX_Alloc(FX_BYTE, STREAM_PARSE_BUFSIZE); - FXSYS_memset32(m_pStreamBuf, 0, STREAM_PARSE_BUFSIZE * sizeof(FX_BYTE)); - m_StringBuf.EstimateSize(1024); - m_ObjectSize = 0; - m_ImageSrcBuf.EstimateSize(STREAM_PARSE_BUFSIZE); -#endif return TRUE; } CPDF_StreamContentParser::~CPDF_StreamContentParser() @@ -77,18 +53,6 @@ CPDF_StreamContentParser::~CPDF_StreamContentParser() if (m_pLastCloneImageDict) { m_pLastCloneImageDict->Release(); } -#ifdef _FPDFAPI_MINI_ - for (i = 0; i < (int)m_ObjectSize; ++i) { - if (!m_pObjectState[i]) { - m_pObjectStack[i]->Release(); - } - } - FX_Free(m_pObjectStack); - FX_Free(m_pObjectState); - FX_Free(m_pStreamBuf); - FX_Free(m_pWordBuf); - FX_Free(m_pDictName); -#endif } void CPDF_StreamContentParser::PrepareParse(CPDF_Document* pDocument, CPDF_Dictionary* pPageResources, CPDF_Dictionary* pParentResources, CFX_AffineMatrix* pmtContentToUser, CPDF_PageObjects* pObjList, @@ -128,9 +92,6 @@ void CPDF_StreamContentParser::PrepareParse(CPDF_Document* pDocument, m_pCurStates->m_TextState.New(); m_pCurStates->m_ColorState.New(); } -#ifdef _FPDFAPI_MINI_ - FXSYS_memset32(m_pObjectState, 0, _FPDF_MAX_OBJECT_STACK_SIZE_ * sizeof(FX_BOOL)); -#endif } int CPDF_StreamContentParser::GetNextParamPos() { @@ -676,11 +637,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { CFX_ByteString name = GetString(0); if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() && m_pLastImage->GetStream()->GetObjNum()) { -#if defined(_FPDFAPI_MINI_) && !defined(_FXCORE_FEATURE_ALL_) - AddDuplicateImage(); -#else AddImage(NULL, m_pLastImage, FALSE); -#endif return; } if (m_Options.m_bTextOnly) { @@ -744,7 +701,6 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() } void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) { -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) if (!m_Options.m_bSeparateForm) { CPDF_Dictionary* pResources = pStream->GetDict()->GetDict(FX_BSTRC("Resources")); CFX_AffineMatrix form_matrix = pStream->GetDict()->GetMatrix(FX_BSTRC("Matrix")); @@ -772,15 +728,9 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) if (stream.GetSize() == 0) { return; } -#ifdef _FPDFAPI_MINI_ - parser.InputData(stream.GetData(), stream.GetSize()); - parser.Finish(); -#else parser.Parse(stream.GetData(), stream.GetSize(), 0); -#endif return; } -#endif CPDF_FormObject* pFormObj = FX_NEW CPDF_FormObject; pFormObj->m_pForm = FX_NEW CPDF_Form(m_pDocument, m_pPageResources, pStream, m_pResources); pFormObj->m_FormMatrix = m_pCurStates->m_CTM; @@ -798,44 +748,6 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) SetGraphicStates(pFormObj, TRUE, TRUE, TRUE); m_pObjectList->m_ObjectList.AddTail(pFormObj); } -#if defined(_FPDFAPI_MINI_) && !defined(_FXCORE_FEATURE_ALL_) -void CPDF_StreamContentParser::AddDuplicateImage() -{ - FX_POSITION tailpos = m_pObjectList->m_ObjectList.GetTailPosition(); - CPDF_PageObject* pLastObj = (CPDF_PageObject*)m_pObjectList->m_ObjectList.GetAt(tailpos); - if (pLastObj == NULL || (pLastObj->m_Type != PDFPAGE_INLINES && pLastObj->m_Type != PDFPAGE_IMAGE)) { - AddImage(NULL, m_pLastImage, FALSE); - return; - } - if (pLastObj->m_GeneralState != m_pCurStates->m_GeneralState || - pLastObj->m_ClipPath != m_pCurStates->m_ClipPath || - pLastObj->m_ColorState != m_pCurStates->m_ColorState) { - AddImage(NULL, m_pLastImage, FALSE); - return; - } - CFX_AffineMatrix ImageMatrix; - ImageMatrix.Copy(m_pCurStates->m_CTM); - ImageMatrix.Concat(m_mtContentToUser); - if (pLastObj->m_Type == PDFPAGE_INLINES) { - CPDF_InlineImages* pInlines = (CPDF_InlineImages*)pLastObj; - if (pInlines->m_pStream != m_pLastImage->GetStream()) { - AddImage(NULL, m_pLastImage, FALSE); - return; - } - pInlines->AddMatrix(ImageMatrix); - } else { - CPDF_ImageObject* pImageObj = (CPDF_ImageObject*)pLastObj; - CPDF_InlineImages* pInlines = FX_NEW CPDF_InlineImages; - pInlines->m_pStream = m_pLastImage->GetStream(); - SetGraphicStates(pInlines, !pInlines->m_pStream->GetDict()->KeyExist(FX_BSTRC("ColorSpace")), FALSE, FALSE); - pInlines->AddMatrix(pImageObj->m_Matrix); - pInlines->AddMatrix(ImageMatrix); - m_pObjectList->m_ObjectList.RemoveAt(tailpos); - m_pObjectList->m_ObjectList.AddTail(pInlines); - pLastObj->Release(); - } -} -#endif CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream, CPDF_Image* pImage, FX_BOOL bInline) { if (pStream == NULL && pImage == NULL) { @@ -963,9 +875,7 @@ void CPDF_StreamContentParser::Handle_ClosePath() } void CPDF_StreamContentParser::Handle_SetFlat() { -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) m_pCurStates->m_GeneralState.GetModify()->m_Flatness = GetNumber(0); -#endif } void CPDF_StreamContentParser::Handle_BeginImageData() { @@ -1010,15 +920,11 @@ void CPDF_StreamContentParser::Handle_MoveTo() { REQUIRE_PARAMS(2); if (m_Options.m_bTextOnly) { -#ifndef _FPDFAPI_MINI_ m_pSyntax->SkipPathObject(); -#endif return; } AddPathPoint(GetNumber(1), GetNumber(0), FXPT_MOVETO); -#ifndef _FPDFAPI_MINI_ ParsePathObject(); -#endif } void CPDF_StreamContentParser::Handle_SetMiterLimit() { diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_new.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_new.cpp deleted file mode 100644 index 24ec7436aa..0000000000 --- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_new.cpp +++ /dev/null @@ -1,822 +0,0 @@ -// Copyright 2014 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#include "../../../include/fpdfapi/fpdf_page.h" -#include "../../../include/fpdfapi/fpdf_module.h" -#include "pageint.h" -#if defined(_FPDFAPI_MINI_) -extern const FX_LPCSTR _PDF_CharType; -void CPDF_StreamContentParser::InputData(FX_LPCBYTE src_buf, FX_DWORD src_size) -{ - if (m_Level > _FPDF_MAX_FORM_LEVEL_) { - return; - } - for (FX_DWORD i = 0; i < src_size; i ++) { - int ch = src_buf[i]; - int type = _PDF_CharType[ch]; -start: - switch (m_WordState) { - case 0: - if (type == 'W') { - } else if (type == 'N') { - m_WordState = 5; - m_pWordBuf[0] = ch; - m_WordSize = 1; - } else if (type == 'R') { - m_WordState = 4; - m_pWordBuf[0] = ch; - m_WordSize = 1; - } else switch (ch) { - case '/': - m_WordState = 2; - m_WordSize = 0; - break; - case '[': - StartArray(); - break; - case ']': - EndArray(); - break; - case '(': - m_WordState = 7; - m_StringLevel = 1; - m_StringState = 0; - m_StringBuf.Clear(); - break; - case '<': - m_WordState = 3; - break; - case '>': - m_WordState = 8; - break; - case '%': - m_WordState = 1; - break; - } - break; - case 1: - if (ch == '\n' || ch == '\r') { - m_WordState = 0; - } - break; - case 2: - if (type != 'R' && type != 'N') { - EndName(); - m_WordState = 0; - goto start; - } - if (m_WordSize < 256) { - m_pWordBuf[m_WordSize++] = ch; - } - break; - case 3: - if (ch == '<') { - StartDict(); - m_WordState = 0; - } else { - m_StringBuf.Clear(); - m_WordState = 6; - goto start; - } - break; - case 4: - if (type != 'R' && type != 'N') { - m_WordState = 0; - EndKeyword(); - if (m_bAbort) { - return; - } - goto start; - } - if (m_WordSize < 256) { - m_pWordBuf[m_WordSize++] = ch; - } - break; - case 5: - if (type != 'N') { - EndNumber(); - m_WordState = 0; - goto start; - } - if (m_WordSize < 256) { - m_pWordBuf[m_WordSize++] = ch; - } - break; - case 6: - if (ch == '>') { - EndHexString(); - m_WordState = 0; - } else { - m_StringBuf.AppendByte(ch); - } - break; - case 7: - switch (m_StringState) { - case 0: - if (ch == ')') { - m_StringLevel --; - if (m_StringLevel == 0) { - EndString(); - m_WordState = 0; - break; - } - m_StringBuf.AppendByte(')'); - } else if (ch == '(') { - m_StringLevel ++; - m_StringBuf.AppendByte('('); - } else if (ch == '\\') { - m_StringState = 1; - } else { - m_StringBuf.AppendByte((char)ch); - } - break; - case 1: - if (ch >= '0' && ch <= '7') { - m_EscCode = ch - '0'; - m_StringState = 2; - break; - } - if (ch == 'n') { - m_StringBuf.AppendByte('\n'); - } else if (ch == 'r') { - m_StringBuf.AppendByte('\r'); - } else if (ch == 't') { - m_StringBuf.AppendByte('\t'); - } else if (ch == 'b') { - m_StringBuf.AppendByte('\b'); - } else if (ch == 'f') { - m_StringBuf.AppendByte('\f'); - } else if (ch == '\\') { - m_StringBuf.AppendByte('\\'); - } else if (ch == '(') { - m_StringBuf.AppendByte('('); - } else if (ch == ')') { - m_StringBuf.AppendByte(')'); - } else if (ch == '\r') { - m_StringState = 4; - break; - } else if (ch == '\n') { - } else { - m_StringBuf.AppendByte(ch); - } - m_StringState = 0; - break; - case 2: - if (ch >= '0' && ch <= '7') { - m_EscCode = m_EscCode * 8 + ch - '0'; - m_StringState = 3; - } else { - m_StringBuf.AppendByte(m_EscCode); - m_StringState = 0; - goto start; - } - break; - case 3: - if (ch >= '0' && ch <= '7') { - m_EscCode = m_EscCode * 8 + ch - '0'; - m_StringBuf.AppendByte(m_EscCode); - m_StringState = 0; - } else { - m_StringBuf.AppendByte(m_EscCode); - m_StringState = 0; - goto start; - } - break; - case 4: - m_StringState = 0; - if (ch != '\n') { - goto start; - } - break; - } - break; - case 8: - m_WordState = 0; - if (ch == '>') { - EndDict(); - } else { - goto start; - } - break; - case 9: - switch (m_InlineImageState) { - case 0: - if (type == 'W' || type == 'D') { - m_InlineImageState = 1; - m_InlineWhiteChar = ch; - } else { - m_StringBuf.AppendByte(ch); - } - break; - case 1: - m_StringBuf.AppendByte(m_InlineWhiteChar); - if (ch == 'I') { - m_InlineImageState = 2; - } else { - m_InlineImageState = 0; - goto start; - } - break; - case 2: - if (ch == 'D') { - m_InlineImageState = 3; - } else { - m_StringBuf.AppendByte('I'); - m_InlineImageState = 0; - goto start; - } - break; - case 3: - EndImageDict(); - break; - } - break; - case 10: - switch (m_InlineImageState) { - case 0: - if (type == 'W') { - m_InlineImageState = 1; - m_InlineWhiteChar = ch; - } else { - m_ImageSrcBuf.AppendByte(ch); - } - break; - case 1: - if (ch == 'E') { - m_InlineImageState = 2; - } else { - m_ImageSrcBuf.AppendByte(m_InlineWhiteChar); - m_InlineImageState = 0; - goto start; - } - break; - case 2: - if (ch == 'I') { - m_InlineImageState = 3; - } else { - m_ImageSrcBuf.AppendByte(m_InlineWhiteChar); - m_ImageSrcBuf.AppendByte('E'); - m_InlineImageState = 0; - goto start; - } - break; - case 3: - if (type == 'W') { - EndInlineImage(); - } else { - m_ImageSrcBuf.AppendByte(m_InlineWhiteChar); - m_ImageSrcBuf.AppendByte('E'); - m_ImageSrcBuf.AppendByte('I'); - m_InlineImageState = 0; - goto start; - } - break; - } - break; - case 11: - if (m_InlineImageState < m_ImageSrcBuf.GetSize()) { - m_ImageSrcBuf.GetBuffer()[m_InlineImageState ++] = ch; - } else { - if (ch == 'I') { - EndInlineImage(); - } - } - break; - } - } -} -void CPDF_StreamContentParser::Finish() -{ - switch (m_WordState) { - case 0: - break; - case 1: - break; - case 2: - EndName(); - break; - case 3: - break; - case 4: - EndKeyword(); - break; - case 5: - EndNumber(); - break; - case 6: - EndHexString(); - break; - case 7: - EndString(); - break; - case 8: - break; - case 9: - break; - case 10: - EndInlineImage(); - break; - } - m_WordState = 0; -} -void CPDF_StreamContentParser::AddContainer(CPDF_Object* pObject) -{ - if (m_ObjectSize) { - m_pObjectState[m_ObjectSize] = SetToCurObj(pObject); - } - FXSYS_assert(m_ObjectSize < _FPDF_MAX_OBJECT_STACK_SIZE_); - m_pObjectStack[m_ObjectSize++] = pObject; -} -FX_BOOL CPDF_StreamContentParser::SetToCurObj(CPDF_Object* pObject) -{ - if (m_ObjectSize == 0) { - AddObjectParam(pObject); - return TRUE; - } - FX_BOOL bInArrayOrDict = TRUE; - CPDF_Object* pCurObj = m_pObjectStack[m_ObjectSize - 1]; - if (pCurObj->GetType() == PDFOBJ_ARRAY) { - ((CPDF_Array*)pCurObj)->Add(pObject, m_pDocument); - } else { - if (!m_bDictName && m_pDictName[0]) { - ((CPDF_Dictionary*)pCurObj)->SetAt((FX_LPCSTR)m_pDictName, pObject, m_pDocument); - } else { - bInArrayOrDict = FALSE; - } - m_bDictName = TRUE; - } - return bInArrayOrDict; -} -void CPDF_StreamContentParser::StartArray() -{ - if (m_ObjectSize) - if (m_pObjectStack[0]->GetType() != PDFOBJ_DICTIONARY && m_pObjectStack[m_ObjectSize - 1]->GetType() == PDFOBJ_ARRAY) { - return; - } - CPDF_Array* pArray = FX_NEW CPDF_Array; - AddContainer(pArray); -} -void CPDF_StreamContentParser::EndArray() -{ - if (m_ObjectSize == 0) { - return; - } - CPDF_Object* pCurObj = m_pObjectStack[m_ObjectSize - 1]; - if (pCurObj->GetType() != PDFOBJ_ARRAY) { - return; - } - m_ObjectSize --; - if (m_ObjectSize == 0) { - AddObjectParam(pCurObj); - } else { - if (!m_pObjectState[m_ObjectSize]) { - pCurObj->Release(); - } - } - m_pObjectState[m_ObjectSize] = FALSE; -} -void CPDF_StreamContentParser::StartDict() -{ - CPDF_Dictionary* pDict = FX_NEW CPDF_Dictionary; - AddContainer(pDict); - m_bDictName = TRUE; -} -void CPDF_StreamContentParser::EndDict() -{ - if (m_ObjectSize == 0) { - return; - } - CPDF_Object* pCurObj = m_pObjectStack[m_ObjectSize - 1]; - if (pCurObj->GetType() != PDFOBJ_DICTIONARY) { - return; - } - m_ObjectSize --; - if (m_ObjectSize == 0) { - AddObjectParam(pCurObj); - } else { - if (!m_pObjectState[m_ObjectSize]) { - pCurObj->Release(); - } - } - m_pObjectState[m_ObjectSize] = FALSE; -} -void CPDF_StreamContentParser::EndName() -{ - if (m_ObjectSize == 0) { - AddNameParam((FX_LPCSTR)m_pWordBuf, m_WordSize); - return; - } - CPDF_Object* pCurObj = m_pObjectStack[m_ObjectSize - 1]; - if (pCurObj->GetType() == PDFOBJ_ARRAY) { - ((CPDF_Array*)pCurObj)->AddName(CFX_ByteString(m_pWordBuf, m_WordSize)); - } else { - if (m_bDictName) { - FXSYS_memcpy32(m_pDictName, m_pWordBuf, m_WordSize); - m_pDictName[m_WordSize] = 0; - } else { - if (m_pDictName[0] != 0) { - ((CPDF_Dictionary*)pCurObj)->SetAtName((FX_LPCSTR)m_pDictName, CFX_ByteString(m_pWordBuf, m_WordSize)); - } - } - m_bDictName = !m_bDictName; - } -} -void CPDF_StreamContentParser::EndNumber() -{ - if (m_ObjectSize == 0) { - AddNumberParam((FX_LPCSTR)m_pWordBuf, m_WordSize); - return; - } - CPDF_Number *pObj = FX_NEW CPDF_Number(CFX_ByteStringC(m_pWordBuf, m_WordSize)); - if (!SetToCurObj(pObj)) { - pObj->Release(); - } -} -extern CFX_ByteString _FPDF_ByteStringFromHex(CFX_BinaryBuf& src_buf); -void CPDF_StreamContentParser::EndHexString() -{ - CPDF_String *pObj = FX_NEW CPDF_String(_FPDF_ByteStringFromHex(m_StringBuf), TRUE); - if (!SetToCurObj(pObj)) { - pObj->Release(); - } -} -void CPDF_StreamContentParser::EndString() -{ - CPDF_String *pObj = FX_NEW CPDF_String(m_StringBuf.GetByteString()); - if (!SetToCurObj(pObj)) { - pObj->Release(); - } -} -void CPDF_StreamContentParser::Handle_BeginImage(void) -{ - m_WordState = 9; - m_InlineImageState = 0; - m_StringBuf.Clear(); -} -void _PDF_ReplaceAbbr(CPDF_Object* pObj); -void CPDF_StreamContentParser::EndImageDict() -{ - if (m_StringBuf.GetSize() != m_LastImageDict.GetSize() || - FXSYS_memcmp32(m_StringBuf.GetBuffer(), m_LastImageDict.GetBuffer(), m_StringBuf.GetSize())) { - m_WordState = 0; - StartDict(); - InputData(m_StringBuf.GetBuffer(), m_StringBuf.GetSize()); - Finish(); - m_bSameLastDict = FALSE; - if (m_pLastImageDict && m_bReleaseLastDict) { - m_pLastImageDict->Release(); - m_pLastImageDict = NULL; - } - if (!m_ObjectSize) { - m_InlineImageState = 0; - return; - } - m_pLastImageDict = (CPDF_Dictionary*)m_pObjectStack[--m_ObjectSize]; - m_bReleaseLastDict = !m_pObjectState[m_ObjectSize]; - m_pObjectState[m_ObjectSize] = FALSE; - _PDF_ReplaceAbbr(m_pLastImageDict); - m_LastImageDict.TakeOver(m_StringBuf); - if (m_pLastImageDict->KeyExist(FX_BSTRC("ColorSpace"))) { - CPDF_Object* pCSObj = m_pLastImageDict->GetElementValue(FX_BSTRC("ColorSpace")); - if (pCSObj->GetType() == PDFOBJ_NAME) { - CFX_ByteString name = pCSObj->GetString(); - if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") && name != FX_BSTRC("DeviceCMYK")) { - pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name); - if (pCSObj) { - if (!pCSObj->GetObjNum()) { - pCSObj = pCSObj->Clone(); - } - m_pLastImageDict->SetAt(FX_BSTRC("ColorSpace"), pCSObj, m_pDocument); - } - } - } - } - } else { - m_bSameLastDict = TRUE; - } - m_ImageSrcBuf.Clear(); - if (m_pLastCloneImageDict) - m_pLastCloneImageDict->Release(); - - m_pLastCloneImageDict = (CPDF_Dictionary*)m_pLastImageDict->Clone(); - if (m_pLastCloneImageDict->KeyExist(FX_BSTRC("Filter"))) { - m_WordState = 10; - m_InlineImageState = 0; - } else { - int width = m_pLastCloneImageDict->GetInteger(FX_BSTRC("Width")); - int height = m_pLastCloneImageDict->GetInteger(FX_BSTRC("Height")); - int OrigSize = 0; - CPDF_Object* pCSObj = m_pLastCloneImageDict->GetElementValue(FX_BSTRC("ColorSpace")); - if (pCSObj != NULL) { - int bpc = m_pLastCloneImageDict->GetInteger(FX_BSTRC("BitsPerComponent")); - int nComponents = 1; - CPDF_ColorSpace* pCS = m_pDocument->LoadColorSpace(pCSObj); - if (pCS == NULL) { - nComponents = 3; - } else { - nComponents = pCS->CountComponents(); - m_pDocument->GetPageData()->ReleaseColorSpace(pCSObj); - } - int pitch = (width * bpc * nComponents + 7) / 8; - OrigSize = pitch * height; - } else { - OrigSize = ((width + 7) / 8) * height; - } - m_ImageSrcBuf.AppendBlock(NULL, OrigSize); - m_WordState = 11; - m_InlineImageState = 0; - } -} -void CPDF_StreamContentParser::EndInlineImage() -{ - CFX_AffineMatrix ImageMatrix; - ImageMatrix.Copy(m_pCurStates->m_CTM); - ImageMatrix.Concat(m_mtContentToUser); - m_LastImageData.CopyData(m_ImageSrcBuf.GetBuffer(), m_ImageSrcBuf.GetSize()); - CPDF_Stream* pStream = CPDF_Stream::Create(m_ImageSrcBuf.GetBuffer(), m_ImageSrcBuf.GetSize(), - m_pLastCloneImageDict); - m_ImageSrcBuf.DetachBuffer(); - m_pLastCloneImageDict = NULL; - CPDF_InlineImages* pImages = FX_NEW CPDF_InlineImages; - pImages->m_pStream = pStream; - SetGraphicStates(pImages, !m_pLastCloneImageDict->KeyExist(FX_BSTRC("ColorSpace")), FALSE, FALSE); - pImages->AddMatrix(ImageMatrix); - m_pObjectList->m_ObjectList.AddTail(pImages); - m_WordState = 0; -} -#define FXDWORD_TRUE FXDWORD_FROM_LSBFIRST(0x65757274) -#define FXDWORD_NULL FXDWORD_FROM_LSBFIRST(0x6c6c756e) -#define FXDWORD_FALS FXDWORD_FROM_LSBFIRST(0x736c6166) -void CPDF_StreamContentParser::EndKeyword() -{ - CPDF_Object *pObj = NULL; - if (m_WordSize == 4) { - if (*(FX_DWORD*)m_pWordBuf == FXDWORD_TRUE) { - pObj = CPDF_Boolean::Create(TRUE); - if (!SetToCurObj(pObj)) { - pObj->Release(); - } - return; - } else if (*(FX_DWORD*)m_pWordBuf == FXDWORD_NULL) { - pObj = CPDF_Null::Create(); - if (!SetToCurObj(pObj)) { - pObj->Release(); - } - return; - } - } else if (m_WordSize == 5) { - if (*(FX_DWORD*)m_pWordBuf == FXDWORD_FALS && m_pWordBuf[4] == 'e') { - pObj = CPDF_Boolean::Create(FALSE); - if (!SetToCurObj(pObj)) { - pObj->Release(); - } - return; - } - } - m_pWordBuf[m_WordSize] = 0; - OnOperator((char*)m_pWordBuf); - ClearAllParams(); -} -#define PAGEPARSE_STAGE_PARSE 2 -#define PAGEPARSE_STAGE_CHECKCLIP 3 -CPDF_ContentParser::CPDF_ContentParser() -{ - m_pParser = NULL; - m_Status = Ready; - m_pStreamFilter = NULL; - m_pType3Char = NULL; -} -CPDF_ContentParser::~CPDF_ContentParser() -{ - Clear(); -} -void CPDF_ContentParser::Clear() -{ - if (m_pParser) { - delete m_pParser; - } - if (m_pStreamFilter) { - delete m_pStreamFilter; - } - m_pParser = NULL; - m_Status = Ready; -} -void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) -{ - if (m_Status != Ready || pPage == NULL || pPage->m_pDocument == NULL || pPage->m_pFormDict == NULL) { - m_Status = Done; - return; - } - m_pObjects = pPage; - m_bForm = FALSE; - if (pOptions) { - m_Options = *pOptions; - } - CPDF_Object* pContent = pPage->m_pFormDict->GetElementValue(FX_BSTRC("Contents")); - if (pContent == NULL) { - m_Status = Done; - return; - } - if (pContent->GetType() == PDFOBJ_STREAM) { - m_nStreams = 1; - } else if (pContent->GetType() == PDFOBJ_ARRAY) { - m_nStreams = ((CPDF_Array*)pContent)->GetCount(); - } else { - m_Status = Done; - return; - } - m_Status = ToBeContinued; - m_InternalStage = PAGEPARSE_STAGE_PARSE; - m_CurrentOffset = 0; - m_pParser = FX_NEW CPDF_StreamContentParser; - m_pParser->Initialize(); - m_pParser->PrepareParse(pPage->m_pDocument, pPage->m_pResources, NULL, NULL, pPage, - pPage->m_pResources, &pPage->m_BBox, &m_Options, NULL, 0); - m_pParser->m_pCurStates->m_ColorState.GetModify()->Default(); -} -void CPDF_ContentParser::Start(CPDF_Form* pForm, CPDF_AllStates* pGraphicStates, CFX_AffineMatrix* pParentMatrix, - CPDF_Type3Char* pType3Char, CPDF_ParseOptions* pOptions, int level) -{ - m_pType3Char = pType3Char; - m_pObjects = pForm; - m_bForm = TRUE; - CFX_AffineMatrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matrix")); - if (pGraphicStates) { - form_matrix.Concat(pGraphicStates->m_CTM); - } - CPDF_Array* pBBox = pForm->m_pFormDict->GetArray(FX_BSTRC("BBox")); - CFX_FloatRect form_bbox; - CPDF_Path ClipPath; - if (pBBox) { - form_bbox = pBBox->GetRect(); - ClipPath.New(); - ClipPath.AppendRect(form_bbox.left, form_bbox.bottom, form_bbox.right, form_bbox.top); - ClipPath.Transform(&form_matrix); - if (pParentMatrix) { - ClipPath.Transform(pParentMatrix); - } - form_bbox.Transform(&form_matrix); - } - CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDict(FX_BSTRC("Resources")); - m_pParser = FX_NEW CPDF_StreamContentParser; - m_pParser->Initialize(); - m_pParser->PrepareParse(pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources, pParentMatrix, pForm, - pResources, &form_bbox, pOptions, pGraphicStates, level); - m_pParser->m_pCurStates->m_CTM = form_matrix; - if (ClipPath.NotNull()) { - m_pParser->m_pCurStates->m_ClipPath.AppendPath(ClipPath, FXFILL_WINDING, TRUE); - } - if (pForm->m_Transparency & PDFTRANS_GROUP) { - CPDF_GeneralStateData* pData = m_pParser->m_pCurStates->m_GeneralState.GetModify(); - pData->m_BlendType = FXDIB_BLEND_NORMAL; - pData->m_StrokeAlpha = 1.0f; - pData->m_FillAlpha = 1.0f; - pData->m_pSoftMask = NULL; - } - m_pStreamFilter = pForm->m_pFormStream->GetStreamFilter(); - m_nStreams = 1; - m_Status = ToBeContinued; - m_InternalStage = PAGEPARSE_STAGE_PARSE; - m_CurrentOffset = 0; -} -void CPDF_ContentParser::Continue(IFX_Pause* pPause) -{ - while (m_Status == ToBeContinued) { - if (m_InternalStage == PAGEPARSE_STAGE_PARSE) { - if (m_pStreamFilter == NULL) { - if (m_CurrentOffset == m_nStreams) { - m_InternalStage = PAGEPARSE_STAGE_CHECKCLIP; - if (m_pType3Char) { - m_pType3Char->m_bColored = m_pParser->m_bColored; - m_pType3Char->m_Width = FXSYS_round(m_pParser->m_Type3Data[0] * 1000); - m_pType3Char->m_BBox.left = FXSYS_round(m_pParser->m_Type3Data[2] * 1000); - m_pType3Char->m_BBox.bottom = FXSYS_round(m_pParser->m_Type3Data[3] * 1000); - m_pType3Char->m_BBox.right = FXSYS_round(m_pParser->m_Type3Data[4] * 1000); - m_pType3Char->m_BBox.top = FXSYS_round(m_pParser->m_Type3Data[5] * 1000); - m_pType3Char->m_bPageRequired = m_pParser->m_bResourceMissing; - } - delete m_pParser; - m_pParser = NULL; - continue; - } - CPDF_Object* pContent = m_pObjects->m_pFormDict->GetElementValue(FX_BSTRC("Contents")); - if (pContent->GetType() == PDFOBJ_STREAM) { - m_pStreamFilter = ((CPDF_Stream*)pContent)->GetStreamFilter(); - } else { - CPDF_Stream* pStream = ((CPDF_Array*)pContent)->GetStream(m_CurrentOffset); - if (pStream == NULL) { - m_CurrentOffset ++; - continue; - } - m_pStreamFilter = pStream->GetStreamFilter(); - } - } - FX_DWORD len = m_pStreamFilter->ReadBlock(m_pParser->m_pStreamBuf, STREAM_PARSE_BUFSIZE); - m_pParser->InputData(m_pParser->m_pStreamBuf, len); - if (m_pParser->m_bAbort) { - delete m_pStreamFilter; - m_pStreamFilter = NULL; - m_Status = Done; - delete m_pParser; - m_pParser = NULL; - return; - } - if (len < STREAM_PARSE_BUFSIZE) { - m_pParser->Finish(); - m_CurrentOffset ++; - delete m_pStreamFilter; - m_pStreamFilter = NULL; - } - if (pPause && pPause->NeedToPauseNow()) { - return; - } - } - if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { - FX_POSITION pos = m_pObjects->m_ObjectList.GetHeadPosition(); - while (pos) { - CPDF_PageObject* pObj = (CPDF_PageObject*)m_pObjects->m_ObjectList.GetNext(pos); - if (pObj == NULL) { - continue; - } - if (pObj->m_ClipPath.IsNull()) { - continue; - } - if (pObj->m_ClipPath.GetPathCount() != 1) { - continue; - } - if (pObj->m_ClipPath.GetTextCount()) { - continue; - } - CPDF_Path ClipPath = pObj->m_ClipPath.GetPath(0); - if (!ClipPath.IsRect() || pObj->m_Type == PDFPAGE_SHADING) { - continue; - } - CFX_FloatRect old_rect(ClipPath.GetPointX(0), ClipPath.GetPointY(0), - ClipPath.GetPointX(2), ClipPath.GetPointY(2)); - CFX_FloatRect obj_rect(pObj->m_Left, pObj->m_Bottom, pObj->m_Right, pObj->m_Top); - if (old_rect.Contains(obj_rect)) { - pObj->m_ClipPath.SetNull(); - } - } - if (m_pObjects->m_ObjectList.GetCount() == 1) { - CPDF_PageObject* pObj = (CPDF_PageObject*)m_pObjects->m_ObjectList.GetAt(m_pObjects->m_ObjectList.GetHeadPosition()); - if (pObj && pObj->m_Type == PDFPAGE_TEXT) { - CPDF_TextObject* pText = (CPDF_TextObject*)pObj; - } - } - m_Status = Done; - return; - } - } -} -int CPDF_ContentParser::EstimateProgress() -{ - if (m_Status == Ready) { - return 0; - } - if (m_Status == Done) { - return 100; - } - if (m_InternalStage == PAGEPARSE_STAGE_CHECKCLIP) { - return 90; - } - if (m_pStreamFilter == NULL) { - return 90 * m_CurrentOffset / m_nStreams; - } - int total_raw_size = m_pStreamFilter->GetStream()->GetRawSize() * m_nStreams; - int parsed_raw_size = m_pStreamFilter->GetStream()->GetRawSize() * m_CurrentOffset + - m_pStreamFilter->GetSrcPos(); - return 90 * parsed_raw_size / total_raw_size; -} -CPDF_InlineImages::CPDF_InlineImages() -{ - m_Type = PDFPAGE_INLINES; - m_pStream = NULL; - m_pBitmap = NULL; -} -CPDF_InlineImages::~CPDF_InlineImages() -{ - if (m_pStream) { - m_pStream->Release(); - } - if (m_pBitmap) { - delete m_pBitmap; - } -} -void CPDF_InlineImages::AddMatrix(CFX_AffineMatrix& matrix) -{ - m_Matrices.Add(matrix); - CFX_FloatRect rect = matrix.GetUnitRect(); - if (m_Matrices.GetSize() > 1) { - CFX_FloatRect rect1(m_Left, m_Bottom, m_Right, m_Top); - rect.Union(rect1); - } - m_Left = rect.left; - m_Right = rect.right; - m_Top = rect.top; - m_Bottom = rect.bottom; -} -#endif diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h index cc35dbe744..9048fb7874 100644 --- a/core/src/fpdfapi/fpdf_page/pageint.h +++ b/core/src/fpdfapi/fpdf_page/pageint.h @@ -11,7 +11,6 @@ #define PARSE_STEP_LIMIT 100 #define STREAM_PARSE_BUFSIZE 20480 class CPDF_QuickFontCache; -#ifndef _FPDFAPI_MINI_ class CPDF_StreamParser : public CFX_Object { public: @@ -59,7 +58,6 @@ protected: FX_DWORD m_WordSize; CPDF_Object* m_pLastObj; }; -#endif typedef enum { PDFOP_CloseFillStrokePath = 0, PDFOP_FillStrokePath, PDFOP_CloseEOFillStrokePath, PDFOP_EOFillStrokePath, @@ -117,11 +115,7 @@ typedef struct { } m_Name; }; } _ContentParam; -#if defined(_FPDFAPI_MINI_) -#define _FPDF_MAX_FORM_LEVEL_ 17 -#else #define _FPDF_MAX_FORM_LEVEL_ 30 -#endif #define _FPDF_MAX_TYPE3_FORM_LEVEL_ 4 #define _FPDF_MAX_OBJECT_STACK_SIZE_ 512 class CPDF_StreamContentParser : public CFX_Object @@ -163,43 +157,11 @@ public: FX_BOOL OnOperator(FX_LPCSTR op); void BigCaseCaller(int index); FX_BOOL m_bAbort; -#ifndef _FPDFAPI_MINI_ CPDF_StreamParser* m_pSyntax; FX_DWORD GetParsePos() { return m_pSyntax->GetPos(); } -#else - int m_WordState; - void InputData(FX_LPCBYTE src_buf, FX_DWORD src_size); - void Finish(); - void StartArray(); - void EndArray(); - void StartDict(); - void EndDict(); - void EndName(); - void EndNumber(); - void EndKeyword(); - void EndHexString(); - void EndString(); - void EndImageDict(); - void EndInlineImage(); - FX_LPBYTE m_pWordBuf; - FX_DWORD m_WordSize; - CFX_BinaryBuf m_StringBuf; - int m_StringLevel, m_StringState, m_EscCode; - void AddContainer(CPDF_Object* pObject); - FX_BOOL SetToCurObj(CPDF_Object* pObject); - FX_LPBYTE m_pDictName; - FX_BOOL m_bDictName; - CPDF_Object** m_pObjectStack; - FX_BOOL* m_pObjectState; - FX_DWORD m_ObjectSize; - int m_InlineImageState; - FX_BYTE m_InlineWhiteChar; - CFX_BinaryBuf m_ImageSrcBuf; - FX_LPBYTE m_pStreamBuf; -#endif CPDF_AllStates* m_pCurStates; CPDF_ContentMark m_CurContentMark; CFX_PtrArray m_ClipTextList; @@ -210,10 +172,8 @@ public: void ConvertUserSpace(FX_FLOAT& x, FX_FLOAT& y); void ConvertTextSpace(FX_FLOAT& x, FX_FLOAT& y); void OnChangeTextMatrix(); -#ifndef _FPDFAPI_MINI_ FX_DWORD Parse(FX_LPCBYTE pData, FX_DWORD dwSize, FX_DWORD max_cost); void ParsePathObject(); -#endif int m_CompatCount; FX_PATHPOINT* m_pPathPoints; int m_PathPointCount; diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index e0cb8277d7..a57771742a 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -1681,11 +1681,7 @@ CPDF_SyntaxParser::CPDF_SyntaxParser() m_pFileBuf = NULL; m_MetadataObjnum = 0; m_dwWordPos = 0; -#if defined(_FPDFAPI_MINI_) - m_bFileStream = TRUE; -#else m_bFileStream = FALSE; -#endif } CPDF_SyntaxParser::~CPDF_SyntaxParser() { @@ -2473,10 +2469,6 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT m_Pos = StreamStartPos; } CPDF_Stream* pStream; -#if defined(_FPDFAPI_MINI_) && !defined(_FXCORE_FEATURE_ALL_) - pStream = FX_NEW CPDF_Stream(m_pFileAccess, pCryptoHandler, m_HeaderOffset + m_Pos, len, pDict, gennum); - m_Pos += len; -#else FX_LPBYTE pData = FX_Alloc(FX_BYTE, len); if (!pData) { return NULL; @@ -2494,7 +2486,6 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict, PARSE_CONTEXT dest_buf.DetachBuffer(); } pStream = FX_NEW CPDF_Stream(pData, len, pDict); -#endif if (pContext) { pContext->m_DataEnd = pContext->m_DataStart + len; } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp index 611804bc06..ab1ddb6e85 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp @@ -35,7 +35,6 @@ void CPDF_DocRenderData::Clear(FX_BOOL bRelease) } } } -#ifndef _FPDFAPI_MINI_ { pos = m_TransferFuncMap.GetStartPosition(); while (pos) { @@ -49,7 +48,6 @@ void CPDF_DocRenderData::Clear(FX_BOOL bRelease) } } } -#endif if (m_pFontCache) { if (bRelease) { delete m_pFontCache; @@ -149,9 +147,6 @@ CPDF_RenderOptions::CPDF_RenderOptions() , m_dwLimitCacheSize(1024 * 1024 * 100) , m_HalftoneLimit(-1) { -#if defined(_FPDFAPI_MINI_) - m_Flags |= RENDER_LIMITEDIMAGECACHE; -#endif } FX_ARGB CPDF_RenderOptions::TranslateColor(FX_ARGB argb) const { @@ -261,12 +256,6 @@ FX_BOOL CPDF_RenderStatus::Initialize(int level, CPDF_RenderContext* pContext, C } else { m_InitialStates.DefaultStates(); } -#if defined(_FPDFAPI_MINI_)||defined(_FXCORE_LIMITED_CPU_) - m_HalftoneLimit = CPDF_ModuleMgr::Get()->GetRenderModule()->GetConfig()->m_HalftoneLimit; - if (pOptions && pOptions->m_HalftoneLimit >= 0) { - m_HalftoneLimit = pOptions->m_HalftoneLimit; - } -#endif m_pObjectRenderer = NULL; m_Transparency = transparency; return TRUE; @@ -327,11 +316,6 @@ FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, con if (!m_pObjectRenderer->m_Result) { DrawObjWithBackground(pObj, pObj2Device); } -#ifdef _FPDFAPI_MINI_ - if (m_DitherBits) { - DitherObjectArea(pObj, pObj2Device); - } -#endif delete m_pObjectRenderer; m_pObjectRenderer = NULL; return FALSE; @@ -351,11 +335,6 @@ FX_BOOL CPDF_RenderStatus::ContinueSingleObject(const CPDF_PageObject* pObj, con if (!m_pObjectRenderer->m_Result) { DrawObjWithBackground(pObj, pObj2Device); } -#ifdef _FPDFAPI_MINI_ - if (m_DitherBits) { - DitherObjectArea(pObj, pObj2Device); - } -#endif delete m_pObjectRenderer; m_pObjectRenderer = NULL; return FALSE; @@ -431,11 +410,6 @@ void CPDF_RenderStatus::ProcessObjectNoClip(const CPDF_PageObject* pObj, const C case PDFPAGE_FORM: bRet = ProcessForm((CPDF_FormObject*)pObj, pObj2Device); break; -#if defined(_FPDFAPI_MINI_) - case PDFPAGE_INLINES: - bRet = ProcessInlines((CPDF_InlineImages*)pObj, pObj2Device); - break; -#endif } if (!bRet) { DrawObjWithBackground(pObj, pObj2Device); @@ -465,7 +439,6 @@ void CPDF_RenderStatus::GetScaledMatrix(CFX_Matrix &matrix) const } void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device) { -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) FX_RECT rect; if (GetObjectClippedRect(pObj, pObj2Device, FALSE, rect)) { return; @@ -492,7 +465,6 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj, const status.Initialize(m_Level + 1, m_pContext, buffer.GetDevice(), buffer.GetMatrix(), NULL, NULL, NULL, &m_Options, m_Transparency, m_bDropObjects, pFormResource); status.RenderSingleObject(pObj, &matrix); buffer.OutputToDevice(); -#endif } FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj, const CFX_AffineMatrix* pObj2Device) { @@ -559,12 +531,10 @@ FX_BOOL CPDF_RenderStatus::ProcessPath(CPDF_PathObject* pPathObj, const CFX_Affi if (bStroke) { FillType |= FX_FILL_STROKE; } -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) const CPDF_GeneralStateData* pGeneralData = ((CPDF_PageObject*)pPathObj)->m_GeneralState; if (pGeneralData && pGeneralData->m_StrokeAdjust) { FillType |= FX_STROKE_ADJUST; } -#endif if (m_pType3Char) { FillType |= FX_FILL_TEXT_MODE; } @@ -599,7 +569,6 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bTyp int alpha; if (pGeneralData) { alpha = (FX_INT32)(pGeneralData->m_FillAlpha * 255); -#ifndef _FPDFAPI_MINI_ if (pGeneralData->m_pTR) { if (!pGeneralData->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTransferFunc(pGeneralData->m_pTR); @@ -608,7 +577,6 @@ FX_ARGB CPDF_RenderStatus::GetFillArgb(const CPDF_PageObject* pObj, FX_BOOL bTyp rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); } } -#endif } else { alpha = 255; } @@ -630,7 +598,6 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const int alpha; if (pGeneralData) { alpha = (FX_INT32)(pGeneralData->m_StrokeAlpha * 255); -#ifndef _FPDFAPI_MINI_ if (pGeneralData->m_pTR) { if (!pGeneralData->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralData)->m_pTransferFunc = GetTransferFunc(pGeneralData->m_pTR); @@ -639,7 +606,6 @@ FX_ARGB CPDF_RenderStatus::GetStrokeArgb(const CPDF_PageObject* pObj) const rgb = pGeneralData->m_pTransferFunc->TranslateColor(rgb); } } -#endif } else { alpha = 255; } @@ -1038,11 +1004,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, const CPDF_PageObject status.Initialize(0, this, pDevice, pLastMatrix, pStopObj, NULL, NULL, pOptions, pItem->m_pObjectList->m_Transparency, FALSE, NULL); status.RenderObjectList(pItem->m_pObjectList, &FinalMatrix); -#if !defined(_FPDFAPI_MINI_) if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); } -#endif if (status.m_bStopped) { pDevice->RestoreState(); break; @@ -1052,11 +1016,9 @@ void CPDF_RenderContext::Render(CFX_RenderDevice* pDevice, const CPDF_PageObject status.Initialize(0, this, pDevice, NULL, pStopObj, NULL, NULL, pOptions, pItem->m_pObjectList->m_Transparency, FALSE, NULL); status.RenderObjectList(pItem->m_pObjectList, &pItem->m_Matrix); -#if !defined(_FPDFAPI_MINI_) if (status.m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pPageCache->CacheOptimization(status.m_Options.m_dwLimitCacheSize); } -#endif if (status.m_bStopped) { pDevice->RestoreState(); break; @@ -1113,11 +1075,7 @@ void CPDF_ProgressiveRenderer::Start(CPDF_RenderContext* pContext, CFX_RenderDev m_PrevLastPos = NULL; Continue(pPause); } -#ifdef _FPDFAPI_MINI_ -#define RENDER_STEP_LIMIT 20 -#else #define RENDER_STEP_LIMIT 100 -#endif void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) { if (m_Status != ToBeContinued) { @@ -1175,11 +1133,9 @@ void CPDF_ProgressiveRenderer::Continue(IFX_Pause* pPause) if (m_pRenderer->ContinueSingleObject(pCurObj, &pItem->m_Matrix, pPause)) { return; } -#if !defined(_FPDFAPI_MINI_) if (pCurObj->m_Type == PDFPAGE_IMAGE && m_pRenderer->m_Options.m_Flags & RENDER_LIMITEDIMAGECACHE) { m_pContext->GetPageCache()->CacheOptimization(m_pRenderer->m_Options.m_dwLimitCacheSize); } -#endif if (pCurObj->m_Type == PDFPAGE_FORM || pCurObj->m_Type == PDFPAGE_SHADING) { objs_to_go = 0; } else { @@ -1320,11 +1276,7 @@ void CPDF_DocRenderData::ReleaseTransferFunc(CPDF_Object* pObj) CPDF_RenderConfig::CPDF_RenderConfig() { m_HalftoneLimit = 0; -#ifdef _FPDFAPI_MINI_ - m_RenderStepLimit = 20; -#else m_RenderStepLimit = 100; -#endif } CPDF_RenderConfig::~CPDF_RenderConfig() { @@ -1363,9 +1315,6 @@ FX_BOOL CPDF_DeviceBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDe m_Matrix.Scale(1.0f, (FX_FLOAT)(max_dpi) / (FX_FLOAT)dpiv); } } -#ifdef _FPDFAPI_MINI_ - m_Matrix.Scale(0.5f, 0.5f); -#endif #endif CFX_Matrix ctm = m_pDevice->GetCTM(); FX_FLOAT fScaleX = FXSYS_fabs(ctm.a); @@ -1387,13 +1336,11 @@ void CPDF_DeviceBuffer::OutputToDevice() m_pDevice->StretchDIBits(m_pBitmap, m_Rect.left, m_Rect.top, m_Rect.Width(), m_Rect.Height()); } } else { -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) CFX_DIBitmap buffer; m_pDevice->CreateCompatibleBitmap(&buffer, m_pBitmap->GetWidth(), m_pBitmap->GetHeight()); m_pContext->GetBackground(&buffer, m_pObject, NULL, &m_Matrix); buffer.CompositeBitmap(0, 0, buffer.GetWidth(), buffer.GetHeight(), m_pBitmap, 0, 0); m_pDevice->StretchDIBits(&buffer, m_Rect.left, m_Rect.top, m_Rect.Width(), m_Rect.Height()); -#endif } } CPDF_ScaledRenderBuffer::CPDF_ScaledRenderBuffer() @@ -1406,11 +1353,7 @@ CPDF_ScaledRenderBuffer::~CPDF_ScaledRenderBuffer() delete m_pBitmapDevice; } } -#ifndef _FPDFAPI_MINI_ #define _FPDFAPI_IMAGESIZE_LIMIT_ (30 * 1024 * 1024) -#else -#define _FPDFAPI_IMAGESIZE_LIMIT_ (10 * 1024 * 1024) -#endif FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_RenderDevice* pDevice, FX_RECT* pRect, const CPDF_PageObject* pObj, const CPDF_RenderOptions *pOptions, int max_dpi) { @@ -1460,9 +1403,7 @@ FX_BOOL CPDF_ScaledRenderBuffer::Initialize(CPDF_RenderContext* pContext, CFX_Re } m_Matrix.Scale(0.5f, 0.5f); } -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) m_pContext->GetBackground(m_pBitmapDevice->GetBitmap(), m_pObject, pOptions, &m_Matrix); -#endif return TRUE; } void CPDF_ScaledRenderBuffer::OutputToDevice() diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp index 45b6970e2a..de2a409e1c 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_cache.cpp @@ -248,7 +248,6 @@ FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource* return FALSE; } m_MatteColor = MatteColor; -#if !defined(_FPDFAPI_MINI_) if (pSrc->GetPitch() * pSrc->GetHeight() < FPDF_HUGE_IMAGE_SIZE) { m_pCachedBitmap = pSrc->Clone(); delete pSrc; @@ -259,23 +258,7 @@ FX_BOOL CPDF_ImageCache::GetCachedBitmap(CFX_DIBSource*& pBitmap, CFX_DIBSource* m_pCachedMask = pMaskSrc->Clone(); delete pMaskSrc; } -#else - if (pSrc->GetFormat() == FXDIB_8bppRgb && pSrc->GetPalette() && - pSrc->GetHeight() * pSrc->GetWidth() * 3 < 1024) { -#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ - m_pCachedBitmap = pSrc->CloneConvert(FXDIB_Rgb32); -#else - m_pCachedBitmap = pSrc->CloneConvert(FXDIB_Rgb); -#endif - delete pSrc; - } else if (pSrc->GetPitch() * pSrc->GetHeight() < 102400) { - m_pCachedBitmap = pSrc->Clone(); - delete pSrc; - } else { - m_pCachedBitmap = pSrc; - } - m_pCachedMask = pMaskSrc; -#endif + pBitmap = m_pCachedBitmap; pMask = m_pCachedMask; CalcSize(); @@ -326,7 +309,6 @@ int CPDF_ImageCache::ContinueGetCachedBitmap() CPDF_RenderContext*pContext = m_pRenderStatus->GetContext(); CPDF_PageRenderCache* pPageRenderCache = pContext->m_pPageCache; m_dwTimeCount = pPageRenderCache->GetTimeCount(); -#if !defined(_FPDFAPI_MINI_) if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() < FPDF_HUGE_IMAGE_SIZE) { m_pCachedBitmap = m_pCurBitmap->Clone(); delete m_pCurBitmap; @@ -339,22 +321,6 @@ int CPDF_ImageCache::ContinueGetCachedBitmap() delete m_pCurMask; m_pCurMask = NULL; } -#else - if (m_pCurBitmap->GetFormat() == FXDIB_8bppRgb && m_pCurBitmap->GetPalette() && - m_pCurBitmap->GetHeight() * m_pCurBitmap->GetWidth() * 3 < 1024) { - m_pCachedBitmap = m_pCurBitmap->CloneConvert(FXDIB_Rgb32); - m_pCachedBitmap = m_pCurBitmap->CloneConvert(FXDIB_Rgb); - delete m_pCurBitmap; - m_pCurBitmap = NULL; - } else if (m_pCurBitmap->GetPitch() * m_pCurBitmap->GetHeight() < 102400) { - m_pCachedBitmap = m_pCurBitmap->Clone(); - delete m_pCurBitmap; - m_pCurBitmap = NULL; - } else { - m_pCachedBitmap = m_pCurBitmap; - } - m_pCachedMask = m_pCurMask; -#endif m_pCurBitmap = m_pCachedBitmap; m_pCurMask = m_pCachedMask; CalcSize(); diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp index 1452b9d9f9..ffe559ad54 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp @@ -17,53 +17,8 @@ FX_BOOL CPDF_RenderStatus::ProcessImage(CPDF_ImageObject* pImageObj, const CFX_A if (render.Start(this, pImageObj, pObj2Device, m_bStdCS, m_curBlend)) { render.Continue(NULL); } -#ifdef _FPDFAPI_MINI_ - if (m_DitherBits) { - DitherObjectArea(pImageObj, pObj2Device); - } -#endif return render.m_Result; } -#if defined(_FPDFAPI_MINI_) -FX_BOOL CPDF_RenderStatus::ProcessInlines(CPDF_InlineImages* pInlines, const CFX_AffineMatrix* pObj2Device) -{ - int bitmap_alpha = 255; - if (!pInlines->m_GeneralState.IsNull()) { - bitmap_alpha = FXSYS_round(pInlines->m_GeneralState.GetObject()->m_FillAlpha * 255); - } - if (pInlines->m_pStream) { - CPDF_DIBSource dibsrc; - if (!dibsrc.Load(m_pContext->m_pDocument, pInlines->m_pStream, NULL, NULL, NULL, NULL)) { - return TRUE; - } - pInlines->m_pBitmap = dibsrc.Clone(); - pInlines->m_pStream->Release(); - pInlines->m_pStream = NULL; - } - if (pInlines->m_pBitmap == NULL) { - return TRUE; - } - FX_ARGB fill_argb = 0; - if (pInlines->m_pBitmap->IsAlphaMask()) { - fill_argb = GetFillArgb(pInlines); - } - int flags = 0; - if (m_Options.m_Flags & RENDER_FORCE_DOWNSAMPLE) { - flags |= RENDER_FORCE_DOWNSAMPLE; - } else if (m_Options.m_Flags & RENDER_FORCE_HALFTONE) { - flags = 0; - } - for (int i = 0; i < pInlines->m_Matrices.GetSize(); i ++) { - CFX_AffineMatrix image_matrix = pInlines->m_Matrices.GetAt(i); - image_matrix.Concat(*pObj2Device); - CPDF_ImageRenderer renderer; - if (renderer.Start(this, pInlines->m_pBitmap, fill_argb, bitmap_alpha, &image_matrix, flags, FALSE, m_curBlend)) { - renderer.Continue(NULL); - } - } - return TRUE; -} -#endif void CPDF_RenderStatus::CompositeDIBitmap(CFX_DIBitmap* pDIBitmap, int left, int top, FX_ARGB mask_argb, int bitmap_alpha, int blend_mode, int Transparency) { @@ -392,7 +347,6 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() if (m_pRenderStatus->m_Options.m_ColorMode == RENDER_COLOR_ALPHA && m_Loader.m_pMask == NULL) { return StartBitmapAlpha(); } -#ifndef _FPDFAPI_MINI_ if (pGeneralState && pGeneralState->m_pTR) { if (!pGeneralState->m_pTransferFunc) { ((CPDF_GeneralStateData*)pGeneralState)->m_pTransferFunc = m_pRenderStatus->GetTransferFunc(pGeneralState->m_pTR); @@ -405,7 +359,6 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() m_Loader.m_bCached = FALSE; } } -#endif m_FillArgb = 0; m_bPatternColor = FALSE; m_pPattern = NULL; @@ -424,32 +377,11 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() m_pDIBSource = m_pClone; } m_Flags = 0; -#if !defined(_FPDFAPI_MINI_) if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_DOWNSAMPLE) { m_Flags |= RENDER_FORCE_DOWNSAMPLE; } else if (m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_HALFTONE) { m_Flags |= RENDER_FORCE_HALFTONE; } -#else - if (!(m_pRenderStatus->m_Options.m_Flags & RENDER_FORCE_HALFTONE)) { - if (m_pRenderStatus->m_HalftoneLimit) { - CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); - FX_RECT image_rect = image_rect_f.GetOutterRect(); - FX_RECT image_clip = image_rect; - image_rect.Intersect(m_pRenderStatus->m_pDevice->GetClipBox()); - if (image_rect.Width() && image_rect.Height()) { - if ((image_clip.Width() * m_pDIBSource->GetWidth() / image_rect.Width()) * - (image_clip.Height() * m_pDIBSource->GetHeight() / image_rect.Height()) > - m_pRenderStatus->m_HalftoneLimit) { - m_Flags |= RENDER_FORCE_DOWNSAMPLE; - } - } - } else { - m_Flags |= RENDER_FORCE_DOWNSAMPLE; - } - } -#endif -#ifndef _FPDFAPI_MINI_ if (m_pRenderStatus->m_pDevice->GetDeviceClass() != FXDC_DISPLAY) { CPDF_Object* pFilters = m_pImageObject->m_pImage->GetStream()->GetDict()->GetElementValue(FX_BSTRC("Filter")); if (pFilters) { @@ -475,14 +407,12 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() } else if (m_pImageObject->m_pImage->IsInterpol()) { m_Flags |= FXDIB_INTERPOL; } -#endif if (m_Loader.m_pMask) { return DrawMaskedImage(); } if (m_bPatternColor) { return DrawPatternImage(m_pObj2Device); } -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) if (m_BitmapAlpha == 255 && pGeneralState && pGeneralState->m_FillOP && pGeneralState->m_OPMode == 0 && pGeneralState->m_BlendType == FXDIB_BLEND_NORMAL && pGeneralState->m_StrokeAlpha == 1 && pGeneralState->m_FillAlpha == 1) { CPDF_Document* pDocument = NULL; @@ -504,7 +434,6 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() pDocument->GetPageData()->ReleaseColorSpace(pCSObj); } } -#endif return StartDIBSource(); } FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CPDF_PageObject* pObj, const CFX_AffineMatrix* pObj2Device, FX_BOOL bStdCS, int blendType) @@ -514,12 +443,10 @@ FX_BOOL CPDF_ImageRenderer::Start(CPDF_RenderStatus* pStatus, const CPDF_PageObj m_pImageObject = (CPDF_ImageObject*)pObj; m_BlendType = blendType; m_pObj2Device = pObj2Device; -#ifndef _FPDFAPI_MINI_ CPDF_Dictionary* pOC = m_pImageObject->m_pImage->GetOC(); if (pOC && m_pRenderStatus->m_Options.m_pOCContext && !m_pRenderStatus->m_Options.m_pOCContext->CheckOCGVisible(pOC)) { return FALSE; } -#endif m_ImageMatrix = m_pImageObject->m_Matrix; m_ImageMatrix.Concat(*pObj2Device); if (StartLoadDIBSource()) { @@ -721,14 +648,12 @@ FX_BOOL CPDF_ImageRenderer::DrawMaskedImage() } FX_BOOL CPDF_ImageRenderer::StartDIBSource() { -#if !defined(_FPDFAPI_MINI_) if (!(m_Flags & RENDER_FORCE_DOWNSAMPLE) && m_pDIBSource->GetBPP() > 1) { int image_size = m_pDIBSource->GetBPP() / 8 * m_pDIBSource->GetWidth() * m_pDIBSource->GetHeight(); if (image_size > FPDF_HUGE_IMAGE_SIZE && !(m_Flags & RENDER_FORCE_HALFTONE)) { m_Flags |= RENDER_FORCE_DOWNSAMPLE; } } -#endif if (m_pRenderStatus->m_pDevice->StartDIBits(m_pDIBSource, m_BitmapAlpha, m_FillArgb, &m_ImageMatrix, m_Flags, m_DeviceHandle, 0, NULL, m_BlendType)) { if (m_DeviceHandle != NULL) { @@ -737,7 +662,6 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() } return FALSE; } -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) CFX_FloatRect image_rect_f = m_ImageMatrix.GetUnitRect(); FX_RECT image_rect = image_rect_f.GetOutterRect(); int dest_width = image_rect.Width(); @@ -794,12 +718,10 @@ FX_BOOL CPDF_ImageRenderer::StartDIBSource() delete pStretched; pStretched = NULL; } -#endif return FALSE; } FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() { -#ifndef _FPDFAPI_MINI_ if (m_pDIBSource->IsOpaqueImage()) { CFX_PathData path; path.AppendRect(0, 0, 1, 1); @@ -830,13 +752,11 @@ FX_BOOL CPDF_ImageRenderer::StartBitmapAlpha() delete pAlphaMask; } } -#endif return FALSE; } FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) { if (m_Status == 1) { -#ifndef _FPDFAPI_MINI_ if (m_pQuickStretcher->Continue(pPause)) { return TRUE; } @@ -847,9 +767,7 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) m_pRenderStatus->m_pDevice->SetDIBits(m_pQuickStretcher->m_pBitmap, m_pQuickStretcher->m_ResultLeft, m_pQuickStretcher->m_ResultTop, m_BlendType); return FALSE; -#endif } else if (m_Status == 2) { -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) if (m_pTransformer->Continue(pPause)) { return TRUE; } @@ -872,7 +790,6 @@ FX_BOOL CPDF_ImageRenderer::Continue(IFX_Pause* pPause) } delete pBitmap; return FALSE; -#endif } else if (m_Status == 3) { return m_pRenderStatus->m_pDevice->ContinueDIBits(m_DeviceHandle, pPause); } else if (m_Status == 4) { diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp index 9d9d9ecfd1..6b895b525b 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp @@ -881,11 +881,6 @@ FX_BOOL CPDF_RenderStatus::ProcessShading(CPDF_ShadingObject* pShadingObj, const matrix.Concat(*pObj2Device); DrawShading(pShadingObj->m_pShading, &matrix, rect, pShadingObj->m_GeneralState.GetAlpha(FALSE), m_Options.m_ColorMode == RENDER_COLOR_ALPHA); -#ifdef _FPDFAPI_MINI_ - if (m_DitherBits) { - DitherObjectArea(pShadingObj, pObj2Device); - } -#endif return TRUE; } static CFX_DIBitmap* DrawPatternBitmap(CPDF_Document* pDoc, CPDF_PageRenderCache* pCache, @@ -1117,9 +1112,4 @@ void CPDF_RenderStatus::ProcessPathPattern(CPDF_PathObject* pPathObj, const CFX_ bPattern = TRUE; } } -#ifdef _FPDFAPI_MINI_ - if (bPattern && m_DitherBits) { - DitherObjectArea(pPathObj, pObj2Device); - } -#endif } diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp index fcb422b6c4..449b003c56 100644 --- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -256,16 +256,6 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, const CFX DrawTextPathWithPattern(textobj, pObj2Device, pFont, font_size, &text_matrix, bFill, bStroke); return TRUE; } -#if defined(_FPDFAPI_MINI_) - if (bFill) { - bStroke = FALSE; - } - if (bStroke) { - if (font_size * text_matrix.GetXUnit() * pObj2Device->GetXUnit() < 6) { - bStroke = FALSE; - } - } -#endif if (bClip || bStroke) { const CFX_AffineMatrix* pDeviceMatrix = pObj2Device; CFX_AffineMatrix device_matrix; @@ -284,12 +274,10 @@ FX_BOOL CPDF_RenderStatus::ProcessText(const CPDF_TextObject* textobj, const CFX flag |= FX_FILL_STROKE; flag |= FX_STROKE_TEXT_MODE; } -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) const CPDF_GeneralStateData* pGeneralData = ((CPDF_PageObject*)textobj)->m_GeneralState; if (pGeneralData && pGeneralData->m_StrokeAdjust) { flag |= FX_STROKE_ADJUST; } -#endif if (m_Options.m_Flags & RENDER_NOTEXTSMOOTH) { flag |= FXFILL_NOPATHSMOOTH; } diff --git a/core/src/fpdfapi/fpdf_render/render_int.h b/core/src/fpdfapi/fpdf_render/render_int.h index f9a04a99a4..81feb5eb88 100644 --- a/core/src/fpdfapi/fpdf_render/render_int.h +++ b/core/src/fpdfapi/fpdf_render/render_int.h @@ -435,11 +435,7 @@ protected: CFX_DIBitmap* m_pCachedBitmap; ICodec_ScanlineDecoder* m_pDecoder; }; -#ifdef _FPDFAPI_MINI_ -#define FPDF_HUGE_IMAGE_SIZE 3000000 -#else #define FPDF_HUGE_IMAGE_SIZE 60000000 -#endif class CPDF_DIBTransferFunc : public CFX_FilteredDIB { public: diff --git a/core/src/fpdftext/fpdf_text.cpp b/core/src/fpdftext/fpdf_text.cpp index f633e19517..a4a124d5e6 100644 --- a/core/src/fpdftext/fpdf_text.cpp +++ b/core/src/fpdftext/fpdf_text.cpp @@ -9,7 +9,6 @@ #include "../../include/fpdftext/fpdf_text.h" #include "txtproc.h" #include "text_int.h" -#if !defined(_FPDFAPI_MINI_) || defined(_FXCORE_FEATURE_ALL_) extern FX_LPCSTR FCS_GetAltStr(FX_WCHAR); CFX_ByteString CharFromUnicodeAlt(FX_WCHAR unicode, int destcp, FX_LPCSTR defchar) { @@ -776,7 +775,6 @@ void PDF_GetPageText(CFX_ByteStringArray& lines, CPDF_Document* pDoc, CPDF_Dicti lines.Add(str); } } -#endif extern void _PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_PageObjects* pPage, FX_BOOL bUseLF, CFX_PtrArray* pObjArray); void PDF_GetTextStream_Unicode(CFX_WideTextBuf& buffer, CPDF_Document* pDoc, CPDF_Dictionary* pPage, FX_DWORD flags) diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp index 5b174f0187..d01d95d202 100644 --- a/core/src/fpdftext/fpdf_text_int.cpp +++ b/core/src/fpdftext/fpdf_text_int.cpp @@ -160,11 +160,7 @@ FX_BOOL CPDF_TextPage::ParseTextPage() if(charinfo.m_Flag == FPDFTEXT_CHAR_GENERATED) { bNormal = TRUE; } -#ifdef FOXIT_CHROME_BUILD else if(charinfo.m_Unicode == 0 || IsControlChar(&charinfo)) -#else - else if(charinfo.m_Unicode == 0) -#endif bNormal = FALSE; else { bNormal = TRUE; @@ -1118,11 +1114,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i) { PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); FX_WCHAR wChar = str.GetAt(i); -#ifdef FOXIT_CHROME_BUILD if(!IsControlChar(&Info)) { -#else - if(wChar != 0xfffe) { -#endif Info.m_Index = m_TextBuf.GetLength(); if (wChar >= 0xFB00 && wChar <= 0xFB06) { FX_LPWSTR pDst = NULL; @@ -1157,11 +1149,7 @@ void CPDF_TextPage::AddCharInfoByLRDirection(CFX_WideString& str, int i) void CPDF_TextPage::AddCharInfoByRLDirection(CFX_WideString& str, int i) { PAGECHAR_INFO Info = *(PAGECHAR_INFO*)m_TempCharList.GetAt(i); -#ifdef FOXIT_CHROME_BUILD if(!IsControlChar(&Info)) { -#else - if(str.GetAt(i) != 0xfffe) { -#endif Info.m_Index = m_TextBuf.GetLength(); FX_WCHAR wChar = FX_GetMirrorChar(str.GetAt(i), TRUE, FALSE); FX_LPWSTR pDst = NULL; @@ -1638,14 +1626,9 @@ void CPDF_TextPage::ProcessTextObject(PDFTEXT_Obj Obj) } PAGECHAR_INFO* cha = (PAGECHAR_INFO*)m_TempCharList.GetAt(m_TempCharList.GetSize() - 1); m_TempTextBuf.Delete(m_TempTextBuf.GetLength() - 1, 1); -#ifdef FOXIT_CHROME_BUILD cha->m_Unicode = 0x2; cha->m_Flag = FPDFTEXT_CHAR_HYPHEN; m_TempTextBuf.AppendChar(0xfffe); -#else - cha->m_Unicode = 0; - m_TempTextBuf.AppendChar(0xfffe); -#endif } } else { m_CurlineRect = CFX_FloatRect(Obj.m_pTextObj->m_Left, Obj.m_pTextObj->m_Bottom, Obj.m_pTextObj->m_Right, Obj.m_pTextObj->m_Top); diff --git a/core/src/fxcodec/libjpeg/fpdfapi_jerror.c b/core/src/fxcodec/libjpeg/fpdfapi_jerror.c index 42e4066757..943ced798f 100644 --- a/core/src/fxcodec/libjpeg/fpdfapi_jerror.c +++ b/core/src/fxcodec/libjpeg/fpdfapi_jerror.c @@ -11,11 +11,6 @@ * stderr is the right thing to do. Many applications will want to replace * some or all of these routines. * - * If you define USE_WINDOWS_MESSAGEBOX in jconfig.h or in the makefile, - * you get a Windows-specific hack to display error messages in a dialog box. - * It ain't much, but it beats dropping error messages into the bit bucket, - * which is what happens to output to stderr under most Windows C compilers. - * * These routines are used by both the compression and decompression code. */ @@ -99,16 +94,8 @@ output_message (j_common_ptr cinfo) /* Create the message */ (*cinfo->err->format_message) (cinfo, buffer); -#ifdef USE_WINDOWS_MESSAGEBOX - /* Display it in a message dialog box */ - MessageBox(GetActiveWindow(), buffer, "JPEG Library Error", - MB_OK | MB_ICONERROR); -#else /* Send it to stderr, adding a newline */ -#ifndef _FPDFAPI_MINI_ FXSYS_fprintf(stderr, "%s\n", buffer); -#endif -#endif } diff --git a/core/src/fxcodec/libjpeg/jmemsys.h b/core/src/fxcodec/libjpeg/jmemsys.h index ef1481514b..896688181b 100644 --- a/core/src/fxcodec/libjpeg/jmemsys.h +++ b/core/src/fxcodec/libjpeg/jmemsys.h @@ -12,10 +12,7 @@ * * This file works as-is for the system-dependent memory managers supplied * in the IJG distribution. You may need to modify it if you write a - * custom memory manager. If system-dependent changes are needed in - * this file, the best method is to #ifdef them based on a configuration - * symbol supplied in jconfig.h, as we have done with USE_MSDOS_MEMMGR - * and USE_MAC_MEMMGR. + * custom memory manager. */ @@ -115,25 +112,6 @@ EXTERN(long) jpeg_mem_available JPP((j_common_ptr cinfo, #define TEMP_NAME_LENGTH 64 /* max length of a temporary file's name */ - -#ifdef USE_MSDOS_MEMMGR /* DOS-specific junk */ - -typedef unsigned short XMSH; /* type of extended-memory handles */ -typedef unsigned short EMSH; /* type of expanded-memory handles */ - -typedef union { - short file_handle; /* DOS file handle if it's a temp file */ - XMSH xms_handle; /* handle if it's a chunk of XMS */ - EMSH ems_handle; /* handle if it's a chunk of EMS */ -} handle_union; - -#endif /* USE_MSDOS_MEMMGR */ - -#ifdef USE_MAC_MEMMGR /* Mac-specific junk */ -#include <Files.h> -#endif /* USE_MAC_MEMMGR */ - - typedef struct backing_store_struct * backing_store_ptr; typedef struct backing_store_struct { @@ -150,24 +128,9 @@ typedef struct backing_store_struct { backing_store_ptr info)); /* Private fields for system-dependent backing-store management */ -#ifdef USE_MSDOS_MEMMGR - /* For the MS-DOS manager (jmemdos.c), we need: */ - handle_union handle; /* reference to backing-store storage object */ - char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ -#else -#ifdef USE_MAC_MEMMGR - /* For the Mac manager (jmemmac.c), we need: */ - short temp_file; /* file reference number to temp file */ - FSSpec tempSpec; /* the FSSpec for the temp file */ - char temp_name[TEMP_NAME_LENGTH]; /* name if it's a file */ -#else /* For a typical implementation with temp files, we need: */ -#ifndef _FPDFAPI_MINI_ FXSYS_FILE * temp_file; /* stdio reference to temp file */ char temp_name[TEMP_NAME_LENGTH]; /* name of temp file */ -#endif -#endif -#endif } backing_store_info; 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,10 +135,8 @@ 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,10 +148,8 @@ 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) |