summaryrefslogtreecommitdiff
path: root/fpdfsdk/src/fpdf_transformpage.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/src/fpdf_transformpage.cpp')
-rw-r--r--fpdfsdk/src/fpdf_transformpage.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index a6caf78e6e..7bec77c2df 100644
--- a/fpdfsdk/src/fpdf_transformpage.cpp
+++ b/fpdfsdk/src/fpdf_transformpage.cpp
@@ -1,7 +1,7 @@
// 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 "../../public/fpdf_transformpage.h"
@@ -21,7 +21,7 @@ DLLEXPORT void STDCALL FPDFPage_SetMediaBox(FPDF_PAGE page, float left, float bo
pMediaBoxArray->Add(FX_NEW CPDF_Number(bottom));
pMediaBoxArray->Add(FX_NEW CPDF_Number(FX_FLOAT(right)));
pMediaBoxArray->Add(FX_NEW CPDF_Number(FX_FLOAT(top)));
-
+
pPageDict->SetAt("MediaBox", pMediaBoxArray);
}
@@ -38,8 +38,8 @@ DLLEXPORT void STDCALL FPDFPage_SetCropBox(FPDF_PAGE page, float left, float bot
pCropBoxArray->Add(FX_NEW CPDF_Number(bottom));
pCropBoxArray->Add(FX_NEW CPDF_Number(FX_FLOAT(right)));
pCropBoxArray->Add(FX_NEW CPDF_Number(FX_FLOAT(top)));
-
-
+
+
pPageDict->SetAt("CropBox", pCropBoxArray);
}
@@ -102,7 +102,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX
CFX_ByteString bsMatix;
bsMatix.Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b,matrix->c,matrix->d,matrix->e,matrix->f);
textBuf<<bsMatix;
-
+
CPDF_Dictionary* pPageDic = pPage->m_pFormDict;
CPDF_Object* pContentObj = pPageDic ? pPageDic->GetElement("Contents") : NULL;
@@ -110,7 +110,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX
pContentObj = pPageDic ? pPageDic->GetArray("Contents") : NULL;
if(!pContentObj)
return FALSE;
-
+
CPDF_Dictionary* pDic = FX_NEW CPDF_Dictionary;
CPDF_Stream* pStream = FX_NEW CPDF_Stream(NULL,0, pDic);
pStream->SetData(textBuf.GetBuffer(), textBuf.GetSize(), FALSE, FALSE);
@@ -123,7 +123,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX
CPDF_Stream* pEndStream = new CPDF_Stream(NULL,0, pDic);
pEndStream->SetData((const uint8_t*)" Q", 2, FALSE, FALSE);
pDoc->AddIndirectObject(pEndStream);
-
+
CPDF_Array* pContentArray = NULL;
if (pContentObj && pContentObj->GetType() == PDFOBJ_ARRAY)
{
@@ -131,7 +131,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX
CPDF_Reference* pRef = FX_NEW CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc,pEndStream);
-
+
}
else if(pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE)
{
@@ -145,7 +145,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX
CPDF_Reference* pRef = FX_NEW CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
pContentArray->AddReference(pDoc,pEndStream);
-
+
}
else if(pDirectObj->GetType() == PDFOBJ_STREAM)
{
@@ -156,7 +156,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX
pPageDic->SetAtReference("Contents", pDoc, pDoc->AddIndirectObject(pContentArray));
}
}
- }
+ }
//Need to transform the patterns as well.
CPDF_Dictionary* pRes = pPageDic->GetDict(FX_BSTRC("Resources"));
@@ -183,7 +183,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX
}
else
continue;
-
+
CFX_AffineMatrix m = pDict->GetMatrix(FX_BSTRC("Matrix"));
CFX_AffineMatrix t = *(CFX_AffineMatrix*)matrix;
m.Concat(t);
@@ -201,7 +201,7 @@ DLLEXPORT void STDCALL FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object
if(pPageObj == NULL)
return;
CFX_AffineMatrix matrix((FX_FLOAT)a,(FX_FLOAT)b,(FX_FLOAT)c,(FX_FLOAT)d,(FX_FLOAT)e,(FX_FLOAT)f);
-
+
//Special treatment to shading object, because the ClipPath for shading object is already transformed.
if(pPageObj->m_Type != PDFPAGE_SHADING)
pPageObj->TransformClipPath(matrix);
@@ -230,16 +230,16 @@ void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path)
{
const CFX_PathData* pPathData = path;
if (pPathData == NULL) return;
-
+
FX_PATHPOINT* pPoints = pPathData->GetPoints();
-
+
if (path.IsRect()) {
- buf << (pPoints[0].m_PointX) << " " << (pPoints[0].m_PointY) << " "
- << (pPoints[2].m_PointX - pPoints[0].m_PointX) << " "
+ buf << (pPoints[0].m_PointX) << " " << (pPoints[0].m_PointY) << " "
+ << (pPoints[2].m_PointX - pPoints[0].m_PointX) << " "
<< (pPoints[2].m_PointY - pPoints[0].m_PointY) << " re\n";
return;
}
-
+
CFX_ByteString temp;
for (int i = 0; i < pPathData->GetPointCount(); i ++) {
buf << (pPoints[i].m_PointX) << " " << (pPoints[i].m_PointY);
@@ -247,7 +247,7 @@ void OutputPath(CFX_ByteTextBuf& buf, CPDF_Path path)
if (point_type == FXPT_MOVETO)
buf << " m\n";
else if (point_type == FXPT_BEZIERTO) {
- buf << " " << (pPoints[i+1].m_PointX) << " " << (pPoints[i+1].m_PointY) << " " <<
+ buf << " " << (pPoints[i+1].m_PointX) << " " << (pPoints[i+1].m_PointY) << " " <<
(pPoints[i+2].m_PointX) << " " << (pPoints[i+2].m_PointY);
if (pPoints[i+2].m_Flag & FXPT_CLOSEFIGURE)
buf << " c h\n";
@@ -300,14 +300,14 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clip
if(!pDoc)
return;
pDoc->AddIndirectObject(pStream);
-
+
CPDF_Array* pContentArray = NULL;
if (pContentObj && pContentObj->GetType() == PDFOBJ_ARRAY)
{
pContentArray = (CPDF_Array*)pContentObj;
CPDF_Reference* pRef = FX_NEW CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
-
+
}
else if(pContentObj && pContentObj->GetType() == PDFOBJ_REFERENCE)
{
@@ -320,7 +320,7 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clip
pContentArray = (CPDF_Array*)pDirectObj;
CPDF_Reference* pRef = FX_NEW CPDF_Reference(pDoc, pStream->GetObjNum());
pContentArray->InsertAt(0, pRef);
-
+
}
else if(pDirectObj->GetType() == PDFOBJ_STREAM)
{
@@ -330,6 +330,6 @@ DLLEXPORT void STDCALL FPDFPage_InsertClipPath(FPDF_PAGE page,FPDF_CLIPPATH clip
pPageDic->SetAtReference("Contents", pDoc, pDoc->AddIndirectObject(pContentArray));
}
}
- }
+ }
}