summaryrefslogtreecommitdiff
path: root/xfa
diff options
context:
space:
mode:
Diffstat (limited to 'xfa')
-rw-r--r--xfa/fde/css/fde_css.h1
-rw-r--r--xfa/fde/fde_iterator.cpp1
-rw-r--r--xfa/fde/fde_iterator.h1
-rw-r--r--xfa/fde/tto/fde_textout.cpp1
-rw-r--r--xfa/fde/tto/fde_textout.h1
-rw-r--r--xfa/fde/xml/fde_xml_imp.h2
-rw-r--r--xfa/fgas/crt/fgas_utils.cpp77
-rw-r--r--xfa/fgas/crt/fgas_utils.h42
-rw-r--r--xfa/fgas/font/cfgas_fontmgr.h4
-rw-r--r--xfa/fgas/font/cfgas_gefont.cpp10
-rw-r--r--xfa/fgas/font/cfgas_gefont.h3
-rw-r--r--xfa/fgas/layout/fgas_linebreak.h1
-rw-r--r--xfa/fgas/layout/fgas_rtfbreak.h1
-rw-r--r--xfa/fgas/layout/fgas_textbreak.h1
-rw-r--r--xfa/fxfa/parser/xfa_object.h1
-rw-r--r--xfa/fxfa/parser/xfa_utils.h1
16 files changed, 6 insertions, 142 deletions
diff --git a/xfa/fde/css/fde_css.h b/xfa/fde/css/fde_css.h
index 6c2629f5ec..344b709487 100644
--- a/xfa/fde/css/fde_css.h
+++ b/xfa/fde/css/fde_css.h
@@ -9,7 +9,6 @@
#include "core/fxge/fx_dib.h"
#include "xfa/fgas/crt/fgas_stream.h"
-#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
enum FDE_CSSVALUETYPE {
diff --git a/xfa/fde/fde_iterator.cpp b/xfa/fde/fde_iterator.cpp
index 8cbaa33383..e9a644043d 100644
--- a/xfa/fde/fde_iterator.cpp
+++ b/xfa/fde/fde_iterator.cpp
@@ -7,7 +7,6 @@
#include "xfa/fde/fde_iterator.h"
#include "xfa/fde/cfde_txtedtpage.h"
-#include "xfa/fgas/crt/fgas_utils.h"
CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {}
diff --git a/xfa/fde/fde_iterator.h b/xfa/fde/fde_iterator.h
index 3cd3a6fa19..95785e448d 100644
--- a/xfa/fde/fde_iterator.h
+++ b/xfa/fde/fde_iterator.h
@@ -10,7 +10,6 @@
#include <stack>
#include "xfa/fde/fde_visualset.h"
-#include "xfa/fgas/crt/fgas_utils.h"
class CFDE_TxtEdtPage;
diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp
index 5c59b2c8d6..0e8e91e8b1 100644
--- a/xfa/fde/tto/fde_textout.cpp
+++ b/xfa/fde/tto/fde_textout.cpp
@@ -15,7 +15,6 @@
#include "xfa/fde/cfde_path.h"
#include "xfa/fde/fde_gedevice.h"
#include "xfa/fde/fde_object.h"
-#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
FDE_TTOPIECE::FDE_TTOPIECE() = default;
diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h
index 15b5167e08..fa4444822d 100644
--- a/xfa/fde/tto/fde_textout.h
+++ b/xfa/fde/tto/fde_textout.h
@@ -16,7 +16,6 @@
#include "core/fxge/cfx_renderdevice.h"
#include "core/fxge/fx_dib.h"
#include "xfa/fde/fde_object.h"
-#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#define FDE_TTOSTYLE_Underline 0x0001
diff --git a/xfa/fde/xml/fde_xml_imp.h b/xfa/fde/xml/fde_xml_imp.h
index 216d6f7300..d9ccbea506 100644
--- a/xfa/fde/xml/fde_xml_imp.h
+++ b/xfa/fde/xml/fde_xml_imp.h
@@ -11,10 +11,10 @@
#include <stack>
#include <vector>
+#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_system.h"
#include "xfa/fde/xml/fde_xml.h"
#include "xfa/fgas/crt/fgas_stream.h"
-#include "xfa/fgas/crt/fgas_utils.h"
class CFDE_BlockBuffer;
class CFDE_XMLInstruction;
diff --git a/xfa/fgas/crt/fgas_utils.cpp b/xfa/fgas/crt/fgas_utils.cpp
deleted file mode 100644
index 5b7c72f6a4..0000000000
--- a/xfa/fgas/crt/fgas_utils.cpp
+++ /dev/null
@@ -1,77 +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 "xfa/fgas/crt/fgas_utils.h"
-
-#include <algorithm>
-
-#include "core/fxcrt/fx_basic.h"
-
-struct FX_BASEDISCRETEARRAYDATA {
- int32_t iBlockSize;
- int32_t iChunkSize;
- int32_t iChunkCount;
- CFX_ArrayTemplate<uint8_t*> ChunkBuffer;
-};
-
-CFX_BaseDiscreteArray::CFX_BaseDiscreteArray(int32_t iChunkSize,
- int32_t iBlockSize) {
- ASSERT(iChunkSize > 0 && iBlockSize > 0);
- FX_BASEDISCRETEARRAYDATA* pData = new FX_BASEDISCRETEARRAYDATA;
- m_pData = pData;
- pData->ChunkBuffer.SetSize(16);
- pData->iChunkCount = 0;
- pData->iChunkSize = iChunkSize;
- pData->iBlockSize = iBlockSize;
-}
-CFX_BaseDiscreteArray::~CFX_BaseDiscreteArray() {
- RemoveAll();
- delete static_cast<FX_BASEDISCRETEARRAYDATA*>(m_pData);
-}
-uint8_t* CFX_BaseDiscreteArray::AddSpaceTo(int32_t index) {
- ASSERT(index > -1);
- FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
- int32_t& iChunkCount = pData->iChunkCount;
- int32_t iChunkSize = pData->iChunkSize;
- uint8_t* pChunk = nullptr;
- int32_t iChunk = index / iChunkSize;
- if (iChunk < iChunkCount) {
- pChunk = pData->ChunkBuffer.GetAt(iChunk);
- }
- if (!pChunk) {
- pChunk = FX_Alloc2D(uint8_t, iChunkSize, pData->iBlockSize);
- FXSYS_memset(pChunk, 0, iChunkSize * pData->iBlockSize);
- pData->ChunkBuffer.SetAtGrow(iChunk, pChunk);
- if (iChunkCount <= iChunk) {
- iChunkCount = iChunk + 1;
- }
- }
- return pChunk + (index % iChunkSize) * pData->iBlockSize;
-}
-uint8_t* CFX_BaseDiscreteArray::GetAt(int32_t index) const {
- ASSERT(index >= 0);
- FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
- int32_t iChunkSize = pData->iChunkSize;
- int32_t iChunk = index / iChunkSize;
- if (iChunk >= pData->iChunkCount)
- return nullptr;
-
- uint8_t* pChunk = pData->ChunkBuffer.GetAt(iChunk);
- if (!pChunk)
- return nullptr;
-
- return pChunk + (index % iChunkSize) * pData->iBlockSize;
-}
-void CFX_BaseDiscreteArray::RemoveAll() {
- FX_BASEDISCRETEARRAYDATA* pData = (FX_BASEDISCRETEARRAYDATA*)m_pData;
- CFX_ArrayTemplate<uint8_t*>& ChunkBuffer = pData->ChunkBuffer;
- int32_t& iChunkCount = pData->iChunkCount;
- for (int32_t i = 0; i < iChunkCount; i++)
- FX_Free(ChunkBuffer.GetAt(i));
-
- ChunkBuffer.RemoveAll();
- iChunkCount = 0;
-}
diff --git a/xfa/fgas/crt/fgas_utils.h b/xfa/fgas/crt/fgas_utils.h
deleted file mode 100644
index 85f5e47310..0000000000
--- a/xfa/fgas/crt/fgas_utils.h
+++ /dev/null
@@ -1,42 +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
-
-#ifndef XFA_FGAS_CRT_FGAS_UTILS_H_
-#define XFA_FGAS_CRT_FGAS_UTILS_H_
-
-#include "core/fxcrt/fx_coordinates.h"
-
-class CFX_BaseDiscreteArray {
- protected:
- CFX_BaseDiscreteArray(int32_t iChunkSize, int32_t iBlockSize);
- ~CFX_BaseDiscreteArray();
-
- uint8_t* AddSpaceTo(int32_t index);
- uint8_t* GetAt(int32_t index) const;
- void RemoveAll();
- void* m_pData;
-};
-
-template <class baseType>
-class CFX_DiscreteArrayTemplate : public CFX_BaseDiscreteArray {
- public:
- explicit CFX_DiscreteArrayTemplate(int32_t iChunkSize)
- : CFX_BaseDiscreteArray(iChunkSize, sizeof(baseType)) {}
-
- baseType& GetAt(int32_t index, const baseType& defValue) const {
- baseType* p = (baseType*)CFX_BaseDiscreteArray::GetAt(index);
- return p ? *p : (baseType&)defValue;
- }
- baseType* GetPtrAt(int32_t index) const {
- return (baseType*)CFX_BaseDiscreteArray::GetAt(index);
- }
- void SetAtGrow(int32_t index, const baseType& element) {
- *(baseType*)CFX_BaseDiscreteArray::AddSpaceTo(index) = element;
- }
- void RemoveAll() { CFX_BaseDiscreteArray::RemoveAll(); }
-};
-
-#endif // XFA_FGAS_CRT_FGAS_UTILS_H_
diff --git a/xfa/fgas/font/cfgas_fontmgr.h b/xfa/fgas/font/cfgas_fontmgr.h
index dffdb8a665..23ab523e78 100644
--- a/xfa/fgas/font/cfgas_fontmgr.h
+++ b/xfa/fgas/font/cfgas_fontmgr.h
@@ -21,10 +21,6 @@
#include "third_party/freetype/include/freetype/fttypes.h"
#include "xfa/fgas/crt/fgas_stream.h"
-#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-#include "xfa/fgas/crt/fgas_utils.h"
-#endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
-
#define FX_FONTSTYLE_Normal 0x00
#define FX_FONTSTYLE_FixedPitch 0x01
#define FX_FONTSTYLE_Serif 0x02
diff --git a/xfa/fgas/font/cfgas_gefont.cpp b/xfa/fgas/font/cfgas_gefont.cpp
index a57962d084..2d5a927cde 100644
--- a/xfa/fgas/font/cfgas_gefont.cpp
+++ b/xfa/fgas/font/cfgas_gefont.cpp
@@ -216,10 +216,6 @@ bool CFGAS_GEFont::InitFont() {
if (!m_pFontEncoding)
return false;
}
- if (!m_pCharWidthMap) {
- m_pCharWidthMap =
- pdfium::MakeUnique<CFX_DiscreteArrayTemplate<uint16_t>>(1024);
- }
return true;
}
@@ -273,8 +269,8 @@ bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode,
int32_t& iWidth,
bool bRecursive,
bool bCharCode) {
- ASSERT(m_pCharWidthMap);
- iWidth = m_pCharWidthMap->GetAt(wUnicode, 0);
+ auto it = m_CharWidthMap.find(wUnicode);
+ iWidth = it != m_CharWidthMap.end() ? it->second : 0;
if (iWidth == 65535)
return false;
@@ -299,7 +295,7 @@ bool CFGAS_GEFont::GetCharWidthInternal(FX_WCHAR wUnicode,
iWidth = -1;
}
}
- m_pCharWidthMap->SetAtGrow(wUnicode, iWidth);
+ m_CharWidthMap[wUnicode] = iWidth;
return iWidth > 0;
}
diff --git a/xfa/fgas/font/cfgas_gefont.h b/xfa/fgas/font/cfgas_gefont.h
index 2201721a93..0a8e7bad76 100644
--- a/xfa/fgas/font/cfgas_gefont.h
+++ b/xfa/fgas/font/cfgas_gefont.h
@@ -13,7 +13,6 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_memory.h"
-#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/font/cfgas_fontmgr.h"
#define FXFONT_SUBST_ITALIC 0x02
@@ -108,7 +107,7 @@ class CFGAS_GEFont : public CFX_Retainable {
CFX_RetainPtr<IFGAS_Stream> m_pStream;
CFX_RetainPtr<IFX_SeekableReadStream> m_pFileRead;
std::unique_ptr<CFX_UnicodeEncoding> m_pFontEncoding;
- std::unique_ptr<CFX_DiscreteArrayTemplate<uint16_t>> m_pCharWidthMap;
+ std::map<FX_WCHAR, int32_t> m_CharWidthMap;
std::map<FX_WCHAR, CFX_Rect> m_BBoxMap;
CXFA_PDFFontMgr* m_pProvider; // not owned.
std::vector<CFX_RetainPtr<CFGAS_GEFont>> m_SubstFonts;
diff --git a/xfa/fgas/layout/fgas_linebreak.h b/xfa/fgas/layout/fgas_linebreak.h
index 99333dfa47..918c2e5caf 100644
--- a/xfa/fgas/layout/fgas_linebreak.h
+++ b/xfa/fgas/layout/fgas_linebreak.h
@@ -8,7 +8,6 @@
#define XFA_FGAS_LAYOUT_FGAS_LINEBREAK_H_
#include "core/fxcrt/fx_system.h"
-#include "xfa/fgas/crt/fgas_utils.h"
enum FX_LINEBREAKTYPE : uint8_t {
FX_LBT_UNKNOWN = 0x00,
diff --git a/xfa/fgas/layout/fgas_rtfbreak.h b/xfa/fgas/layout/fgas_rtfbreak.h
index 9d4d29b034..d71eeeef17 100644
--- a/xfa/fgas/layout/fgas_rtfbreak.h
+++ b/xfa/fgas/layout/fgas_rtfbreak.h
@@ -13,7 +13,6 @@
#include "core/fxcrt/cfx_retain_ptr.h"
#include "core/fxcrt/fx_basic.h"
#include "core/fxcrt/fx_ucd.h"
-#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fgas/layout/fgas_textbreak.h"
class CFGAS_GEFont;
diff --git a/xfa/fgas/layout/fgas_textbreak.h b/xfa/fgas/layout/fgas_textbreak.h
index aebb25ffa6..c023955aab 100644
--- a/xfa/fgas/layout/fgas_textbreak.h
+++ b/xfa/fgas/layout/fgas_textbreak.h
@@ -15,7 +15,6 @@
#include "core/fxge/cfx_renderdevice.h"
#include "third_party/base/stl_util.h"
#include "xfa/fde/cfde_txtedtpage.h"
-#include "xfa/fgas/crt/fgas_utils.h"
class CFX_Char;
class CFGAS_GEFont;
diff --git a/xfa/fxfa/parser/xfa_object.h b/xfa/fxfa/parser/xfa_object.h
index 8bdd264c92..e4f7ab2cb1 100644
--- a/xfa/fxfa/parser/xfa_object.h
+++ b/xfa/fxfa/parser/xfa_object.h
@@ -9,6 +9,7 @@
#include <map>
+#include "core/fxcrt/fx_basic.h"
#include "fxjs/cfxjse_arguments.h"
#include "xfa/fde/xml/fde_xml.h"
#include "xfa/fxfa/parser/xfa_utils.h"
diff --git a/xfa/fxfa/parser/xfa_utils.h b/xfa/fxfa/parser/xfa_utils.h
index 865d0c9fae..3e95612132 100644
--- a/xfa/fxfa/parser/xfa_utils.h
+++ b/xfa/fxfa/parser/xfa_utils.h
@@ -9,7 +9,6 @@
#include "xfa/fde/xml/fde_xml.h"
#include "xfa/fgas/crt/fgas_stream.h"
-#include "xfa/fgas/crt/fgas_utils.h"
#include "xfa/fxfa/fxfa_basic.h"
class CFDE_XMLElement;