diff options
Diffstat (limited to 'xfa/src/fgas')
-rw-r--r-- | xfa/src/fgas/include/fx_stm.h | 2 | ||||
-rw-r--r-- | xfa/src/fgas/include/fx_utl.h | 8 | ||||
-rw-r--r-- | xfa/src/fgas/src/crt/fx_stream.cpp | 20 | ||||
-rw-r--r-- | xfa/src/fgas/src/crt/fx_stream.h | 11 | ||||
-rw-r--r-- | xfa/src/fgas/src/crt/fx_utils.cpp | 5 | ||||
-rw-r--r-- | xfa/src/fgas/src/font/fx_gdifont.h | 2 | ||||
-rw-r--r-- | xfa/src/fgas/src/font/fx_gefont.cpp | 20 | ||||
-rw-r--r-- | xfa/src/fgas/src/font/fx_gefont.h | 2 |
8 files changed, 8 insertions, 62 deletions
diff --git a/xfa/src/fgas/include/fx_stm.h b/xfa/src/fgas/include/fx_stm.h index 0f0385b5ec..cfd863d08c 100644 --- a/xfa/src/fgas/include/fx_stm.h +++ b/xfa/src/fgas/include/fx_stm.h @@ -64,8 +64,6 @@ class IFX_Stream { virtual int32_t GetBOM(uint8_t bom[4]) const = 0; virtual FX_WORD GetCodePage() const = 0; virtual FX_WORD SetCodePage(FX_WORD wCodePage) = 0; - virtual void Lock() = 0; - virtual void Unlock() = 0; virtual IFX_Stream* CreateSharedStream(FX_DWORD dwAccess, int32_t iOffset, int32_t iLength) = 0; diff --git a/xfa/src/fgas/include/fx_utl.h b/xfa/src/fgas/include/fx_utl.h index c8d943e920..f6c7c09f13 100644 --- a/xfa/src/fgas/include/fx_utl.h +++ b/xfa/src/fgas/include/fx_utl.h @@ -10,7 +10,6 @@ #include "xfa/src/fgas/include/fx_mem.h" #include "core/include/fxcrt/fx_coordinates.h" // For CFX_Rect. -class CFX_ThreadLock; class CFX_BaseArray; template <class baseType> class CFX_BaseArrayTemplate; @@ -36,13 +35,6 @@ template <class baseType> class CFX_CPLTree; class FX_BASEARRAYDATA; -class CFX_ThreadLock { - public: - CFX_ThreadLock(); - virtual ~CFX_ThreadLock(); - void Lock(); - void Unlock(); -}; class CFX_BaseArray : public CFX_Target { protected: CFX_BaseArray(int32_t iGrowSize, int32_t iBlockSize); diff --git a/xfa/src/fgas/src/crt/fx_stream.cpp b/xfa/src/fgas/src/crt/fx_stream.cpp index 93cdb5ec2c..79a0e4c78b 100644 --- a/xfa/src/fgas/src/crt/fx_stream.cpp +++ b/xfa/src/fgas/src/crt/fx_stream.cpp @@ -72,7 +72,7 @@ IFX_Stream* IFX_Stream::CreateStream(uint8_t* pData, } return pSR; } -CFX_StreamImp::CFX_StreamImp() : CFX_ThreadLock(), m_dwAccess(0) {} +CFX_StreamImp::CFX_StreamImp() : m_dwAccess(0) {} CFX_FileStreamImp::CFX_FileStreamImp() : CFX_StreamImp(), m_hFile(NULL), m_iLength(0) {} CFX_FileStreamImp::~CFX_FileStreamImp() { @@ -771,9 +771,7 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr, if (m_wCodePage == FX_CODEPAGE_UTF16LE || m_wCodePage == FX_CODEPAGE_UTF16BE) { int32_t iBytes = pByteSize == NULL ? iMaxLength * 2 : *pByteSize; - m_pStreamImp->Lock(); iLen = m_pStreamImp->ReadData((uint8_t*)pStr, iBytes); - m_pStreamImp->Unlock(); iMaxLength = iLen / 2; if (sizeof(FX_WCHAR) > 2) { FX_UTF16ToWChar(pStr, iMaxLength); @@ -799,13 +797,11 @@ int32_t CFX_TextStream::ReadString(FX_WCHAR* pStr, m_pBuf = FX_Realloc(uint8_t, m_pBuf, iBytes); m_iBufSize = iBytes; } - m_pStreamImp->Lock(); iLen = m_pStreamImp->ReadData(m_pBuf, iBytes); int32_t iSrc = iLen; int32_t iDecode = FX_DecodeString(m_wCodePage, (const FX_CHAR*)m_pBuf, &iSrc, pStr, &iMaxLength, TRUE); m_pStreamImp->Seek(FX_STREAMSEEK_Current, iSrc - iLen); - m_pStreamImp->Unlock(); if (iDecode < 1) { return -1; } @@ -828,10 +824,8 @@ int32_t CFX_TextStream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { encoder.Input(*pStr++); } CFX_ByteStringC bsResult = encoder.GetResult(); - m_pStreamImp->Lock(); m_pStreamImp->WriteData((const uint8_t*)bsResult.GetCStr(), bsResult.GetLength()); - m_pStreamImp->Unlock(); } return iLength; } @@ -1030,13 +1024,11 @@ int32_t CFX_Stream::ReadData(uint8_t* pBuffer, int32_t iBufferSize) { if (iLen <= 0) { return 0; } - m_pStreamImp->Lock(); if (m_pStreamImp->GetPosition() != m_iPosition) { m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition); } iLen = m_pStreamImp->ReadData(pBuffer, iLen); m_iPosition = m_pStreamImp->GetPosition(); - m_pStreamImp->Unlock(); return iLen; } int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, @@ -1056,7 +1048,6 @@ int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, if (iLen <= 0) { return 0; } - m_pStreamImp->Lock(); if (m_pStreamImp->GetPosition() != m_iPosition) { m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition); } @@ -1065,7 +1056,6 @@ int32_t CFX_Stream::ReadString(FX_WCHAR* pStr, if (iLen > 0 && m_iPosition >= iEnd) { bEOS = TRUE; } - m_pStreamImp->Unlock(); return iLen; } int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { @@ -1083,7 +1073,6 @@ int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { return 0; } } - m_pStreamImp->Lock(); int32_t iEnd = m_iStart + m_iLength; if (m_pStreamImp->GetPosition() != m_iPosition) { m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition); @@ -1093,7 +1082,6 @@ int32_t CFX_Stream::WriteData(const uint8_t* pBuffer, int32_t iBufferSize) { if (m_iPosition > iEnd) { m_iLength = m_iPosition - m_iStart; } - m_pStreamImp->Unlock(); return iLen; } int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { @@ -1111,7 +1099,6 @@ int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { return 0; } } - m_pStreamImp->Lock(); int32_t iEnd = m_iStart + m_iLength; if (m_pStreamImp->GetPosition() != m_iPosition) { m_pStreamImp->Seek(FX_STREAMSEEK_Begin, m_iPosition); @@ -1121,7 +1108,6 @@ int32_t CFX_Stream::WriteString(const FX_WCHAR* pStr, int32_t iLength) { if (m_iPosition > iEnd) { m_iLength = m_iPosition - m_iStart; } - m_pStreamImp->Unlock(); return iLen; } void CFX_Stream::Flush() { @@ -1219,10 +1205,8 @@ FX_FILESIZE CFGAS_FileRead::GetSize() { FX_BOOL CFGAS_FileRead::ReadBlock(void* buffer, FX_FILESIZE offset, size_t size) { - m_pStream->Lock(); m_pStream->Seek(FX_STREAMSEEK_Begin, (int32_t)offset); int32_t iLen = m_pStream->ReadData((uint8_t*)buffer, (int32_t)size); - m_pStream->Unlock(); return iLen == (int32_t)size; } @@ -1349,9 +1333,7 @@ FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, size_t size) { FX_BOOL CFGAS_FileWrite::WriteBlock(const void* pData, FX_FILESIZE offset, size_t size) { - m_pStream->Lock(); m_pStream->Seek(FX_STREAMSEEK_Begin, offset); int32_t iLen = m_pStream->WriteData((uint8_t*)pData, (int32_t)size); - m_pStream->Unlock(); return iLen == (int32_t)size; } diff --git a/xfa/src/fgas/src/crt/fx_stream.h b/xfa/src/fgas/src/crt/fx_stream.h index 15646a5de9..d58b52c1ac 100644 --- a/xfa/src/fgas/src/crt/fx_stream.h +++ b/xfa/src/fgas/src/crt/fx_stream.h @@ -18,7 +18,7 @@ class CFX_TextStream; class CFX_FileRead; class CFX_FileWrite; class CFX_BufferAccImp; -class CFX_StreamImp : public CFX_ThreadLock { +class CFX_StreamImp { public: virtual void Release() { delete this; } virtual FX_DWORD GetAccessModes() const { return m_dwAccess; } @@ -170,7 +170,7 @@ enum FX_STREAMTYPE { FX_STREAMTYPE_Stream, FX_STREAMTYPE_BufferRead, }; -class CFX_Stream : public IFX_Stream, public CFX_ThreadLock { +class CFX_Stream : public IFX_Stream { public: CFX_Stream(); ~CFX_Stream(); @@ -201,8 +201,6 @@ class CFX_Stream : public IFX_Stream, public CFX_ThreadLock { virtual int32_t GetBOM(uint8_t bom[4]) const; virtual FX_WORD GetCodePage() const; virtual FX_WORD SetCodePage(FX_WORD wCodePage); - virtual void Lock() { CFX_ThreadLock::Lock(); } - virtual void Unlock() { CFX_ThreadLock::Unlock(); } virtual IFX_Stream* CreateSharedStream(FX_DWORD dwAccess, int32_t iOffset, int32_t iLength); @@ -217,7 +215,7 @@ class CFX_Stream : public IFX_Stream, public CFX_ThreadLock { int32_t m_iLength; int32_t m_iRefCount; }; -class CFX_TextStream : public IFX_Stream, public CFX_ThreadLock { +class CFX_TextStream : public IFX_Stream { public: CFX_TextStream(IFX_Stream* pStream, FX_BOOL bDelStream); ~CFX_TextStream(); @@ -244,9 +242,6 @@ class CFX_TextStream : public IFX_Stream, public CFX_ThreadLock { virtual FX_WORD GetCodePage() const; virtual FX_WORD SetCodePage(FX_WORD wCodePage); - virtual void Lock() { CFX_ThreadLock::Lock(); } - virtual void Unlock() { CFX_ThreadLock::Unlock(); } - virtual IFX_Stream* CreateSharedStream(FX_DWORD dwAccess, int32_t iOffset, int32_t iLength); diff --git a/xfa/src/fgas/src/crt/fx_utils.cpp b/xfa/src/fgas/src/crt/fx_utils.cpp index 2818e07035..31fcb9e9b5 100644 --- a/xfa/src/fgas/src/crt/fx_utils.cpp +++ b/xfa/src/fgas/src/crt/fx_utils.cpp @@ -10,11 +10,6 @@ #include "xfa/src/fgas/src/fgas_base.h" #include "xfa/src/fgas/src/crt/fx_utils.h" -CFX_ThreadLock::CFX_ThreadLock() { -} -CFX_ThreadLock::~CFX_ThreadLock() {} -void CFX_ThreadLock::Lock() {} -void CFX_ThreadLock::Unlock() {} class FX_BASEARRAYDATA : public CFX_Target { public: FX_BASEARRAYDATA(int32_t growsize, int32_t blocksize) diff --git a/xfa/src/fgas/src/font/fx_gdifont.h b/xfa/src/fgas/src/font/fx_gdifont.h index b267e979a9..b501958d49 100644 --- a/xfa/src/fgas/src/font/fx_gdifont.h +++ b/xfa/src/fgas/src/font/fx_gdifont.h @@ -27,7 +27,7 @@ class CFX_GdiFontCache { protected: CFX_MapPtrToPtr m_GlyphMap; }; -class CFX_GdiFont : public IFX_Font, public CFX_ThreadLock { +class CFX_GdiFont : public IFX_Font { public: CFX_GdiFont(IFX_FontMgr* pFontMgr); ~CFX_GdiFont(); diff --git a/xfa/src/fgas/src/font/fx_gefont.cpp b/xfa/src/fgas/src/font/fx_gefont.cpp index cc8421cd5d..079814f5b3 100644 --- a/xfa/src/fgas/src/font/fx_gefont.cpp +++ b/xfa/src/fgas/src/font/fx_gefont.cpp @@ -87,7 +87,7 @@ IFX_Font* IFX_Font::LoadFont(CFX_Font* pExtFont, return pFont; } CFX_GEFont::CFX_GEFont(IFX_FontMgr* pFontMgr) - : CFX_ThreadLock(), + : #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ m_bUseLogFontStyle(FALSE), m_dwLogFontStyle(0), @@ -109,7 +109,7 @@ CFX_GEFont::CFX_GEFont(IFX_FontMgr* pFontMgr) } CFX_GEFont::CFX_GEFont(const CFX_GEFont& src, FX_DWORD dwFontStyles) - : CFX_ThreadLock(), + : #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ m_bUseLogFontStyle(FALSE), m_dwLogFontStyle(0), @@ -192,7 +192,6 @@ FX_BOOL CFX_GEFont::LoadFont(const FX_WCHAR* pszFontFamily, if (m_pFont) { return FALSE; } - Lock(); CFX_ByteString csFontFamily; if (pszFontFamily != NULL) { csFontFamily = CFX_ByteString::FromUnicode(pszFontFamily); @@ -239,28 +238,24 @@ FX_BOOL CFX_GEFont::LoadFont(const FX_WCHAR* pszFontFamily, if (bRet) { bRet = InitFont(); } - Unlock(); return bRet; } FX_BOOL CFX_GEFont::LoadFont(const uint8_t* pBuffer, int32_t length) { if (m_pFont) { return FALSE; } - Lock(); m_pFont = new CFX_Font; FX_BOOL bRet = m_pFont->LoadEmbedded(pBuffer, length); if (bRet) { bRet = InitFont(); } m_wCharSet = 0xFFFF; - Unlock(); return bRet; } FX_BOOL CFX_GEFont::LoadFont(const FX_WCHAR* pszFileName) { if (m_pFont || m_pStream || m_pFileRead) { return FALSE; } - Lock(); m_pStream = IFX_Stream::CreateStream( pszFileName, FX_STREAMACCESS_Binary | FX_STREAMACCESS_Read); m_pFileRead = FX_CreateFileRead(m_pStream); @@ -276,14 +271,12 @@ FX_BOOL CFX_GEFont::LoadFont(const FX_WCHAR* pszFileName) { } } m_wCharSet = 0xFFFF; - Unlock(); return bRet; } FX_BOOL CFX_GEFont::LoadFont(IFX_Stream* pFontStream, FX_BOOL bSaveStream) { if (m_pFont || m_pFileRead || !pFontStream || pFontStream->GetLength() < 1) { return FALSE; } - Lock(); if (bSaveStream) { m_pStream = pFontStream; } @@ -297,14 +290,12 @@ FX_BOOL CFX_GEFont::LoadFont(IFX_Stream* pFontStream, FX_BOOL bSaveStream) { m_pFileRead = nullptr; } m_wCharSet = 0xFFFF; - Unlock(); return bRet; } FX_BOOL CFX_GEFont::LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver) { if (m_pFont || !pExtFont) { return FALSE; } - Lock(); m_pFont = pExtFont; FX_BOOL bRet = !!m_pFont; if (bRet) { @@ -314,7 +305,6 @@ FX_BOOL CFX_GEFont::LoadFont(CFX_Font* pExtFont, FX_BOOL bTakeOver) { m_bExtFont = TRUE; } m_wCharSet = 0xFFFF; - Unlock(); return bRet; } FX_BOOL CFX_GEFont::InitFont() { @@ -419,9 +409,7 @@ FX_BOOL CFX_GEFont::GetCharWidth(FX_WCHAR wUnicode, iWidth = -1; } } - Lock(); m_pCharWidthMap->SetAtGrow(wUnicode, (int16_t)iWidth); - Unlock(); } else if (iWidth == 65535) { iWidth = -1; } @@ -446,13 +434,11 @@ FX_BOOL CFX_GEFont::GetCharBBox(FX_WCHAR wUnicode, if (pFont == (IFX_Font*)this) { FX_RECT rtBBox; if (m_pFont->GetGlyphBBox(iGlyph, rtBBox)) { - Lock(); CFX_Rect rt; rt.Set(rtBBox.left, rtBBox.top, rtBBox.Width(), rtBBox.Height()); int32_t index = m_pRectArray->Add(rt); pRect = m_pRectArray->GetPtrAt(index); m_pBBoxMap->SetAt((void*)(uintptr_t)wUnicode, pRect); - Unlock(); } } else if (((CFX_GEFont*)pFont) ->GetCharBBox(wUnicode, bbox, FALSE, bCharCode)) { @@ -563,7 +549,6 @@ int32_t CFX_GEFont::GetDescent() const { return m_pFont->GetDescent(); } void CFX_GEFont::Reset() { - Lock(); int32_t iCount = m_SubstFonts.GetSize(); for (int32_t i = 0; i < iCount; i++) { IFX_Font* pFont = (IFX_Font*)m_SubstFonts[i]; @@ -578,7 +563,6 @@ void CFX_GEFont::Reset() { if (m_pRectArray != NULL) { m_pRectArray->RemoveAll(); } - Unlock(); } IFX_Font* CFX_GEFont::GetSubstFont(int32_t iGlyphIndex) const { iGlyphIndex = ((FX_DWORD)iGlyphIndex) >> 24; diff --git a/xfa/src/fgas/src/font/fx_gefont.h b/xfa/src/fgas/src/font/fx_gefont.h index cddc984ca7..88688f00d5 100644 --- a/xfa/src/fgas/src/font/fx_gefont.h +++ b/xfa/src/fgas/src/font/fx_gefont.h @@ -12,7 +12,7 @@ class CFX_GEFontMgr; #ifndef FXFONT_SUBST_ITALIC #define FXFONT_SUBST_ITALIC 0x02 #endif -class CFX_GEFont : public IFX_Font, public CFX_ThreadLock { +class CFX_GEFont : public IFX_Font { public: CFX_GEFont(const CFX_GEFont& src, FX_DWORD dwFontStyles); CFX_GEFont(IFX_FontMgr* pFontMgr); |