summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h11
-rw-r--r--core/include/fpdfapi/fpdf_resource.h72
-rw-r--r--core/include/fxcrt/fx_basic.h26
-rw-r--r--core/include/fxcrt/fx_stream.h32
-rw-r--r--core/include/fxge/fx_dib.h31
-rw-r--r--core/include/fxge/fx_font.h12
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp104
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp1
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp4
-rw-r--r--core/src/fxcrt/fx_basic_buffer.cpp4
-rw-r--r--core/src/fxcrt/fx_basic_util.cpp2
-rw-r--r--core/src/fxge/dib/fx_dib_main.cpp40
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp17
-rw-r--r--core/src/fxge/ge/fx_ge_text.cpp3
15 files changed, 124 insertions, 247 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index 53404b7586..5903e82a16 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -476,12 +476,16 @@ class IPDF_SecurityHandler {
CPDF_Dictionary* pEncryptDict) = 0;
virtual FX_DWORD GetPermissions() = 0;
+
virtual FX_BOOL GetCryptInfo(int& cipher,
const uint8_t*& buffer,
int& keylen) = 0;
virtual FX_BOOL IsMetadataEncrypted() = 0;
+
virtual CPDF_CryptoHandler* CreateCryptoHandler() = 0;
+
+ virtual CPDF_StandardSecurityHandler* GetStandardHandler() { return NULL; }
};
#define PDF_ENCRYPT_CONTENT 0
@@ -793,22 +797,19 @@ class IPDF_DataAvail {
};
enum PDF_PAGENODE_TYPE {
- PDF_PAGENODE_UNKNOWN = 0,
+ PDF_PAGENODE_UNKOWN = 0,
PDF_PAGENODE_PAGE,
PDF_PAGENODE_PAGES,
PDF_PAGENODE_ARRAY,
};
-
class CPDF_PageNode {
public:
- CPDF_PageNode();
+ CPDF_PageNode() : m_type(PDF_PAGENODE_UNKOWN) {}
~CPDF_PageNode();
-
PDF_PAGENODE_TYPE m_type;
FX_DWORD m_dwPageNo;
CFX_ArrayTemplate<CPDF_PageNode*> m_childNode;
};
-
enum PDF_DATAAVAIL_STATUS {
PDF_DATAAVAIL_HEADER = 0,
PDF_DATAAVAIL_FIRSTPAGE,
diff --git a/core/include/fpdfapi/fpdf_resource.h b/core/include/fpdfapi/fpdf_resource.h
index 6bae2ac469..450e878fa1 100644
--- a/core/include/fpdfapi/fpdf_resource.h
+++ b/core/include/fpdfapi/fpdf_resource.h
@@ -102,37 +102,39 @@ class CPDF_Font {
virtual ~CPDF_Font();
- virtual bool IsType1Font() const;
- virtual bool IsTrueTypeFont() const;
- virtual bool IsType3Font() const;
- virtual bool IsCIDFont() const;
- virtual const CPDF_Type1Font* AsType1Font() const;
- virtual CPDF_Type1Font* AsType1Font();
- virtual const CPDF_TrueTypeFont* AsTrueTypeFont() const;
- virtual CPDF_TrueTypeFont* AsTrueTypeFont();
- virtual const CPDF_Type3Font* AsType3Font() const;
- virtual CPDF_Type3Font* AsType3Font();
- virtual const CPDF_CIDFont* AsCIDFont() const;
- virtual CPDF_CIDFont* AsCIDFont();
+ virtual bool IsType1Font() const { return false; }
+ virtual bool IsTrueTypeFont() const { return false; }
+ virtual bool IsType3Font() const { return false; }
+ virtual bool IsCIDFont() const { return false; }
+ virtual const CPDF_Type1Font* AsType1Font() const { return nullptr; }
+ virtual CPDF_Type1Font* AsType1Font() { return nullptr; }
+ virtual const CPDF_TrueTypeFont* AsTrueTypeFont() const { return nullptr; }
+ virtual CPDF_TrueTypeFont* AsTrueTypeFont() { return nullptr; }
+ virtual const CPDF_Type3Font* AsType3Font() const { return nullptr; }
+ virtual CPDF_Type3Font* AsType3Font() { return nullptr; }
+ virtual const CPDF_CIDFont* AsCIDFont() const { return nullptr; }
+ virtual CPDF_CIDFont* AsCIDFont() { return nullptr; }
virtual FX_BOOL IsVertWriting() const;
- virtual FX_BOOL IsUnicodeCompatible() const;
+ virtual FX_BOOL IsUnicodeCompatible() const { return FALSE; }
virtual FX_DWORD GetNextChar(const FX_CHAR* pString,
int nStrLen,
int& offset) const;
- virtual int CountChar(const FX_CHAR* pString, int size) const;
+ virtual int CountChar(const FX_CHAR* pString, int size) const { return size; }
virtual int AppendChar(FX_CHAR* buf, FX_DWORD charcode) const;
- virtual int GetCharSize(FX_DWORD charcode) const;
+ virtual int GetCharSize(FX_DWORD charcode) const { return 1; }
virtual int GlyphFromCharCode(FX_DWORD charcode,
- FX_BOOL* pVertGlyph = nullptr);
- virtual int GlyphFromCharCodeExt(FX_DWORD charcode);
+ FX_BOOL* pVertGlyph = NULL) = 0;
+ virtual int GlyphFromCharCodeExt(FX_DWORD charcode) {
+ return GlyphFromCharCode(charcode);
+ }
virtual CFX_WideString UnicodeFromCharCode(FX_DWORD charcode) const;
virtual FX_DWORD CharCodeFromUnicode(FX_WCHAR Unicode) const;
const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
const CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
FX_DWORD GetFlags() const { return m_Flags; }
- FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
+ FX_BOOL IsEmbedded() const { return IsType3Font() || m_pFontFile != NULL; }
CPDF_StreamAcc* GetFontFile() const { return m_pFontFile; }
CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
FX_BOOL IsStandardFont() const;
@@ -255,9 +257,9 @@ class CPDF_Type1Font : public CPDF_SimpleFont {
CPDF_Type1Font();
// CPDF_Font:
- bool IsType1Font() const override;
- const CPDF_Type1Font* AsType1Font() const override;
- CPDF_Type1Font* AsType1Font() override;
+ bool IsType1Font() const override { return true; }
+ const CPDF_Type1Font* AsType1Font() const override { return this; }
+ CPDF_Type1Font* AsType1Font() override { return this; }
int GlyphFromCharCodeExt(FX_DWORD charcode) override;
int GetBase14Font() const { return m_Base14Font; }
@@ -277,9 +279,9 @@ class CPDF_TrueTypeFont : public CPDF_SimpleFont {
CPDF_TrueTypeFont();
// CPDF_Font:
- bool IsTrueTypeFont() const override;
- const CPDF_TrueTypeFont* AsTrueTypeFont() const override;
- CPDF_TrueTypeFont* AsTrueTypeFont() override;
+ bool IsTrueTypeFont() const override { return true; }
+ const CPDF_TrueTypeFont* AsTrueTypeFont() const override { return this; }
+ CPDF_TrueTypeFont* AsTrueTypeFont() override { return this; }
protected:
// CPDF_Font:
@@ -311,9 +313,9 @@ class CPDF_Type3Font : public CPDF_SimpleFont {
~CPDF_Type3Font() override;
// CPDF_Font:
- bool IsType3Font() const override;
- const CPDF_Type3Font* AsType3Font() const override;
- CPDF_Type3Font* AsType3Font() override;
+ bool IsType3Font() const override { return true; }
+ const CPDF_Type3Font* AsType3Font() const override { return this; }
+ CPDF_Type3Font* AsType3Font() override { return this; }
int GetCharWidthF(FX_DWORD charcode, int level = 0) override;
FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override;
@@ -360,9 +362,9 @@ class CPDF_CIDFont : public CPDF_Font {
static FX_FLOAT CIDTransformToFloat(uint8_t ch);
// CPDF_Font:
- bool IsCIDFont() const override;
- const CPDF_CIDFont* AsCIDFont() const override;
- CPDF_CIDFont* AsCIDFont() override;
+ bool IsCIDFont() const override { return true; }
+ const CPDF_CIDFont* AsCIDFont() const override { return this; }
+ CPDF_CIDFont* AsCIDFont() override { return this; }
int GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph = NULL) override;
int GetCharWidthF(FX_DWORD charcode, int level = 0) override;
FX_RECT GetCharBBox(FX_DWORD charcode, int level = 0) override;
@@ -432,10 +434,15 @@ class CPDF_ColorSpace {
void ReleaseCS();
int GetBufSize() const;
+
FX_FLOAT* CreateBuf();
+
void GetDefaultColor(FX_FLOAT* buf) const;
+
int CountComponents() const { return m_nComponents; }
+
int GetFamily() const { return m_Family; }
+
virtual void GetDefaultValue(int iComponent,
FX_FLOAT& value,
FX_FLOAT& min,
@@ -446,10 +453,12 @@ class CPDF_ColorSpace {
}
FX_BOOL sRGB() const;
+
virtual FX_BOOL GetRGB(FX_FLOAT* pBuf,
FX_FLOAT& R,
FX_FLOAT& G,
FX_FLOAT& B) const = 0;
+
virtual FX_BOOL SetRGB(FX_FLOAT* pBuf,
FX_FLOAT R,
FX_FLOAT G,
@@ -462,6 +471,7 @@ class CPDF_ColorSpace {
FX_FLOAT& m,
FX_FLOAT& y,
FX_FLOAT& k) const;
+
FX_BOOL SetCMYK(FX_FLOAT* pBuf,
FX_FLOAT c,
FX_FLOAT m,
@@ -476,7 +486,9 @@ class CPDF_ColorSpace {
FX_BOOL bTransMask = FALSE) const;
CPDF_Array*& GetArray() { return m_pArray; }
+
int GetMaxIndex() const;
+
virtual CPDF_ColorSpace* GetBaseCS() const { return NULL; }
virtual void EnableStdConversion(FX_BOOL bEnabled);
diff --git a/core/include/fxcrt/fx_basic.h b/core/include/fxcrt/fx_basic.h
index 11c573be6e..006b2b377d 100644
--- a/core/include/fxcrt/fx_basic.h
+++ b/core/include/fxcrt/fx_basic.h
@@ -45,7 +45,6 @@ class CFX_BinaryBuf {
public:
CFX_BinaryBuf();
explicit CFX_BinaryBuf(FX_STRSIZE size);
- ~CFX_BinaryBuf();
uint8_t* GetBuffer() const { return m_pBuffer.get(); }
FX_STRSIZE GetSize() const { return m_DataSize; }
@@ -183,7 +182,6 @@ class CFX_ArchiveLoader {
class CFX_FileBufferArchive {
public:
CFX_FileBufferArchive();
- ~CFX_FileBufferArchive();
void Clear();
bool Flush();
@@ -696,12 +694,13 @@ class CFX_MapPtrTemplate : public CFX_MapPtrToPtr {
}
};
#endif // PDF_ENABLE_XFA
-
class CFX_PtrList {
protected:
struct CNode {
CNode* pNext;
+
CNode* pPrev;
+
void* data;
};
@@ -709,6 +708,7 @@ class CFX_PtrList {
CFX_PtrList(int nBlockSize = 10);
FX_POSITION GetHeadPosition() const { return (FX_POSITION)m_pNodeHead; }
+
FX_POSITION GetTailPosition() const { return (FX_POSITION)m_pNodeTail; }
void* GetNext(FX_POSITION& rPosition) const {
@@ -737,49 +737,60 @@ class CFX_PtrList {
}
int GetCount() const { return m_nCount; }
+
FX_POSITION AddTail(void* newElement);
+
FX_POSITION AddHead(void* newElement);
void SetAt(FX_POSITION pos, void* newElement) {
CNode* pNode = (CNode*)pos;
pNode->data = newElement;
}
+
FX_POSITION InsertAfter(FX_POSITION pos, void* newElement);
FX_POSITION Find(void* searchValue, FX_POSITION startAfter = NULL) const;
+
FX_POSITION FindIndex(int index) const;
void RemoveAt(FX_POSITION pos);
+
void RemoveAll();
protected:
CNode* m_pNodeHead;
+
CNode* m_pNodeTail;
+
int m_nCount;
+
CNode* m_pNodeFree;
+
struct CFX_Plex* m_pBlocks;
+
int m_nBlockSize;
CNode* NewNode(CNode* pPrev, CNode* pNext);
+
void FreeNode(CNode* pNode);
public:
~CFX_PtrList();
};
typedef void (*PD_CALLBACK_FREEDATA)(void* pData);
-
struct FX_PRIVATEDATA {
void FreeData();
void* m_pModuleId;
+
void* m_pData;
+
PD_CALLBACK_FREEDATA m_pCallback;
+
FX_BOOL m_bSelfDestruct;
};
-
class CFX_PrivateData {
public:
- CFX_PrivateData();
~CFX_PrivateData();
void ClearAll();
@@ -787,9 +798,11 @@ class CFX_PrivateData {
void SetPrivateData(void* module_id,
void* pData,
PD_CALLBACK_FREEDATA callback);
+
void SetPrivateObj(void* module_id, CFX_DestructObject* pObj);
void* GetPrivateData(void* module_id);
+
FX_BOOL LookupPrivateData(void* module_id, void*& pData) const {
if (!module_id) {
return FALSE;
@@ -814,7 +827,6 @@ class CFX_PrivateData {
PD_CALLBACK_FREEDATA callback,
FX_BOOL bSelfDestruct);
};
-
class CFX_BitStream {
public:
void Init(const uint8_t* pData, FX_DWORD dwSize);
diff --git a/core/include/fxcrt/fx_stream.h b/core/include/fxcrt/fx_stream.h
index d15d286031..4e2f0f97ce 100644
--- a/core/include/fxcrt/fx_stream.h
+++ b/core/include/fxcrt/fx_stream.h
@@ -20,25 +20,20 @@ FX_BOOL FX_GetNextFile(void* handle,
FX_BOOL& bFolder);
void FX_CloseFolder(void* handle);
FX_WCHAR FX_GetFolderSeparator();
-
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
#define FX_FILESIZE int32_t
#else
#include <fcntl.h>
#include <sys/stat.h>
#include <unistd.h>
-
#ifndef O_BINARY
#define O_BINARY 0
-#endif // O_BINARY
-
+#endif
#ifndef O_LARGEFILE
#define O_LARGEFILE 0
-#endif // O_LARGEFILE
-
+#endif
#define FX_FILESIZE off_t
-#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-
+#endif
#define FX_GETBYTEOFFSET32(a) 0
#define FX_GETBYTEOFFSET40(a) 0
#define FX_GETBYTEOFFSET48(a) 0
@@ -61,7 +56,10 @@ class IFX_StreamWrite {
class IFX_FileWrite : public IFX_StreamWrite {
public:
// IFX_StreamWrite:
- FX_BOOL WriteBlock(const void* pData, size_t size) override;
+ FX_BOOL WriteBlock(const void* pData, size_t size) override {
+ return WriteBlock(pData, GetSize(), size);
+ }
+
virtual FX_FILESIZE GetSize() = 0;
virtual FX_BOOL Flush() = 0;
virtual FX_BOOL WriteBlock(const void* pData,
@@ -83,9 +81,9 @@ class IFX_FileRead : IFX_StreamRead {
public:
// IFX_StreamRead:
void Release() override = 0;
- FX_BOOL IsEOF() override;
- FX_FILESIZE GetPosition() override;
- size_t ReadBlock(void* buffer, size_t size) override;
+ FX_BOOL IsEOF() override { return FALSE; }
+ FX_FILESIZE GetPosition() override { return 0; }
+ size_t ReadBlock(void* buffer, size_t size) override { return 0; }
virtual FX_BOOL ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) = 0;
virtual FX_FILESIZE GetSize() = 0;
@@ -110,7 +108,9 @@ class IFX_FileStream : public IFX_FileRead, public IFX_FileWrite {
FX_BOOL WriteBlock(const void* buffer,
FX_FILESIZE offset,
size_t size) override = 0;
- FX_BOOL WriteBlock(const void* buffer, size_t size) override;
+ FX_BOOL WriteBlock(const void* buffer, size_t size) override {
+ return WriteBlock(buffer, GetSize(), size);
+ }
FX_BOOL Flush() override = 0;
};
@@ -132,19 +132,21 @@ IFX_FileAccess* FX_CreateDefaultFileAccess(const CFX_WideStringC& wsPath);
class IFX_MemoryStream : public IFX_FileStream {
public:
virtual FX_BOOL IsConsecutive() const = 0;
+
virtual void EstimateSize(size_t nInitSize, size_t nGrowSize) = 0;
+
virtual uint8_t* GetBuffer() const = 0;
+
virtual void AttachBuffer(uint8_t* pBuffer,
size_t nSize,
FX_BOOL bTakeOver = FALSE) = 0;
+
virtual void DetachBuffer() = 0;
};
-
IFX_MemoryStream* FX_CreateMemoryStream(uint8_t* pBuffer,
size_t nSize,
FX_BOOL bTakeOver = FALSE);
IFX_MemoryStream* FX_CreateMemoryStream(FX_BOOL bConsecutive = FALSE);
-
class IFX_BufferRead : public IFX_StreamRead {
public:
// IFX_StreamRead:
diff --git a/core/include/fxge/fx_dib.h b/core/include/fxge/fx_dib.h
index 43746e5d48..e39bad2b87 100644
--- a/core/include/fxge/fx_dib.h
+++ b/core/include/fxge/fx_dib.h
@@ -160,23 +160,30 @@ FX_ARGB ArgbEncode(int a, FX_COLORREF rgb);
#define FXSETFLAG_ALPHA_FILL(flag, val) flag = ((val) | (flag & 0xffffff00))
#define FXSETFLAG_ALPHA_STROKE(flag, val) \
flag = (((val) << 16) | (flag & 0xff00ffff))
-
class CFX_DIBSource {
public:
virtual ~CFX_DIBSource();
int GetWidth() const { return m_Width; }
+
int GetHeight() const { return m_Height; }
FXDIB_Format GetFormat() const {
return (FXDIB_Format)(m_AlphaFlag * 0x100 + m_bpp);
}
+
FX_DWORD GetPitch() const { return m_Pitch; }
+
FX_DWORD* GetPalette() const { return m_pPalette; }
- virtual uint8_t* GetBuffer() const;
+ virtual uint8_t* GetBuffer() const { return NULL; }
+
virtual const uint8_t* GetScanline(int line) const = 0;
- virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const;
+
+ virtual FX_BOOL SkipToScanline(int line, IFX_Pause* pPause) const {
+ return FALSE;
+ }
+
virtual void DownSampleScanline(int line,
uint8_t* dest_scan,
int dest_bpp,
@@ -184,6 +191,7 @@ class CFX_DIBSource {
FX_BOOL bFlipX,
int clip_left,
int clip_width) const = 0;
+
virtual void SetDownSampleSize(int width, int height) {}
int GetBPP() const { return m_bpp; }
@@ -211,6 +219,7 @@ class CFX_DIBSource {
void CopyPalette(const FX_DWORD* pSrcPal, FX_DWORD size = 256);
CFX_DIBitmap* Clone(const FX_RECT* pClip = NULL) const;
+
CFX_DIBitmap* CloneConvert(FXDIB_Format format,
const FX_RECT* pClip = NULL,
void* pIccTransform = NULL) const;
@@ -219,6 +228,7 @@ class CFX_DIBSource {
int dest_height,
FX_DWORD flags = 0,
const FX_RECT* pClip = NULL) const;
+
CFX_DIBitmap* TransformTo(const CFX_Matrix* pMatrix,
int& left,
int& top,
@@ -226,6 +236,7 @@ class CFX_DIBSource {
const FX_RECT* pClip = NULL) const;
CFX_DIBitmap* GetAlphaMask(const FX_RECT* pClip = NULL) const;
+
FX_BOOL CopyAlphaMask(const CFX_DIBSource* pAlphaMask,
const FX_RECT* pClip = NULL);
@@ -251,15 +262,23 @@ class CFX_DIBSource {
CFX_DIBSource();
int m_Width;
+
int m_Height;
+
int m_bpp;
+
FX_DWORD m_AlphaFlag;
+
FX_DWORD m_Pitch;
+
FX_DWORD* m_pPalette;
void BuildPalette();
+
FX_BOOL BuildAlphaMask();
+
int FindPalette(FX_DWORD color) const;
+
void GetPalette(FX_DWORD* pal, int alpha) const;
};
class CFX_DIBitmap : public CFX_DIBSource {
@@ -277,8 +296,10 @@ class CFX_DIBitmap : public CFX_DIBSource {
FX_BOOL Copy(const CFX_DIBSource* pSrc);
// CFX_DIBSource
- uint8_t* GetBuffer() const override;
- const uint8_t* GetScanline(int line) const override;
+ uint8_t* GetBuffer() const override { return m_pBuffer; }
+ const uint8_t* GetScanline(int line) const override {
+ return m_pBuffer ? m_pBuffer + line * m_Pitch : NULL;
+ }
void DownSampleScanline(int line,
uint8_t* dest_scan,
int dest_bpp,
diff --git a/core/include/fxge/fx_font.h b/core/include/fxge/fx_font.h
index 2902145594..67ca1a7f4e 100644
--- a/core/include/fxge/fx_font.h
+++ b/core/include/fxge/fx_font.h
@@ -365,14 +365,14 @@ class IFX_SystemFontInfo {
int pitch_family,
const FX_CHAR* face,
int& iExact) = 0;
-
#ifdef PDF_ENABLE_XFA
virtual void* MapFontByUnicode(FX_DWORD dwUnicode,
int weight,
FX_BOOL bItalic,
- int pitch_family);
+ int pitch_family) {
+ return NULL;
+ }
#endif // PDF_ENABLE_XFA
-
virtual void* GetFont(const FX_CHAR* face) = 0;
virtual FX_DWORD GetFontData(void* hFont,
FX_DWORD table,
@@ -380,9 +380,9 @@ class IFX_SystemFontInfo {
FX_DWORD size) = 0;
virtual FX_BOOL GetFaceName(void* hFont, CFX_ByteString& name) = 0;
virtual FX_BOOL GetFontCharset(void* hFont, int& charset) = 0;
- virtual int GetFaceIndex(void* hFont);
+ virtual int GetFaceIndex(void* hFont) { return 0; }
virtual void DeleteFont(void* hFont) = 0;
- virtual void* RetainFont(void* hFont);
+ virtual void* RetainFont(void* hFont) { return NULL; }
protected:
virtual ~IFX_SystemFontInfo() {}
@@ -446,7 +446,6 @@ class CFX_CountedFaceCache {
class CFX_FontCache {
public:
- CFX_FontCache();
~CFX_FontCache();
CFX_FaceCache* GetCachedFace(CFX_Font* pFont);
void ReleaseCachedFace(CFX_Font* pFont);
@@ -457,7 +456,6 @@ class CFX_FontCache {
CFX_FTCacheMap m_FTFaceMap;
CFX_FTCacheMap m_ExtFaceMap;
};
-
class CFX_AutoFontCache {
public:
CFX_AutoFontCache(CFX_FontCache* pFontCache, CFX_Font* pFont)
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index a64b5010c4..a9deba665c 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -173,74 +173,6 @@ CPDF_Font::~CPDF_Font() {
}
}
-bool CPDF_Font::IsType1Font() const {
- return false;
-}
-
-bool CPDF_Font::IsTrueTypeFont() const {
- return false;
-}
-
-bool CPDF_Font::IsType3Font() const {
- return false;
-}
-
-bool CPDF_Font::IsCIDFont() const {
- return false;
-}
-
-const CPDF_Type1Font* CPDF_Font::AsType1Font() const {
- return nullptr;
-}
-
-CPDF_Type1Font* CPDF_Font::AsType1Font() {
- return nullptr;
-}
-
-const CPDF_TrueTypeFont* CPDF_Font::AsTrueTypeFont() const {
- return nullptr;
-}
-
-CPDF_TrueTypeFont* CPDF_Font::AsTrueTypeFont() {
- return nullptr;
-}
-
-const CPDF_Type3Font* CPDF_Font::AsType3Font() const {
- return nullptr;
-}
-
-CPDF_Type3Font* CPDF_Font::AsType3Font() {
- return nullptr;
-}
-
-const CPDF_CIDFont* CPDF_Font::AsCIDFont() const {
- return nullptr;
-}
-
-CPDF_CIDFont* CPDF_Font::AsCIDFont() {
- return nullptr;
-}
-
-FX_BOOL CPDF_Font::IsUnicodeCompatible() const {
- return FALSE;
-}
-
-int CPDF_Font::CountChar(const FX_CHAR* pString, int size) const {
- return size;
-}
-
-int CPDF_Font::GetCharSize(FX_DWORD charcode) const {
- return 1;
-}
-
-int CPDF_Font::GlyphFromCharCode(FX_DWORD charcode, FX_BOOL* pVertGlyph) {
- ASSERT(false);
-}
-
-int CPDF_Font::GlyphFromCharCodeExt(FX_DWORD charcode) {
- return GlyphFromCharCode(charcode);
-}
-
FX_BOOL CPDF_Font::IsVertWriting() const {
FX_BOOL bVertWriting = FALSE;
const CPDF_CIDFont* pCIDFont = AsCIDFont();
@@ -1030,18 +962,6 @@ FX_DWORD CPDF_SimpleFont::CharCodeFromUnicode(FX_WCHAR unicode) const {
CPDF_Type1Font::CPDF_Type1Font() : m_Base14Font(-1) {}
-bool CPDF_Type1Font::IsType1Font() const {
- return true;
-}
-
-const CPDF_Type1Font* CPDF_Type1Font::AsType1Font() const {
- return this;
-}
-
-CPDF_Type1Font* CPDF_Type1Font::AsType1Font() {
- return this;
-}
-
FX_BOOL CPDF_Type1Font::Load() {
m_Base14Font = PDF_GetStandardFontName(&m_BaseFont);
if (m_Base14Font >= 0) {
@@ -1440,18 +1360,6 @@ CPDF_Object* CPDF_FontEncoding::Realize() {
CPDF_TrueTypeFont::CPDF_TrueTypeFont() {}
-bool CPDF_TrueTypeFont::IsTrueTypeFont() const {
- return true;
-}
-
-const CPDF_TrueTypeFont* CPDF_TrueTypeFont::AsTrueTypeFont() const {
- return this;
-}
-
-CPDF_TrueTypeFont* CPDF_TrueTypeFont::AsTrueTypeFont() {
- return this;
-}
-
FX_BOOL CPDF_TrueTypeFont::Load() {
return LoadCommon();
}
@@ -1664,18 +1572,6 @@ CPDF_Type3Font::~CPDF_Type3Font() {
delete it.second;
}
-bool CPDF_Type3Font::IsType3Font() const {
- return true;
-}
-
-const CPDF_Type3Font* CPDF_Type3Font::AsType3Font() const {
- return this;
-}
-
-CPDF_Type3Font* CPDF_Type3Font::AsType3Font() {
- return this;
-}
-
FX_BOOL CPDF_Type3Font::Load() {
m_pFontResources = m_pFontDict->GetDictBy("Resources");
CPDF_Array* pMatrix = m_pFontDict->GetArrayBy("FontMatrix");
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 38406394c4..7c85b8213d 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -1068,18 +1068,6 @@ CPDF_CIDFont::~CPDF_CIDFont() {
delete m_pTTGSUBTable;
}
-bool CPDF_CIDFont::IsCIDFont() const {
- return true;
-}
-
-const CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() const {
- return this;
-}
-
-CPDF_CIDFont* CPDF_CIDFont::AsCIDFont() {
- return this;
-}
-
FX_WORD CPDF_CIDFont::CIDFromCharCode(FX_DWORD charcode) const {
if (!m_pCMap) {
return (FX_WORD)charcode;
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 95907ae8fd..799e748761 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -56,7 +56,6 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
FXSYS_memset(key, 0, keylen);
FXSYS_memcpy(key, digest, copy_len);
}
-
CPDF_CryptoHandler* CPDF_StandardSecurityHandler::CreateCryptoHandler() {
return new CPDF_StandardCryptoHandler;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index e18775e54b..737bbe49be 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -4144,7 +4144,7 @@ FX_BOOL CPDF_DataAvail::CheckPageNode(CPDF_PageNode& pageNodes,
continue;
switch (pNode->m_type) {
- case PDF_PAGENODE_UNKNOWN:
+ case PDF_PAGENODE_UNKOWN:
if (!CheckUnkownPageNode(pNode->m_dwPageNo, pNode, pHints)) {
return FALSE;
}
@@ -4586,8 +4586,6 @@ IPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
return FormAvailable;
}
-CPDF_PageNode::CPDF_PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {}
-
CPDF_PageNode::~CPDF_PageNode() {
for (int32_t i = 0; i < m_childNode.GetSize(); ++i)
delete m_childNode[i];
diff --git a/core/src/fxcrt/fx_basic_buffer.cpp b/core/src/fxcrt/fx_basic_buffer.cpp
index f623d995c7..9578653019 100644
--- a/core/src/fxcrt/fx_basic_buffer.cpp
+++ b/core/src/fxcrt/fx_basic_buffer.cpp
@@ -19,8 +19,6 @@ CFX_BinaryBuf::CFX_BinaryBuf(FX_STRSIZE size)
m_pBuffer.reset(FX_Alloc(uint8_t, size));
}
-CFX_BinaryBuf::~CFX_BinaryBuf() {}
-
void CFX_BinaryBuf::Delete(int start_index, int count) {
if (!m_pBuffer || start_index < 0 || count < 0 || count > m_DataSize ||
start_index > m_DataSize - count) {
@@ -366,8 +364,6 @@ FX_DWORD CFX_BitStream::GetBits(FX_DWORD nBits) {
CFX_FileBufferArchive::CFX_FileBufferArchive()
: m_Length(0), m_pFile(nullptr) {}
-CFX_FileBufferArchive::~CFX_FileBufferArchive() {}
-
void CFX_FileBufferArchive::Clear() {
m_Length = 0;
m_pBuffer.reset();
diff --git a/core/src/fxcrt/fx_basic_util.cpp b/core/src/fxcrt/fx_basic_util.cpp
index 2422212d59..7228af1a8a 100644
--- a/core/src/fxcrt/fx_basic_util.cpp
+++ b/core/src/fxcrt/fx_basic_util.cpp
@@ -16,8 +16,6 @@
#include <direct.h>
#endif
-CFX_PrivateData::CFX_PrivateData() {}
-
CFX_PrivateData::~CFX_PrivateData() {
ClearAll();
}
diff --git a/core/src/fxge/dib/fx_dib_main.cpp b/core/src/fxge/dib/fx_dib_main.cpp
index ab4c170af5..4922373ec0 100644
--- a/core/src/fxge/dib/fx_dib_main.cpp
+++ b/core/src/fxge/dib/fx_dib_main.cpp
@@ -42,7 +42,6 @@ FX_DWORD ArgbEncode(int a, FX_COLORREF rgb) {
return FXARGB_MAKE(a, FXSYS_GetRValue(rgb), FXSYS_GetGValue(rgb),
FXSYS_GetBValue(rgb));
}
-
CFX_DIBSource::CFX_DIBSource() {
m_bpp = 0;
m_AlphaFlag = 0;
@@ -51,26 +50,15 @@ CFX_DIBSource::CFX_DIBSource() {
m_pPalette = NULL;
m_pAlphaMask = NULL;
}
-
CFX_DIBSource::~CFX_DIBSource() {
FX_Free(m_pPalette);
delete m_pAlphaMask;
}
-
-uint8_t* CFX_DIBSource::GetBuffer() const {
- return NULL;
-}
-
-FX_BOOL CFX_DIBSource::SkipToScanline(int line, IFX_Pause* pPause) const {
- return FALSE;
-}
-
CFX_DIBitmap::CFX_DIBitmap() {
m_bExtBuf = FALSE;
m_pBuffer = NULL;
m_pPalette = NULL;
}
-
#define _MAX_OOM_LIMIT_ 12000000
FX_BOOL CFX_DIBitmap::Create(int width,
int height,
@@ -125,7 +113,6 @@ FX_BOOL CFX_DIBitmap::Create(int width,
}
return TRUE;
}
-
FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) {
if (m_pBuffer) {
return FALSE;
@@ -140,34 +127,24 @@ FX_BOOL CFX_DIBitmap::Copy(const CFX_DIBSource* pSrc) {
}
return TRUE;
}
-
CFX_DIBitmap::~CFX_DIBitmap() {
- if (!m_bExtBuf)
+ if (!m_bExtBuf) {
FX_Free(m_pBuffer);
-
- m_pBuffer = nullptr;
-}
-
-uint8_t* CFX_DIBitmap::GetBuffer() const {
- return m_pBuffer;
-}
-
-const uint8_t* CFX_DIBitmap::GetScanline(int line) const {
- return m_pBuffer ? m_pBuffer + line * m_Pitch : nullptr;
+ }
+ m_pBuffer = NULL;
}
-
void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) {
- if (!m_bExtBuf)
+ if (!m_bExtBuf) {
FX_Free(m_pBuffer);
-
+ }
FX_Free(m_pPalette);
delete m_pAlphaMask;
m_pBuffer = pSrcBitmap->m_pBuffer;
m_pPalette = pSrcBitmap->m_pPalette;
m_pAlphaMask = pSrcBitmap->m_pAlphaMask;
- pSrcBitmap->m_pBuffer = nullptr;
- pSrcBitmap->m_pPalette = nullptr;
- pSrcBitmap->m_pAlphaMask = nullptr;
+ pSrcBitmap->m_pBuffer = NULL;
+ pSrcBitmap->m_pPalette = NULL;
+ pSrcBitmap->m_pAlphaMask = NULL;
m_bpp = pSrcBitmap->m_bpp;
m_bExtBuf = pSrcBitmap->m_bExtBuf;
m_AlphaFlag = pSrcBitmap->m_AlphaFlag;
@@ -175,7 +152,6 @@ void CFX_DIBitmap::TakeOver(CFX_DIBitmap* pSrcBitmap) {
m_Height = pSrcBitmap->m_Height;
m_Pitch = pSrcBitmap->m_Pitch;
}
-
CFX_DIBitmap* CFX_DIBSource::Clone(const FX_RECT* pClip) const {
FX_RECT rect(0, 0, m_Width, m_Height);
if (pClip) {
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index cd46148b7f..890de616d1 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -1281,23 +1281,8 @@ FXFT_Face CFX_FontMapper::FindSubstFontByUnicode(FX_DWORD dwUnicode,
m_pFontInfo->DeleteFont(hFont);
return face;
}
-
-void* IFX_SystemFontInfo::MapFontByUnicode(FX_DWORD dwUnicode,
- int weight,
- FX_BOOL bItalic,
- int pitch_family) {
- return nullptr;
-}
#endif // PDF_ENABLE_XFA
-int IFX_SystemFontInfo::GetFaceIndex(void* hFont) {
- return 0;
-}
-
-void* IFX_SystemFontInfo::RetainFont(void* hFont) {
- return NULL;
-}
-
int CFX_FontMapper::GetFaceSize() const {
return pdfium::CollectionSize<int>(m_FaceArray);
}
@@ -1323,13 +1308,11 @@ unsigned long _FTStreamRead(FXFT_Stream stream,
unsigned long count);
void _FTStreamClose(FXFT_Stream stream);
};
-
#if _FX_OS_ == _FX_ANDROID_
IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) {
return NULL;
}
#endif
-
CFX_FolderFontInfo::CFX_FolderFontInfo() {}
CFX_FolderFontInfo::~CFX_FolderFontInfo() {
for (const auto& pair : m_FontList) {
diff --git a/core/src/fxge/ge/fx_ge_text.cpp b/core/src/fxge/ge/fx_ge_text.cpp
index 8fb03d86eb..8d54363d14 100644
--- a/core/src/fxge/ge/fx_ge_text.cpp
+++ b/core/src/fxge/ge/fx_ge_text.cpp
@@ -1167,9 +1167,6 @@ FX_BOOL CFX_RenderDevice::DrawTextPath(int nChars,
}
return TRUE;
}
-
-CFX_FontCache::CFX_FontCache() {}
-
CFX_FontCache::~CFX_FontCache() {
FreeCache(TRUE);
}