summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--fpdfsdk/fpdf_transformpage.cpp46
1 files changed, 24 insertions, 22 deletions
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp
index 52b9fd41df..87f39ed072 100644
--- a/fpdfsdk/fpdf_transformpage.cpp
+++ b/fpdfsdk/fpdf_transformpage.cpp
@@ -158,28 +158,30 @@ FPDFPage_TransFormWithClip(FPDF_PAGE page,
// Need to transform the patterns as well.
CPDF_Dictionary* pRes =
pPageDict->GetDictFor(pdfium::page_object::kResources);
- if (pRes) {
- CPDF_Dictionary* pPattenDict = pRes->GetDictFor("Pattern");
- if (pPattenDict) {
- for (const auto& it : *pPattenDict) {
- CPDF_Object* pObj = it.second.get();
- if (pObj->IsReference())
- pObj = pObj->GetDirect();
-
- CPDF_Dictionary* pDict = nullptr;
- if (pObj->IsDictionary())
- pDict = pObj->AsDictionary();
- else if (CPDF_Stream* pObjStream = pObj->AsStream())
- pDict = pObjStream->GetDict();
- else
- continue;
-
- CFX_Matrix m = pDict->GetMatrixFor("Matrix");
- CFX_Matrix t = *(CFX_Matrix*)matrix;
- m.Concat(t);
- pDict->SetMatrixFor("Matrix", m);
- }
- }
+ if (!pRes)
+ return true;
+
+ CPDF_Dictionary* pPattenDict = pRes->GetDictFor("Pattern");
+ if (!pPattenDict)
+ return true;
+
+ for (const auto& it : *pPattenDict) {
+ CPDF_Object* pObj = it.second.get();
+ if (pObj->IsReference())
+ pObj = pObj->GetDirect();
+
+ CPDF_Dictionary* pDict = nullptr;
+ if (pObj->IsDictionary())
+ pDict = pObj->AsDictionary();
+ else if (CPDF_Stream* pObjStream = pObj->AsStream())
+ pDict = pObjStream->GetDict();
+ else
+ continue;
+
+ CFX_Matrix m = pDict->GetMatrixFor("Matrix");
+ m.Concat(CFX_Matrix(matrix->a, matrix->b, matrix->c, matrix->d, matrix->e,
+ matrix->f));
+ pDict->SetMatrixFor("Matrix", m);
}
return true;