Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(14)

Unified Diff: fpdfsdk/src/fpdf_flatten.cpp

Issue 1737593006: Re-land "Replace CPDF_Rect and CPDF_Point with CFX types." (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Ooops. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_TextField.cpp ('k') | fpdfsdk/src/fpdfdoc.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fpdfsdk/src/fpdf_flatten.cpp
diff --git a/fpdfsdk/src/fpdf_flatten.cpp b/fpdfsdk/src/fpdf_flatten.cpp
index 9aee35f7608ebfea531152edef7b1048d0b4e825..759f758e5ef56ef26d26ef2d880af77cb7a92aa9 100644
--- a/fpdfsdk/src/fpdf_flatten.cpp
+++ b/fpdfsdk/src/fpdf_flatten.cpp
@@ -11,12 +11,12 @@
#include "fpdfsdk/include/fsdk_define.h"
typedef CFX_ArrayTemplate<CPDF_Dictionary*> CPDF_ObjectArray;
-typedef CFX_ArrayTemplate<CPDF_Rect> CPDF_RectArray;
+typedef CFX_ArrayTemplate<CFX_FloatRect> CPDF_RectArray;
enum FPDF_TYPE { MAX, MIN };
enum FPDF_VALUE { TOP, LEFT, RIGHT, BOTTOM };
-FX_BOOL IsValiableRect(CPDF_Rect rect, CPDF_Rect rcPage) {
+FX_BOOL IsValiableRect(CFX_FloatRect rect, CFX_FloatRect rcPage) {
if (rect.left - rect.right > 0.000001f || rect.bottom - rect.top > 0.000001f)
return FALSE;
@@ -46,7 +46,7 @@ void GetContentsRect(CPDF_Document* pDoc,
if (!pPageObject)
continue;
- CPDF_Rect rc;
+ CFX_FloatRect rc;
rc.left = pPageObject->m_Left;
rc.right = pPageObject->m_Right;
rc.bottom = pPageObject->m_Bottom;
@@ -62,7 +62,7 @@ void ParserStream(CPDF_Dictionary* pPageDic,
CPDF_ObjectArray* pObjectArray) {
if (!pStream)
return;
- CPDF_Rect rect;
+ CFX_FloatRect rect;
if (pStream->KeyExist("Rect"))
rect = pStream->GetRectBy("Rect");
else if (pStream->KeyExist("BBox"))
@@ -127,25 +127,25 @@ FX_FLOAT GetMinMaxValue(CPDF_RectArray& array,
switch (value) {
case LEFT: {
for (int i = 0; i < nRects; i++)
- pArray[i] = CPDF_Rect(array.GetAt(i)).left;
+ pArray[i] = CFX_FloatRect(array.GetAt(i)).left;
break;
}
case TOP: {
for (int i = 0; i < nRects; i++)
- pArray[i] = CPDF_Rect(array.GetAt(i)).top;
+ pArray[i] = CFX_FloatRect(array.GetAt(i)).top;
break;
}
case RIGHT: {
for (int i = 0; i < nRects; i++)
- pArray[i] = CPDF_Rect(array.GetAt(i)).right;
+ pArray[i] = CFX_FloatRect(array.GetAt(i)).right;
break;
}
case BOTTOM: {
for (int i = 0; i < nRects; i++)
- pArray[i] = CPDF_Rect(array.GetAt(i)).bottom;
+ pArray[i] = CFX_FloatRect(array.GetAt(i)).bottom;
break;
}
@@ -166,8 +166,8 @@ FX_FLOAT GetMinMaxValue(CPDF_RectArray& array,
return fRet;
}
-CPDF_Rect CalculateRect(CPDF_RectArray* pRectArray) {
- CPDF_Rect rcRet;
+CFX_FloatRect CalculateRect(CPDF_RectArray* pRectArray) {
+ CFX_FloatRect rcRet;
rcRet.left = GetMinMaxValue(*pRectArray, MIN, LEFT);
rcRet.top = GetMinMaxValue(*pRectArray, MAX, TOP);
@@ -245,8 +245,8 @@ void SetPageContents(CFX_ByteString key,
}
}
-CFX_Matrix GetMatrix(CPDF_Rect rcAnnot,
- CPDF_Rect rcStream,
+CFX_Matrix GetMatrix(CFX_FloatRect rcAnnot,
+ CFX_FloatRect rcStream,
const CFX_Matrix& matrix) {
if (rcStream.IsEmpty())
return CFX_Matrix();
@@ -266,8 +266,8 @@ void GetOffset(FX_FLOAT& fa,
FX_FLOAT& fd,
FX_FLOAT& fe,
FX_FLOAT& ff,
- CPDF_Rect rcAnnot,
- CPDF_Rect rcStream,
+ CFX_FloatRect rcAnnot,
+ CFX_FloatRect rcStream,
const CFX_Matrix& matrix) {
FX_FLOAT fStreamWidth = 0.0f;
FX_FLOAT fStreamHeight = 0.0f;
@@ -323,15 +323,15 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
if (iRet == FLATTEN_NOTHINGTODO || iRet == FLATTEN_FAIL)
return iRet;
- CPDF_Rect rcOriginalCB;
- CPDF_Rect rcMerger = CalculateRect(&RectArray);
- CPDF_Rect rcOriginalMB = pPageDict->GetRectBy("MediaBox");
+ CFX_FloatRect rcOriginalCB;
+ CFX_FloatRect rcMerger = CalculateRect(&RectArray);
+ CFX_FloatRect rcOriginalMB = pPageDict->GetRectBy("MediaBox");
if (pPageDict->KeyExist("CropBox"))
rcOriginalMB = pPageDict->GetRectBy("CropBox");
if (rcOriginalMB.IsEmpty()) {
- rcOriginalMB = CPDF_Rect(0.0f, 0.0f, 612.0f, 792.0f);
+ rcOriginalMB = CFX_FloatRect(0.0f, 0.0f, 612.0f, 792.0f);
}
rcMerger.left =
@@ -407,7 +407,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
pNewOXbjectDic->SetAtName("Subtype", "Form");
pNewOXbjectDic->SetAtInteger("FormType", 1);
pNewOXbjectDic->SetAtName("Name", "FRM");
- CPDF_Rect rcBBox = pPageDict->GetRectBy("ArtBox");
+ CFX_FloatRect rcBBox = pPageDict->GetRectBy("ArtBox");
pNewOXbjectDic->SetAtRect("BBox", rcBBox);
}
@@ -416,7 +416,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
if (!pAnnotDic)
continue;
- CPDF_Rect rcAnnot = pAnnotDic->GetRectBy("Rect");
+ CFX_FloatRect rcAnnot = pAnnotDic->GetRectBy("Rect");
rcAnnot.Normalize();
CFX_ByteString sAnnotState = pAnnotDic->GetStringBy("AS");
@@ -452,7 +452,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CPDF_Dictionary* pAPDic = pAPStream->GetDict();
CFX_Matrix matrix = pAPDic->GetMatrixBy("Matrix");
- CPDF_Rect rcStream;
+ CFX_FloatRect rcStream;
if (pAPDic->KeyExist("Rect"))
rcStream = pAPDic->GetRectBy("Rect");
else if (pAPDic->KeyExist("BBox"))
« no previous file with comments | « fpdfsdk/src/formfiller/FFL_TextField.cpp ('k') | fpdfsdk/src/fpdfdoc.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698