| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include "public/fpdf_transformpage.h" | 7 #include "public/fpdf_transformpage.h" |
| 8 | 8 |
| 9 #include "fpdfsdk/include/fsdk_define.h" | 9 #include "fpdfsdk/include/fsdk_define.h" |
| 10 | 10 |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 if (pObj->IsReference()) | 168 if (pObj->IsReference()) |
| 169 pObj = pObj->GetDirect(); | 169 pObj = pObj->GetDirect(); |
| 170 | 170 |
| 171 if (pObj->IsDictionary()) | 171 if (pObj->IsDictionary()) |
| 172 pDict = pObj->AsDictionary(); | 172 pDict = pObj->AsDictionary(); |
| 173 else if (CPDF_Stream* pStream = pObj->AsStream()) | 173 else if (CPDF_Stream* pStream = pObj->AsStream()) |
| 174 pDict = pStream->GetDict(); | 174 pDict = pStream->GetDict(); |
| 175 else | 175 else |
| 176 continue; | 176 continue; |
| 177 | 177 |
| 178 CFX_AffineMatrix m = pDict->GetMatrix(FX_BSTRC("Matrix")); | 178 CFX_Matrix m = pDict->GetMatrix(FX_BSTRC("Matrix")); |
| 179 CFX_AffineMatrix t = *(CFX_AffineMatrix*)matrix; | 179 CFX_Matrix t = *(CFX_Matrix*)matrix; |
| 180 m.Concat(t); | 180 m.Concat(t); |
| 181 pDict->SetAtMatrix(FX_BSTRC("Matrix"), m); | 181 pDict->SetAtMatrix(FX_BSTRC("Matrix"), m); |
| 182 } | 182 } |
| 183 } | 183 } |
| 184 } | 184 } |
| 185 | 185 |
| 186 return TRUE; | 186 return TRUE; |
| 187 } | 187 } |
| 188 | 188 |
| 189 DLLEXPORT void STDCALL | 189 DLLEXPORT void STDCALL |
| 190 FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, | 190 FPDFPageObj_TransformClipPath(FPDF_PAGEOBJECT page_object, |
| 191 double a, | 191 double a, |
| 192 double b, | 192 double b, |
| 193 double c, | 193 double c, |
| 194 double d, | 194 double d, |
| 195 double e, | 195 double e, |
| 196 double f) { | 196 double f) { |
| 197 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object; | 197 CPDF_PageObject* pPageObj = (CPDF_PageObject*)page_object; |
| 198 if (pPageObj == NULL) | 198 if (pPageObj == NULL) |
| 199 return; | 199 return; |
| 200 CFX_AffineMatrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, | 200 CFX_Matrix matrix((FX_FLOAT)a, (FX_FLOAT)b, (FX_FLOAT)c, (FX_FLOAT)d, |
| 201 (FX_FLOAT)e, (FX_FLOAT)f); | 201 (FX_FLOAT)e, (FX_FLOAT)f); |
| 202 | 202 |
| 203 // Special treatment to shading object, because the ClipPath for shading | 203 // Special treatment to shading object, because the ClipPath for shading |
| 204 // object is already transformed. | 204 // object is already transformed. |
| 205 if (pPageObj->m_Type != PDFPAGE_SHADING) | 205 if (pPageObj->m_Type != PDFPAGE_SHADING) |
| 206 pPageObj->TransformClipPath(matrix); | 206 pPageObj->TransformClipPath(matrix); |
| 207 pPageObj->TransformGeneralState(matrix); | 207 pPageObj->TransformGeneralState(matrix); |
| 208 } | 208 } |
| 209 | 209 |
| 210 DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, | 210 DLLEXPORT FPDF_CLIPPATH STDCALL FPDF_CreateClipPath(float left, |
| 211 float bottom, | 211 float bottom, |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 } else if (pDirectObj->IsStream()) { | 316 } else if (pDirectObj->IsStream()) { |
| 317 pContentArray = new CPDF_Array(); | 317 pContentArray = new CPDF_Array(); |
| 318 pContentArray->AddReference(pDoc, pStream->GetObjNum()); | 318 pContentArray->AddReference(pDoc, pStream->GetObjNum()); |
| 319 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); | 319 pContentArray->AddReference(pDoc, pDirectObj->GetObjNum()); |
| 320 pPageDic->SetAtReference("Contents", pDoc, | 320 pPageDic->SetAtReference("Contents", pDoc, |
| 321 pDoc->AddIndirectObject(pContentArray)); | 321 pDoc->AddIndirectObject(pContentArray)); |
| 322 } | 322 } |
| 323 } | 323 } |
| 324 } | 324 } |
| 325 } | 325 } |
| OLD | NEW |