summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_page
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-10 15:34:55 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-10 15:34:55 -0800
commit60d909e9d4444b2b8582275624ee97734d331a38 (patch)
tree6a884e5dd0c785c141919531033de7e2fc5b0e01 /core/src/fpdfapi/fpdf_page
parent33c8c7602f8981c32d37a9b2e25496401e914391 (diff)
downloadpdfium-60d909e9d4444b2b8582275624ee97734d331a38.tar.xz
Merge to XFA: Remove CFX_AffineMatrix/CPDF_Matrix
Review URL: https://codereview.chromium.org/1513363002 . (cherry picked from commit f32c969bce6743fca1e7ff796b54a1692d26d7f0) R=thestig@chromium.org Review URL: https://codereview.chromium.org/1519693002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_page')
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp28
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp4
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp17
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp5
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp2
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp12
-rw-r--r--core/src/fpdfapi/fpdf_page/pageint.h10
9 files changed, 41 insertions, 43 deletions
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index 3777cd078c..45b796ce86 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -65,21 +65,21 @@ void CPDF_PageObject::RecalcBBox() {
break;
}
}
-void CPDF_PageObject::TransformClipPath(CFX_AffineMatrix& matrix) {
+void CPDF_PageObject::TransformClipPath(CFX_Matrix& matrix) {
if (m_ClipPath.IsNull()) {
return;
}
m_ClipPath.GetModify();
m_ClipPath.Transform(matrix);
}
-void CPDF_PageObject::TransformGeneralState(CFX_AffineMatrix& matrix) {
+void CPDF_PageObject::TransformGeneralState(CFX_Matrix& matrix) {
if (m_GeneralState.IsNull()) {
return;
}
CPDF_GeneralStateData* pGS = m_GeneralState.GetModify();
pGS->m_Matrix.Concat(matrix);
}
-FX_RECT CPDF_PageObject::GetBBox(const CFX_AffineMatrix* pMatrix) const {
+FX_RECT CPDF_PageObject::GetBBox(const CFX_Matrix* pMatrix) const {
CFX_FloatRect rect(m_Left, m_Bottom, m_Right, m_Top);
if (pMatrix) {
pMatrix->TransformRect(rect);
@@ -209,7 +209,7 @@ void CPDF_TextObject::CopyData(const CPDF_PageObject* pSrc) {
m_PosY = pSrcObj->m_PosY;
}
-void CPDF_TextObject::GetTextMatrix(CFX_AffineMatrix* pMatrix) const {
+void CPDF_TextObject::GetTextMatrix(CFX_Matrix* pMatrix) const {
FX_FLOAT* pTextMatrix = m_TextState.GetMatrix();
pMatrix->Set(pTextMatrix[0], pTextMatrix[2], pTextMatrix[1], pTextMatrix[3],
m_PosX, m_PosY);
@@ -509,7 +509,7 @@ void CPDF_TextObject::CalcPositionData(FX_FLOAT* pTextAdvanceX,
min_y = min_y * fontsize / 1000;
max_y = max_y * fontsize / 1000;
}
- CFX_AffineMatrix matrix;
+ CFX_Matrix matrix;
GetTextMatrix(&matrix);
m_Left = min_x;
m_Right = max_x;
@@ -553,9 +553,9 @@ void CPDF_TextObject::CalcCharPos(FX_FLOAT* pPosArray) const {
}
}
-void CPDF_TextObject::Transform(const CFX_AffineMatrix& matrix) {
+void CPDF_TextObject::Transform(const CFX_Matrix& matrix) {
m_TextState.GetModify();
- CFX_AffineMatrix text_matrix;
+ CFX_Matrix text_matrix;
GetTextMatrix(&text_matrix);
text_matrix.Concat(matrix);
FX_FLOAT* pTextMatrix = m_TextState.GetMatrix();
@@ -623,7 +623,7 @@ void CPDF_ShadingObject::CopyData(const CPDF_PageObject* pSrc) {
}
m_Matrix = pSrcObj->m_Matrix;
}
-void CPDF_ShadingObject::Transform(const CFX_AffineMatrix& matrix) {
+void CPDF_ShadingObject::Transform(const CFX_Matrix& matrix) {
if (!m_ClipPath.IsNull()) {
m_ClipPath.GetModify();
m_ClipPath.Transform(matrix);
@@ -648,7 +648,7 @@ void CPDF_ShadingObject::CalcBoundingBox() {
CPDF_FormObject::~CPDF_FormObject() {
delete m_pForm;
}
-void CPDF_FormObject::Transform(const CFX_AffineMatrix& matrix) {
+void CPDF_FormObject::Transform(const CFX_Matrix& matrix) {
m_FormMatrix.Concat(matrix);
CalcBoundingBox();
}
@@ -725,7 +725,7 @@ CPDF_PageObject* CPDF_PageObjects::GetObjectByIndex(int index) const {
}
return (CPDF_PageObject*)m_ObjectList.GetAt(pos);
}
-void CPDF_PageObjects::Transform(const CFX_AffineMatrix& matrix) {
+void CPDF_PageObjects::Transform(const CFX_Matrix& matrix) {
FX_POSITION pos = m_ObjectList.GetHeadPosition();
while (pos) {
CPDF_PageObject* pObj = (CPDF_PageObject*)m_ObjectList.GetNext(pos);
@@ -923,7 +923,7 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc,
}
CPDF_Form::~CPDF_Form() {}
void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates,
- CFX_AffineMatrix* pParentMatrix,
+ CFX_Matrix* pParentMatrix,
CPDF_Type3Char* pType3Char,
CPDF_ParseOptions* pOptions,
int level) {
@@ -936,7 +936,7 @@ void CPDF_Form::StartParse(CPDF_AllStates* pGraphicStates,
m_ParseState = CONTENT_PARSING;
}
void CPDF_Form::ParseContent(CPDF_AllStates* pGraphicStates,
- CFX_AffineMatrix* pParentMatrix,
+ CFX_Matrix* pParentMatrix,
CPDF_Type3Char* pType3Char,
CPDF_ParseOptions* pOptions,
int level) {
@@ -953,7 +953,7 @@ CPDF_Form* CPDF_Form::Clone() const {
}
return pClone;
}
-void CPDF_Page::GetDisplayMatrix(CFX_AffineMatrix& matrix,
+void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix,
int xPos,
int yPos,
int xSize,
@@ -962,7 +962,7 @@ void CPDF_Page::GetDisplayMatrix(CFX_AffineMatrix& matrix,
if (m_PageWidth == 0 || m_PageHeight == 0) {
return;
}
- CFX_AffineMatrix display_matrix;
+ CFX_Matrix display_matrix;
int x0, y0, x1, y1, x2, y2;
iRotate %= 4;
switch (iRotate) {
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 3ae04d7111..44d1dc47b6 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -91,7 +91,7 @@ CPDF_ColorSpace* CPDF_Document::LoadColorSpace(CPDF_Object* pCSObj,
}
CPDF_Pattern* CPDF_Document::LoadPattern(CPDF_Object* pPatternObj,
FX_BOOL bShading,
- const CFX_AffineMatrix* matrix) {
+ const CFX_Matrix* matrix) {
return GetValidatePageData()->GetPattern(pPatternObj, bShading, matrix);
}
CPDF_IccProfile* CPDF_Document::LoadIccProfile(CPDF_Stream* pStream) {
@@ -404,7 +404,7 @@ void CPDF_DocPageData::ReleaseColorSpace(CPDF_Object* pColorSpace) {
CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj,
FX_BOOL bShading,
- const CFX_AffineMatrix* matrix) {
+ const CFX_Matrix* matrix) {
if (!pPatternObj)
return nullptr;
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 5c43b44e76..3852a4852a 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -190,7 +190,7 @@ void CPDF_ClipPath::AppendTexts(CPDF_TextObject** pTexts, int count) {
pData->m_pTextList[pData->m_TextCount + count] = NULL;
pData->m_TextCount += count + 1;
}
-void CPDF_ClipPath::Transform(const CPDF_Matrix& matrix) {
+void CPDF_ClipPath::Transform(const CFX_Matrix& matrix) {
CPDF_ClipPathData* pData = GetModify();
int i;
for (i = 0; i < pData->m_PathCount; i++) {
@@ -529,7 +529,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
if (ToDictionary(pObject)) {
pGeneralState->m_pSoftMask = pObject;
FXSYS_memcpy(pGeneralState->m_SMaskMatrix,
- &pParser->GetCurStates()->m_CTM, sizeof(CPDF_Matrix));
+ &pParser->GetCurStates()->m_CTM, sizeof(CFX_Matrix));
} else {
pGeneralState->m_pSoftMask = NULL;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
index 9c16173a6f..775bd91d16 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
@@ -32,7 +32,7 @@ void CPDF_ImageObject::CopyData(const CPDF_PageObject* pSrc) {
m_pImage = pSrcObj->m_pImage->Clone();
m_Matrix = pSrcObj->m_Matrix;
}
-void CPDF_ImageObject::Transform(const CFX_AffineMatrix& matrix) {
+void CPDF_ImageObject::Transform(const CFX_Matrix& matrix) {
m_Matrix.Concat(matrix);
CalcBoundingBox();
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index a2d4988f92..21fddead33 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -19,7 +19,7 @@ CPDF_StreamContentParser::CPDF_StreamContentParser(
CPDF_Document* pDocument,
CPDF_Dictionary* pPageResources,
CPDF_Dictionary* pParentResources,
- CFX_AffineMatrix* pmtContentToUser,
+ CFX_Matrix* pmtContentToUser,
CPDF_PageObjects* pObjList,
CPDF_Dictionary* pResources,
CPDF_Rect* pBBox,
@@ -620,7 +620,7 @@ void CPDF_StreamContentParser::Handle_ConcatMatrix() {
FX_FLOAT a2 = GetNumber16(5), b2 = GetNumber16(4), c2 = GetNumber16(3),
d2 = GetNumber16(2);
FX_FLOAT e2 = GetNumber(1), f2 = GetNumber(0);
- CFX_AffineMatrix new_matrix(a2, b2, c2, d2, e2, f2);
+ CFX_Matrix new_matrix(a2, b2, c2, d2, e2, f2);
new_matrix.Concat(m_pCurStates->m_CTM);
m_pCurStates->m_CTM = new_matrix;
OnChangeTextMatrix();
@@ -721,8 +721,7 @@ void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) {
if (!m_Options.m_bSeparateForm) {
CPDF_Dictionary* pResources =
pStream->GetDict()->GetDict(FX_BSTRC("Resources"));
- CFX_AffineMatrix form_matrix =
- pStream->GetDict()->GetMatrix(FX_BSTRC("Matrix"));
+ CFX_Matrix form_matrix = pStream->GetDict()->GetMatrix(FX_BSTRC("Matrix"));
form_matrix.Concat(m_pCurStates->m_CTM);
CPDF_Array* pBBox = pStream->GetDict()->GetArray(FX_BSTRC("BBox"));
CFX_FloatRect form_bbox;
@@ -777,7 +776,7 @@ CPDF_ImageObject* CPDF_StreamContentParser::AddImage(CPDF_Stream* pStream,
if (pStream == NULL && pImage == NULL) {
return NULL;
}
- CFX_AffineMatrix ImageMatrix;
+ CFX_Matrix ImageMatrix;
ImageMatrix.Copy(m_pCurStates->m_CTM);
ImageMatrix.Concat(m_mtContentToUser);
CPDF_ImageObject* pImageObj = new CPDF_ImageObject;
@@ -1093,7 +1092,7 @@ void CPDF_StreamContentParser::Handle_SetColorPS_Stroke() {
}
CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream,
ShadingType type,
- const CFX_AffineMatrix* pMatrix,
+ const CFX_Matrix* pMatrix,
CPDF_Function** pFuncs,
int nFuncs,
CPDF_ColorSpace* pCS);
@@ -1387,8 +1386,8 @@ void CPDF_StreamContentParser::Handle_SetTextMatrix() {
m_pCurStates->m_TextLineY = 0;
}
void CPDF_StreamContentParser::OnChangeTextMatrix() {
- CFX_AffineMatrix text_matrix(m_pCurStates->m_TextHorzScale, 0.0f, 0.0f, 1.0f,
- 0.0f, 0.0f);
+ CFX_Matrix text_matrix(m_pCurStates->m_TextHorzScale, 0.0f, 0.0f, 1.0f, 0.0f,
+ 0.0f);
text_matrix.Concat(m_pCurStates->m_TextMatrix);
text_matrix.Concat(m_pCurStates->m_CTM);
text_matrix.Concat(m_mtContentToUser);
@@ -1511,7 +1510,7 @@ void CPDF_StreamContentParser::AddPathObject(int FillType, FX_BOOL bStroke) {
pPathData->SetPointCount(PathPointCount);
FXSYS_memcpy(pPathData->GetPoints(), m_pPathPoints,
sizeof(FX_PATHPOINT) * PathPointCount);
- CFX_AffineMatrix matrix = m_pCurStates->m_CTM;
+ CFX_Matrix matrix = m_pCurStates->m_CTM;
matrix.Concat(m_mtContentToUser);
if (bStroke || FillType) {
CPDF_PathObject* pPathObj = new CPDF_PathObject;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index a1aa686248..d862225ec6 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -962,15 +962,14 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) {
}
void CPDF_ContentParser::Start(CPDF_Form* pForm,
CPDF_AllStates* pGraphicStates,
- CFX_AffineMatrix* pParentMatrix,
+ CFX_Matrix* pParentMatrix,
CPDF_Type3Char* pType3Char,
CPDF_ParseOptions* pOptions,
int level) {
m_pType3Char = pType3Char;
m_pObjects = pForm;
m_bForm = TRUE;
- CFX_AffineMatrix form_matrix =
- pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matrix"));
+ CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matrix"));
if (pGraphicStates) {
form_matrix.Concat(pGraphicStates->m_CTM);
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp
index 0880388541..a768434647 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_path.cpp
@@ -17,7 +17,7 @@ void CPDF_PathObject::CopyData(const CPDF_PageObject* pSrc) {
m_bStroke = pSrcObj->m_bStroke;
m_Matrix = pSrcObj->m_Matrix;
}
-void CPDF_PathObject::Transform(const CPDF_Matrix& matrix) {
+void CPDF_PathObject::Transform(const CFX_Matrix& matrix) {
m_Matrix.Concat(matrix);
CalcBoundingBox();
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 0c6b476db2..77e375bcc0 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -26,7 +26,7 @@ ShadingType ToShadingType(int type) {
} // namespace
-CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix)
+CPDF_Pattern::CPDF_Pattern(const CFX_Matrix* pParentMatrix)
: m_pPatternObj(NULL),
m_PatternType(PATTERN_TILING),
m_pDocument(NULL),
@@ -38,7 +38,7 @@ CPDF_Pattern::CPDF_Pattern(const CFX_AffineMatrix* pParentMatrix)
CPDF_Pattern::~CPDF_Pattern() {}
CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc,
CPDF_Object* pPatternObj,
- const CFX_AffineMatrix* parentMatrix)
+ const CFX_Matrix* parentMatrix)
: CPDF_Pattern(parentMatrix) {
m_PatternType = PATTERN_TILING;
m_pPatternObj = pPatternObj;
@@ -80,7 +80,7 @@ FX_BOOL CPDF_TilingPattern::Load() {
CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc,
CPDF_Object* pPatternObj,
FX_BOOL bShading,
- const CFX_AffineMatrix* parentMatrix)
+ const CFX_Matrix* parentMatrix)
: CPDF_Pattern(parentMatrix) {
m_PatternType = PATTERN_SHADING;
m_pPatternObj = bShading ? NULL : pPatternObj;
@@ -253,7 +253,7 @@ void CPDF_MeshStream::GetColor(FX_FLOAT& r, FX_FLOAT& g, FX_FLOAT& b) {
}
}
FX_DWORD CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex,
- CFX_AffineMatrix* pObject2Bitmap) {
+ CFX_Matrix* pObject2Bitmap) {
FX_DWORD flag = GetFlag();
GetCoords(vertex.x, vertex.y);
pObject2Bitmap->Transform(vertex.x, vertex.y);
@@ -263,7 +263,7 @@ FX_DWORD CPDF_MeshStream::GetVertex(CPDF_MeshVertex& vertex,
}
FX_BOOL CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex,
int count,
- CFX_AffineMatrix* pObject2Bitmap) {
+ CFX_Matrix* pObject2Bitmap) {
for (int i = 0; i < count; i++) {
if (m_BitStream.IsEOF()) {
return FALSE;
@@ -278,7 +278,7 @@ FX_BOOL CPDF_MeshStream::GetVertexRow(CPDF_MeshVertex* vertex,
CFX_FloatRect GetShadingBBox(CPDF_Stream* pStream,
ShadingType type,
- const CFX_AffineMatrix* pMatrix,
+ const CFX_Matrix* pMatrix,
CPDF_Function** pFuncs,
int nFuncs,
CPDF_ColorSpace* pCS) {
diff --git a/core/src/fpdfapi/fpdf_page/pageint.h b/core/src/fpdfapi/fpdf_page/pageint.h
index 84c8366780..d5a035fe2b 100644
--- a/core/src/fpdfapi/fpdf_page/pageint.h
+++ b/core/src/fpdfapi/fpdf_page/pageint.h
@@ -167,7 +167,7 @@ class CPDF_StreamContentParser {
CPDF_StreamContentParser(CPDF_Document* pDoc,
CPDF_Dictionary* pPageResources,
CPDF_Dictionary* pParentResources,
- CFX_AffineMatrix* pmtContentToUser,
+ CFX_Matrix* pmtContentToUser,
CPDF_PageObjects* pObjList,
CPDF_Dictionary* pResources,
CFX_FloatRect* pBBox,
@@ -312,7 +312,7 @@ class CPDF_StreamContentParser {
CPDF_Dictionary* m_pResources;
CPDF_PageObjects* m_pObjectList;
int m_Level;
- CFX_AffineMatrix m_mtContentToUser;
+ CFX_Matrix m_mtContentToUser;
CFX_FloatRect m_BBox;
CPDF_ParseOptions m_Options;
_ContentParam m_ParamBuf1[PARAM_BUF_SIZE];
@@ -357,7 +357,7 @@ class CPDF_ContentParser {
void Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions);
void Start(CPDF_Form* pForm,
CPDF_AllStates* pGraphicStates,
- CFX_AffineMatrix* pParentMatrix,
+ CFX_Matrix* pParentMatrix,
CPDF_Type3Char* pType3Char,
CPDF_ParseOptions* pOptions,
int level);
@@ -386,7 +386,7 @@ class CPDF_AllStates : public CPDF_GraphicStates {
void Copy(const CPDF_AllStates& src);
void ProcessExtGS(CPDF_Dictionary* pGS, CPDF_StreamContentParser* pParser);
void SetLineDash(CPDF_Array*, FX_FLOAT, FX_FLOAT scale);
- CFX_AffineMatrix m_TextMatrix, m_CTM, m_ParentMatrix;
+ CFX_Matrix m_TextMatrix, m_CTM, m_ParentMatrix;
FX_FLOAT m_TextX, m_TextY, m_TextLineX, m_TextLineY;
FX_FLOAT m_TextLeading, m_TextRise, m_TextHorzScale;
};
@@ -407,7 +407,7 @@ class CPDF_DocPageData {
void ReleaseColorSpace(CPDF_Object* pColorSpace);
CPDF_Pattern* GetPattern(CPDF_Object* pPatternObj,
FX_BOOL bShading,
- const CFX_AffineMatrix* matrix);
+ const CFX_Matrix* matrix);
void ReleasePattern(CPDF_Object* pPatternObj);
CPDF_Image* GetImage(CPDF_Object* pImageStream);
void ReleaseImage(CPDF_Object* pImageStream);