summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2016-02-26 13:17:56 -0800
committerTom Sepez <tsepez@chromium.org>2016-02-26 13:17:56 -0800
commit566b974287ce0e81a963138152b8898f22480f52 (patch)
treeb85991aee92475549d84e8cb68702960b85d1252 /core
parent3b8fdd34bdf57ec45291b77008a43249f838efcb (diff)
downloadpdfium-566b974287ce0e81a963138152b8898f22480f52.tar.xz
Revert "Replace CPDF_Rect and CPDF_Point with CFX types."
This reverts commit 3b8fdd34bdf57ec45291b77008a43249f838efcb. TBR=thestig@chromium.org Review URL: https://codereview.chromium.org/1743753002 .
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_parser.h19
-rw-r--r--core/include/fpdfdoc/fpdf_ap.h4
-rw-r--r--core/include/fpdfdoc/fpdf_vt.h21
-rw-r--r--core/include/fpdftext/fpdf_text.h2
-rw-r--r--core/include/fxcrt/fx_coordinates.h9
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp28
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp10
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp6
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp76
-rw-r--r--core/src/fpdfdoc/doc_link.cpp4
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp26
-rw-r--r--core/src/fpdfdoc/pdf_vt.h58
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp4
-rw-r--r--core/src/fpdftext/text_int.h2
15 files changed, 137 insertions, 134 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index c57d9f20b9..9fa05c75ed 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -672,11 +672,26 @@ class CPDF_StandardCryptoHandler : public CPDF_CryptoHandler {
FX_BOOL bEncrypt);
uint8_t m_EncryptKey[32];
+
int m_KeyLen;
+
int m_Cipher;
+
uint8_t* m_pAESContext;
};
+class CPDF_Point {
+ public:
+ CPDF_Point(FX_FLOAT xx, FX_FLOAT yy) {
+ x = xx;
+ y = yy;
+ }
+
+ FX_FLOAT x;
+ FX_FLOAT y;
+};
+
+#define CPDF_Rect CFX_FloatRect
CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig);
CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig);
CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
@@ -687,21 +702,23 @@ CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
CFX_ByteString PDF_EncodeText(const FX_WCHAR* pString, int len = -1);
CFX_ByteString PDF_EncodeText(const CFX_WideString& str);
+FX_FLOAT PDF_ClipFloat(FX_FLOAT f);
class CFDF_Document : public CPDF_IndirectObjectHolder {
public:
static CFDF_Document* CreateNewDoc();
static CFDF_Document* ParseFile(IFX_FileRead* pFile,
FX_BOOL bOwnFile = FALSE);
static CFDF_Document* ParseMemory(const uint8_t* pData, FX_DWORD size);
+
~CFDF_Document();
FX_BOOL WriteBuf(CFX_ByteTextBuf& buf) const;
+
CPDF_Dictionary* GetRoot() const { return m_pRootDict; }
protected:
CFDF_Document();
void ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile);
-
CPDF_Dictionary* m_pRootDict;
IFX_FileRead* m_pFile;
FX_BOOL m_bOwnFile;
diff --git a/core/include/fpdfdoc/fpdf_ap.h b/core/include/fpdfdoc/fpdf_ap.h
index 5f2a3005ea..f9ade57d97 100644
--- a/core/include/fpdfdoc/fpdf_ap.h
+++ b/core/include/fpdfdoc/fpdf_ap.h
@@ -81,12 +81,12 @@ class CPVT_GenerateAP {
static CFX_ByteString GenerateEditAP(IPVT_FontMap* pFontMap,
IPDF_VariableText_Iterator* pIterator,
- const CFX_FloatPoint& ptOffset,
+ const CPDF_Point& ptOffset,
FX_BOOL bContinuous,
FX_WORD SubWord = 0,
const CPVT_WordRange* pVisible = NULL);
- static CFX_ByteString GenerateBorderAP(const CFX_FloatRect& rect,
+ static CFX_ByteString GenerateBorderAP(const CPDF_Rect& rect,
FX_FLOAT fWidth,
const CPVT_Color& color,
const CPVT_Color& crLeftTop,
diff --git a/core/include/fpdfdoc/fpdf_vt.h b/core/include/fpdfdoc/fpdf_vt.h
index b2e64cd2ed..91a93884e8 100644
--- a/core/include/fpdfdoc/fpdf_vt.h
+++ b/core/include/fpdfdoc/fpdf_vt.h
@@ -226,7 +226,7 @@ struct CPVT_Word {
CPVT_WordPlace WordPlace;
- CFX_FloatPoint ptWord;
+ CPDF_Point ptWord;
FX_FLOAT fAscent;
@@ -248,7 +248,7 @@ struct CPVT_Line {
CPVT_WordPlace lineEnd;
- CFX_FloatPoint ptLine;
+ CPDF_Point ptLine;
FX_FLOAT fLineWidth;
@@ -259,7 +259,7 @@ struct CPVT_Line {
struct CPVT_Section {
CPVT_WordPlace secplace;
- CFX_FloatRect rcSection;
+ CPDF_Rect rcSection;
CPVT_SecProps SecProps;
@@ -328,7 +328,7 @@ class IPDF_VariableText {
virtual IPDF_VariableText_Iterator* GetIterator() = 0;
- virtual void SetPlateRect(const CFX_FloatRect& rect) = 0;
+ virtual void SetPlateRect(const CPDF_Rect& rect) = 0;
virtual void SetAlignment(int32_t nFormat = 0) = 0;
@@ -395,9 +395,9 @@ class IPDF_VariableText {
virtual CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) = 0;
- virtual const CFX_FloatRect& GetPlateRect() const = 0;
+ virtual const CPDF_Rect& GetPlateRect() const = 0;
- virtual CFX_FloatRect GetContentRect() const = 0;
+ virtual CPDF_Rect GetContentRect() const = 0;
virtual int32_t GetTotalWords() const = 0;
@@ -427,14 +427,13 @@ class IPDF_VariableText {
virtual CPVT_WordPlace GetNextWordPlace(
const CPVT_WordPlace& place) const = 0;
- virtual CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const = 0;
+ virtual CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const = 0;
virtual CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
- const CFX_FloatPoint& point) const = 0;
+ const CPDF_Point& point) const = 0;
- virtual CPVT_WordPlace GetDownWordPlace(
- const CPVT_WordPlace& place,
- const CFX_FloatPoint& point) const = 0;
+ virtual CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place,
+ const CPDF_Point& point) const = 0;
virtual CPVT_WordPlace GetLineBeginPlace(
const CPVT_WordPlace& place) const = 0;
diff --git a/core/include/fpdftext/fpdf_text.h b/core/include/fpdftext/fpdf_text.h
index 7c1cde6051..498b6235c3 100644
--- a/core/include/fpdftext/fpdf_text.h
+++ b/core/include/fpdftext/fpdf_text.h
@@ -58,7 +58,7 @@ class IPDF_TextPage {
virtual void GetRectArray(int start,
int nCount,
CFX_RectArray& rectArray) const = 0;
- virtual int GetIndexAtPos(CFX_FloatPoint point,
+ virtual int GetIndexAtPos(CPDF_Point point,
FX_FLOAT xTolerance,
FX_FLOAT yTolerance) const = 0;
virtual int GetIndexAtPos(FX_FLOAT x,
diff --git a/core/include/fxcrt/fx_coordinates.h b/core/include/fxcrt/fx_coordinates.h
index 4bafb63099..053d637689 100644
--- a/core/include/fxcrt/fx_coordinates.h
+++ b/core/include/fxcrt/fx_coordinates.h
@@ -415,15 +415,6 @@ struct FX_SMALL_RECT {
int16_t Bottom;
};
-
-class CFX_FloatPoint {
- public:
- CFX_FloatPoint(FX_FLOAT xx, FX_FLOAT yy) : x(xx), y(xx) {}
-
- FX_FLOAT x;
- FX_FLOAT y;
-};
-
class CFX_FloatRect {
public:
CFX_FloatRect() { left = right = bottom = top = 0; }
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index 44492b1a54..de3a6572f2 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -6,8 +6,6 @@
#include "core/src/fpdfapi/fpdf_page/pageint.h"
-#include <algorithm>
-
#include "core/include/fpdfapi/fpdf_module.h"
#include "core/include/fpdfapi/fpdf_page.h"
#include "core/include/fpdfapi/fpdf_pageobj.h"
@@ -15,14 +13,6 @@
#include "core/src/fpdfapi/fpdf_render/render_int.h"
#include "third_party/base/stl_util.h"
-namespace {
-
-FX_FLOAT ClipFloat(FX_FLOAT f) {
- return std::max(0.0f, std::min(1.0f, f));
-}
-
-} // namespace
-
void CPDF_GraphicStates::DefaultStates() {
m_ColorState.New()->Default();
}
@@ -95,21 +85,21 @@ void CPDF_ClipPathData::SetCount(int path_count, int text_count) {
m_pTextList = FX_Alloc(CPDF_TextObject*, text_count);
}
}
-CFX_FloatRect CPDF_ClipPath::GetClipBox() const {
- CFX_FloatRect rect;
+CPDF_Rect CPDF_ClipPath::GetClipBox() const {
+ CPDF_Rect rect;
FX_BOOL bStarted = FALSE;
int count = GetPathCount();
if (count) {
rect = GetPath(0).GetBoundingBox();
for (int i = 1; i < count; i++) {
- CFX_FloatRect path_rect = GetPath(i).GetBoundingBox();
+ CPDF_Rect path_rect = GetPath(i).GetBoundingBox();
rect.Intersect(path_rect);
}
bStarted = TRUE;
}
count = GetTextCount();
if (count) {
- CFX_FloatRect layer_rect;
+ CPDF_Rect layer_rect;
FX_BOOL bLayerStarted = FALSE;
for (int i = 0; i < count; i++) {
CPDF_TextObject* pTextObj = GetText(i);
@@ -138,9 +128,9 @@ void CPDF_ClipPath::AppendPath(CPDF_Path path, int type, FX_BOOL bAutoMerge) {
if (pData->m_PathCount && bAutoMerge) {
CPDF_Path old_path = pData->m_pPathList[pData->m_PathCount - 1];
if (old_path.IsRect()) {
- CFX_FloatRect old_rect(old_path.GetPointX(0), old_path.GetPointY(0),
- old_path.GetPointX(2), old_path.GetPointY(2));
- CFX_FloatRect new_rect = path.GetBoundingBox();
+ CPDF_Rect old_rect(old_path.GetPointX(0), old_path.GetPointY(0),
+ old_path.GetPointX(2), old_path.GetPointY(2));
+ CPDF_Rect new_rect = path.GetBoundingBox();
if (old_rect.Contains(new_rect)) {
pData->m_PathCount--;
pData->m_pPathList[pData->m_PathCount].SetNull();
@@ -544,10 +534,10 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
}
break;
case FXBSTR_ID('C', 'A', 0, 0):
- pGeneralState->m_StrokeAlpha = ClipFloat(pObject->GetNumber());
+ pGeneralState->m_StrokeAlpha = PDF_ClipFloat(pObject->GetNumber());
break;
case FXBSTR_ID('c', 'a', 0, 0):
- pGeneralState->m_FillAlpha = ClipFloat(pObject->GetNumber());
+ pGeneralState->m_FillAlpha = PDF_ClipFloat(pObject->GetNumber());
break;
case FXBSTR_ID('O', 'P', 0, 0):
pGeneralState->m_StrokeOP = pObject->GetInteger();
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 1df4f3db37..c47fe8bd73 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -116,7 +116,7 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
CFX_Matrix* pmtContentToUser,
CPDF_PageObjectHolder* pObjHolder,
CPDF_Dictionary* pResources,
- CFX_FloatRect* pBBox,
+ CPDF_Rect* pBBox,
CPDF_ParseOptions* pOptions,
CPDF_AllStates* pStates,
int level)
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 37b82dd564..d1a7231d45 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -363,6 +363,16 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
return buf;
}
+FX_FLOAT PDF_ClipFloat(FX_FLOAT f) {
+ if (f < 0) {
+ return 0;
+ }
+ if (f > 1.0f) {
+ return 1.0f;
+ }
+ return f;
+}
+
static CPDF_Object* SearchNumberNode(CPDF_Dictionary* pNode, int num) {
CPDF_Array* pLimits = pNode->GetArrayBy("Limits");
if (pLimits &&
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index dcd21be66e..4b0b2b54bc 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -77,7 +77,7 @@ void CPDF_AnnotList::DisplayPass(CPDF_Page* pPage,
continue;
}
}
- CFX_FloatRect annot_rect_f;
+ CPDF_Rect annot_rect_f;
pAnnot->GetRect(annot_rect_f);
CFX_Matrix matrix = *pMatrix;
if (clip_rect) {
@@ -132,7 +132,7 @@ CFX_ByteString CPDF_Annot::GetSubType() const {
return m_sSubtype;
}
-void CPDF_Annot::GetRect(CFX_FloatRect& rect) const {
+void CPDF_Annot::GetRect(CPDF_Rect& rect) const {
if (!m_pAnnotDict) {
return;
}
@@ -210,7 +210,7 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage,
CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRectBy("BBox");
CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrixBy("Matrix");
form_matrix.TransformRect(form_bbox);
- CFX_FloatRect arect;
+ CPDF_Rect arect;
pAnnot->GetRect(arect);
matrix.MatchRect(arect, form_bbox);
matrix.Concat(*pUser2Device);
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index 7fe06e2b5d..3ccf4c44d1 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -327,33 +327,33 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (!pDefFont) {
return FALSE;
}
- CFX_FloatRect rcAnnot = pAnnotDict->GetRectBy("Rect");
+ CPDF_Rect rcAnnot = pAnnotDict->GetRectBy("Rect");
int32_t nRotate = 0;
if (CPDF_Dictionary* pMKDict = pAnnotDict->GetDictBy("MK")) {
nRotate = pMKDict->GetIntegerBy("R");
}
- CFX_FloatRect rcBBox;
+ CPDF_Rect rcBBox;
CFX_Matrix matrix;
switch (nRotate % 360) {
case 0:
- rcBBox = CFX_FloatRect(0, 0, rcAnnot.right - rcAnnot.left,
- rcAnnot.top - rcAnnot.bottom);
+ rcBBox = CPDF_Rect(0, 0, rcAnnot.right - rcAnnot.left,
+ rcAnnot.top - rcAnnot.bottom);
break;
case 90:
matrix = CFX_Matrix(0, 1, -1, 0, rcAnnot.right - rcAnnot.left, 0);
- rcBBox = CFX_FloatRect(0, 0, rcAnnot.top - rcAnnot.bottom,
- rcAnnot.right - rcAnnot.left);
+ rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom,
+ rcAnnot.right - rcAnnot.left);
break;
case 180:
matrix = CFX_Matrix(-1, 0, 0, -1, rcAnnot.right - rcAnnot.left,
rcAnnot.top - rcAnnot.bottom);
- rcBBox = CFX_FloatRect(0, 0, rcAnnot.right - rcAnnot.left,
- rcAnnot.top - rcAnnot.bottom);
+ rcBBox = CPDF_Rect(0, 0, rcAnnot.right - rcAnnot.left,
+ rcAnnot.top - rcAnnot.bottom);
break;
case 270:
matrix = CFX_Matrix(0, -1, 1, 0, 0, rcAnnot.top - rcAnnot.bottom);
- rcBBox = CFX_FloatRect(0, 0, rcAnnot.top - rcAnnot.bottom,
- rcAnnot.right - rcAnnot.left);
+ rcBBox = CPDF_Rect(0, 0, rcAnnot.top - rcAnnot.bottom,
+ rcAnnot.right - rcAnnot.left);
break;
}
int32_t nBorderStyle = PBS_SOLID;
@@ -414,9 +414,9 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (sBorderStream.GetLength() > 0) {
sAppStream << "q\n" << sBorderStream << "Q\n";
}
- CFX_FloatRect rcBody =
- CFX_FloatRect(rcBBox.left + fBorderWidth, rcBBox.bottom + fBorderWidth,
- rcBBox.right - fBorderWidth, rcBBox.top - fBorderWidth);
+ CPDF_Rect rcBody =
+ CPDF_Rect(rcBBox.left + fBorderWidth, rcBBox.bottom + fBorderWidth,
+ rcBBox.right - fBorderWidth, rcBBox.top - fBorderWidth);
rcBody.Normalize();
CPDF_Dictionary* pAPDict = pAnnotDict->GetDictBy("AP");
if (!pAPDict) {
@@ -496,11 +496,11 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
vt.Initialize();
vt.SetText(swValue.c_str());
vt.RearrangeAll();
- CFX_FloatRect rcContent = vt.GetContentRect();
- CFX_FloatPoint ptOffset(0.0f, 0.0f);
+ CPDF_Rect rcContent = vt.GetContentRect();
+ CPDF_Point ptOffset(0.0f, 0.0f);
if (!bMultiLine) {
ptOffset =
- CFX_FloatPoint(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f);
+ CPDF_Point(0.0f, (rcContent.Height() - rcBody.Height()) / 2.0f);
}
CFX_ByteString sBody = CPVT_GenerateAP::GenerateEditAP(
&map, vt.GetIterator(), ptOffset, !bCharArray, subWord);
@@ -529,10 +529,10 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
CPVT_Provider prd(&map);
CPDF_VariableText vt;
vt.SetProvider(&prd);
- CFX_FloatRect rcButton = rcBody;
+ CPDF_Rect rcButton = rcBody;
rcButton.left = rcButton.right - 13;
rcButton.Normalize();
- CFX_FloatRect rcEdit = rcBody;
+ CPDF_Rect rcEdit = rcBody;
rcEdit.right = rcButton.left;
rcEdit.Normalize();
vt.SetPlateRect(rcEdit);
@@ -544,9 +544,9 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
vt.Initialize();
vt.SetText(swValue.c_str());
vt.RearrangeAll();
- CFX_FloatRect rcContent = vt.GetContentRect();
- CFX_FloatPoint ptOffset =
- CFX_FloatPoint(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
+ CPDF_Rect rcContent = vt.GetContentRect();
+ CPDF_Point ptOffset =
+ CPDF_Point(0.0f, (rcContent.Height() - rcEdit.Height()) / 2.0f);
CFX_ByteString sEdit = CPVT_GenerateAP::GenerateEditAP(
&map, vt.GetIterator(), ptOffset, TRUE, 0);
if (sEdit.GetLength() > 0) {
@@ -575,9 +575,8 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (sButtonBorder.GetLength() > 0) {
sAppStream << "q\n" << sButtonBorder << "Q\n";
}
- CFX_FloatPoint ptCenter =
- CFX_FloatPoint((rcButton.left + rcButton.right) / 2,
- (rcButton.top + rcButton.bottom) / 2);
+ CPDF_Point ptCenter = CPDF_Point((rcButton.left + rcButton.right) / 2,
+ (rcButton.top + rcButton.bottom) / 2);
if (IsFloatBigger(rcButton.Width(), 6) &&
IsFloatBigger(rcButton.Height(), 6)) {
sAppStream << "q\n"
@@ -629,8 +628,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
}
CPDF_VariableText vt;
vt.SetProvider(&prd);
- vt.SetPlateRect(
- CFX_FloatRect(rcBody.left, 0.0f, rcBody.right, 0.0f));
+ vt.SetPlateRect(CPDF_Rect(rcBody.left, 0.0f, rcBody.right, 0.0f));
if (IsFloatZero(fFontSize)) {
vt.SetFontSize(12.0f);
} else {
@@ -641,8 +639,8 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
vt.RearrangeAll();
FX_FLOAT fItemHeight = vt.GetContentRect().Height();
if (bSelected) {
- CFX_FloatRect rcItem = CFX_FloatRect(
- rcBody.left, fy - fItemHeight, rcBody.right, fy);
+ CPDF_Rect rcItem =
+ CPDF_Rect(rcBody.left, fy - fItemHeight, rcBody.right, fy);
sBody << "q\n" << CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kRGB, 0,
51.0f / 255.0f, 113.0f / 255.0f),
@@ -653,13 +651,13 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(
CPVT_Color(CPVT_Color::kGray, 1), TRUE)
<< CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
- CFX_FloatPoint(0.0f, fy),
+ CPDF_Point(0.0f, fy),
TRUE, 0)
<< "ET\n";
} else {
sBody << "BT\n" << CPVT_GenerateAP::GenerateColorAP(crText, TRUE)
<< CPVT_GenerateAP::GenerateEditAP(&map, vt.GetIterator(),
- CFX_FloatPoint(0.0f, fy),
+ CPDF_Point(0.0f, fy),
TRUE, 0)
<< "ET\n";
}
@@ -716,12 +714,12 @@ FX_BOOL CPVT_GenerateAP::GenerateListBoxAP(CPDF_Document* pDoc,
CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
IPVT_FontMap* pFontMap,
IPDF_VariableText_Iterator* pIterator,
- const CFX_FloatPoint& ptOffset,
+ const CPDF_Point& ptOffset,
FX_BOOL bContinuous,
FX_WORD SubWord,
const CPVT_WordRange* pVisible) {
CFX_ByteTextBuf sEditStream, sLineStream, sWords;
- CFX_FloatPoint ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f);
+ CPDF_Point ptOld(0.0f, 0.0f), ptNew(0.0f, 0.0f);
int32_t nCurFontIndex = -1;
if (pIterator) {
if (pVisible) {
@@ -745,13 +743,13 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
}
CPVT_Word word;
if (pIterator->GetWord(word)) {
- ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x,
- word.ptWord.y + ptOffset.y);
+ ptNew = CPDF_Point(word.ptWord.x + ptOffset.x,
+ word.ptWord.y + ptOffset.y);
} else {
CPVT_Line line;
pIterator->GetLine(line);
- ptNew = CFX_FloatPoint(line.ptLine.x + ptOffset.x,
- line.ptLine.y + ptOffset.y);
+ ptNew = CPDF_Point(line.ptLine.x + ptOffset.x,
+ line.ptLine.y + ptOffset.y);
}
if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) {
sLineStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y
@@ -777,8 +775,8 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
} else {
CPVT_Word word;
if (pIterator->GetWord(word)) {
- ptNew = CFX_FloatPoint(word.ptWord.x + ptOffset.x,
- word.ptWord.y + ptOffset.y);
+ ptNew = CPDF_Point(word.ptWord.x + ptOffset.x,
+ word.ptWord.y + ptOffset.y);
if (ptNew.x != ptOld.x || ptNew.y != ptOld.y) {
sEditStream << ptNew.x - ptOld.x << " " << ptNew.y - ptOld.y
<< " Td\n";
@@ -803,7 +801,7 @@ CFX_ByteString CPVT_GenerateAP::GenerateEditAP(
return sEditStream.GetByteString();
}
CFX_ByteString CPVT_GenerateAP::GenerateBorderAP(
- const CFX_FloatRect& rect,
+ const CPDF_Rect& rect,
FX_FLOAT fWidth,
const CPVT_Color& color,
const CPVT_Color& crLeftTop,
diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp
index 7da29e0954..6617e85cd4 100644
--- a/core/src/fpdfdoc/doc_link.cpp
+++ b/core/src/fpdfdoc/doc_link.cpp
@@ -43,7 +43,7 @@ CPDF_Link CPDF_LinkList::GetLinkAtPoint(CPDF_Page* pPage,
continue;
CPDF_Link link(pAnnot);
- CFX_FloatRect rect = link.GetRect();
+ CPDF_Rect rect = link.GetRect();
if (!rect.Contains(pdf_x, pdf_y))
continue;
@@ -68,7 +68,7 @@ void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage,
}
}
-CFX_FloatRect CPDF_Link::GetRect() {
+CPDF_Rect CPDF_Link::GetRect() {
return m_pDict->GetRectBy("Rect");
}
CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) {
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index 477df25a14..0f8a4e5320 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -166,7 +166,7 @@ void CSection::UpdateWordPlace(CPVT_WordPlace& place) const {
}
}
}
-CPVT_WordPlace CSection::SearchWordPlace(const CFX_FloatPoint& point) const {
+CPVT_WordPlace CSection::SearchWordPlace(const CPDF_Point& point) const {
ASSERT(m_pVT);
CPVT_WordPlace place = GetBeginWordPlace();
FX_BOOL bUp = TRUE;
@@ -1135,8 +1135,8 @@ CPVT_WordPlace CPDF_VariableText::GetNextWordPlace(
return place;
}
CPVT_WordPlace CPDF_VariableText::SearchWordPlace(
- const CFX_FloatPoint& point) const {
- CFX_FloatPoint pt = OutToIn(point);
+ const CPDF_Point& point) const {
+ CPDF_Point pt = OutToIn(point);
CPVT_WordPlace place = GetBeginWordPlace();
int32_t nLeft = 0;
int32_t nRight = m_SectionArray.GetSize() - 1;
@@ -1161,8 +1161,8 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(
continue;
} else {
place = pSection->SearchWordPlace(
- CFX_FloatPoint(pt.x - pSection->m_SecInfo.rcSection.left,
- pt.y - pSection->m_SecInfo.rcSection.top));
+ CPDF_Point(pt.x - pSection->m_SecInfo.rcSection.left,
+ pt.y - pSection->m_SecInfo.rcSection.top));
place.nSecIndex = nMid;
return place;
}
@@ -1180,10 +1180,10 @@ CPVT_WordPlace CPDF_VariableText::SearchWordPlace(
}
CPVT_WordPlace CPDF_VariableText::GetUpWordPlace(
const CPVT_WordPlace& place,
- const CFX_FloatPoint& point) const {
+ const CPDF_Point& point) const {
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
CPVT_WordPlace temp = place;
- CFX_FloatPoint pt = OutToIn(point);
+ CPDF_Point pt = OutToIn(point);
if (temp.nLineIndex-- > 0) {
return pSection->SearchWordPlace(
pt.x - pSection->m_SecInfo.rcSection.left, temp);
@@ -1200,10 +1200,10 @@ CPVT_WordPlace CPDF_VariableText::GetUpWordPlace(
}
CPVT_WordPlace CPDF_VariableText::GetDownWordPlace(
const CPVT_WordPlace& place,
- const CFX_FloatPoint& point) const {
+ const CPDF_Point& point) const {
if (CSection* pSection = m_SectionArray.GetAt(place.nSecIndex)) {
CPVT_WordPlace temp = place;
- CFX_FloatPoint pt = OutToIn(point);
+ CPDF_Point pt = OutToIn(point);
if (temp.nLineIndex++ < pSection->m_LineArray.GetSize() - 1) {
return pSection->SearchWordPlace(
pt.x - pSection->m_SecInfo.rcSection.left, temp);
@@ -1333,7 +1333,7 @@ FX_BOOL CPDF_VariableText::GetSectionInfo(const CPVT_WordPlace& place,
}
return FALSE;
}
-CFX_FloatRect CPDF_VariableText::GetContentRect() const {
+CPDF_Rect CPDF_VariableText::GetContentRect() const {
return InToOut(CPVT_FloatRect(CPDF_EditContainer::GetContentRect()));
}
FX_FLOAT CPDF_VariableText::GetWordFontSize(const CPVT_WordInfo& WordInfo,
@@ -1753,8 +1753,8 @@ FX_BOOL CPDF_VariableText_Iterator::GetWord(CPVT_Word& word) const {
word.nCharset = pWord->nCharset;
word.fWidth = m_pVT->GetWordWidth(*pWord);
word.ptWord = m_pVT->InToOut(
- CFX_FloatPoint(pWord->fWordX + pSection->m_SecInfo.rcSection.left,
- pWord->fWordY + pSection->m_SecInfo.rcSection.top));
+ CPDF_Point(pWord->fWordX + pSection->m_SecInfo.rcSection.left,
+ pWord->fWordY + pSection->m_SecInfo.rcSection.top));
word.fAscent = m_pVT->GetWordAscent(*pWord);
word.fDescent = m_pVT->GetWordDescent(*pWord);
if (pWord->pWordProps) {
@@ -1785,7 +1785,7 @@ FX_BOOL CPDF_VariableText_Iterator::GetLine(CPVT_Line& line) const {
line.lineplace = CPVT_WordPlace(m_CurPos.nSecIndex, m_CurPos.nLineIndex, -1);
if (CSection* pSection = m_pVT->m_SectionArray.GetAt(m_CurPos.nSecIndex)) {
if (CLine* pLine = pSection->m_LineArray.GetAt(m_CurPos.nLineIndex)) {
- line.ptLine = m_pVT->InToOut(CFX_FloatPoint(
+ line.ptLine = m_pVT->InToOut(CPDF_Point(
pLine->m_LineInfo.fLineX + pSection->m_SecInfo.rcSection.left,
pLine->m_LineInfo.fLineY + pSection->m_SecInfo.rcSection.top));
line.fLineWidth = pLine->m_LineInfo.fLineWidth;
diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h
index 13ec71a125..286fad5772 100644
--- a/core/src/fpdfdoc/pdf_vt.h
+++ b/core/src/fpdfdoc/pdf_vt.h
@@ -44,7 +44,7 @@ class CPVT_FloatRect : public CFX_FloatRect {
right = other_right;
bottom = other_bottom;
}
- explicit CPVT_FloatRect(const CFX_FloatRect& rect) {
+ explicit CPVT_FloatRect(const CPDF_Rect& rect) {
left = rect.left;
top = rect.top;
right = rect.right;
@@ -257,7 +257,7 @@ class CSection {
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const;
CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const;
void UpdateWordPlace(CPVT_WordPlace& place) const;
- CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const;
+ CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const;
CPVT_WordPlace SearchWordPlace(FX_FLOAT fx,
const CPVT_WordPlace& lineplace) const;
CPVT_WordPlace SearchWordPlace(FX_FLOAT fx,
@@ -296,46 +296,44 @@ class CPDF_EditContainer {
public:
CPDF_EditContainer() : m_rcPlate(0, 0, 0, 0), m_rcContent(0, 0, 0, 0) {}
virtual ~CPDF_EditContainer() {}
- virtual void SetPlateRect(const CFX_FloatRect& rect) { m_rcPlate = rect; }
- virtual const CFX_FloatRect& GetPlateRect() const { return m_rcPlate; }
+ virtual void SetPlateRect(const CPDF_Rect& rect) { m_rcPlate = rect; }
+ virtual const CPDF_Rect& GetPlateRect() const { return m_rcPlate; }
virtual void SetContentRect(const CPVT_FloatRect& rect) {
m_rcContent = rect;
}
- virtual CFX_FloatRect GetContentRect() const { return m_rcContent; }
+ virtual CPDF_Rect GetContentRect() const { return m_rcContent; }
FX_FLOAT GetPlateWidth() const { return m_rcPlate.right - m_rcPlate.left; }
FX_FLOAT GetPlateHeight() const { return m_rcPlate.top - m_rcPlate.bottom; }
CPVT_Size GetPlateSize() const {
return CPVT_Size(GetPlateWidth(), GetPlateHeight());
}
- CFX_FloatPoint GetBTPoint() const {
- return CFX_FloatPoint(m_rcPlate.left, m_rcPlate.top);
+ CPDF_Point GetBTPoint() const {
+ return CPDF_Point(m_rcPlate.left, m_rcPlate.top);
}
- CFX_FloatPoint GetETPoint() const {
- return CFX_FloatPoint(m_rcPlate.right, m_rcPlate.bottom);
+ CPDF_Point GetETPoint() const {
+ return CPDF_Point(m_rcPlate.right, m_rcPlate.bottom);
}
- inline CFX_FloatPoint InToOut(const CFX_FloatPoint& point) const {
- return CFX_FloatPoint(point.x + GetBTPoint().x, GetBTPoint().y - point.y);
+ inline CPDF_Point InToOut(const CPDF_Point& point) const {
+ return CPDF_Point(point.x + GetBTPoint().x, GetBTPoint().y - point.y);
}
- inline CFX_FloatPoint OutToIn(const CFX_FloatPoint& point) const {
- return CFX_FloatPoint(point.x - GetBTPoint().x, GetBTPoint().y - point.y);
+ inline CPDF_Point OutToIn(const CPDF_Point& point) const {
+ return CPDF_Point(point.x - GetBTPoint().x, GetBTPoint().y - point.y);
}
- inline CFX_FloatRect InToOut(const CPVT_FloatRect& rect) const {
- CFX_FloatPoint ptLeftTop = InToOut(CFX_FloatPoint(rect.left, rect.top));
- CFX_FloatPoint ptRightBottom =
- InToOut(CFX_FloatPoint(rect.right, rect.bottom));
- return CFX_FloatRect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x,
- ptLeftTop.y);
+ inline CPDF_Rect InToOut(const CPVT_FloatRect& rect) const {
+ CPDF_Point ptLeftTop = InToOut(CPDF_Point(rect.left, rect.top));
+ CPDF_Point ptRightBottom = InToOut(CPDF_Point(rect.right, rect.bottom));
+ return CPDF_Rect(ptLeftTop.x, ptRightBottom.y, ptRightBottom.x,
+ ptLeftTop.y);
}
- inline CPVT_FloatRect OutToIn(const CFX_FloatRect& rect) const {
- CFX_FloatPoint ptLeftTop = OutToIn(CFX_FloatPoint(rect.left, rect.top));
- CFX_FloatPoint ptRightBottom =
- OutToIn(CFX_FloatPoint(rect.right, rect.bottom));
+ inline CPVT_FloatRect OutToIn(const CPDF_Rect& rect) const {
+ CPDF_Point ptLeftTop = OutToIn(CPDF_Point(rect.left, rect.top));
+ CPDF_Point ptRightBottom = OutToIn(CPDF_Point(rect.right, rect.bottom));
return CPVT_FloatRect(ptLeftTop.x, ptLeftTop.y, ptRightBottom.x,
ptRightBottom.y);
}
private:
- CFX_FloatRect m_rcPlate;
+ CPDF_Rect m_rcPlate;
CPVT_FloatRect m_rcContent;
};
@@ -352,7 +350,7 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer {
IPDF_VariableText_Provider* SetProvider(
IPDF_VariableText_Provider* pProvider) override;
IPDF_VariableText_Iterator* GetIterator() override;
- void SetPlateRect(const CFX_FloatRect& rect) override {
+ void SetPlateRect(const CPDF_Rect& rect) override {
CPDF_EditContainer::SetPlateRect(rect);
}
void SetAlignment(int32_t nFormat = 0) override { m_nAlignment = nFormat; }
@@ -409,10 +407,10 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer {
CPVT_WordPlace DeleteWords(const CPVT_WordRange& PlaceRange) override;
CPVT_WordPlace DeleteWord(const CPVT_WordPlace& place) override;
CPVT_WordPlace BackSpaceWord(const CPVT_WordPlace& place) override;
- const CFX_FloatRect& GetPlateRect() const override {
+ const CPDF_Rect& GetPlateRect() const override {
return CPDF_EditContainer::GetPlateRect();
}
- CFX_FloatRect GetContentRect() const override;
+ CPDF_Rect GetContentRect() const override;
int32_t GetTotalWords() const override;
FX_FLOAT GetFontSize() const override { return m_fFontSize; }
int32_t GetAlignment() const override { return m_nAlignment; }
@@ -426,11 +424,11 @@ class CPDF_VariableText : public IPDF_VariableText, private CPDF_EditContainer {
CPVT_WordPlace GetEndWordPlace() const override;
CPVT_WordPlace GetPrevWordPlace(const CPVT_WordPlace& place) const override;
CPVT_WordPlace GetNextWordPlace(const CPVT_WordPlace& place) const override;
- CPVT_WordPlace SearchWordPlace(const CFX_FloatPoint& point) const override;
+ CPVT_WordPlace SearchWordPlace(const CPDF_Point& point) const override;
CPVT_WordPlace GetUpWordPlace(const CPVT_WordPlace& place,
- const CFX_FloatPoint& point) const override;
+ const CPDF_Point& point) const override;
CPVT_WordPlace GetDownWordPlace(const CPVT_WordPlace& place,
- const CFX_FloatPoint& point) const override;
+ const CPDF_Point& point) const override;
CPVT_WordPlace GetLineBeginPlace(const CPVT_WordPlace& place) const override;
CPVT_WordPlace GetLineEndPlace(const CPVT_WordPlace& place) const override;
CPVT_WordPlace GetSectionBeginPlace(
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index 77b610a7e8..8e2eae1251 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -301,7 +301,7 @@ void CPDF_TextPage::GetRectArray(int start,
rectArray.Add(rect);
}
-int CPDF_TextPage::GetIndexAtPos(CFX_FloatPoint point,
+int CPDF_TextPage::GetIndexAtPos(CPDF_Point point,
FX_FLOAT xTolerance,
FX_FLOAT yTolerance) const {
if (!m_bIsParsed)
@@ -424,7 +424,7 @@ int CPDF_TextPage::GetIndexAtPos(FX_FLOAT x,
FX_FLOAT y,
FX_FLOAT xTolerance,
FX_FLOAT yTolerance) const {
- CFX_FloatPoint point(x, y);
+ CPDF_Point point(x, y);
return GetIndexAtPos(point, xTolerance, yTolerance);
}
diff --git a/core/src/fpdftext/text_int.h b/core/src/fpdftext/text_int.h
index ef742a38be..113e1d1ac8 100644
--- a/core/src/fpdftext/text_int.h
+++ b/core/src/fpdftext/text_int.h
@@ -67,7 +67,7 @@ class CPDF_TextPage : public IPDF_TextPage {
void GetRectArray(int start,
int nCount,
CFX_RectArray& rectArray) const override;
- int GetIndexAtPos(CFX_FloatPoint point,
+ int GetIndexAtPos(CPDF_Point point,
FX_FLOAT xTolerance,
FX_FLOAT yTolerance) const override;
int GetIndexAtPos(FX_FLOAT x,