diff options
Diffstat (limited to 'fpdfsdk/fpdf_transformpage.cpp')
-rw-r--r-- | fpdfsdk/fpdf_transformpage.cpp | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/fpdfsdk/fpdf_transformpage.cpp b/fpdfsdk/fpdf_transformpage.cpp index b607dffc4e..4f29fd69d6 100644 --- a/fpdfsdk/fpdf_transformpage.cpp +++ b/fpdfsdk/fpdf_transformpage.cpp @@ -106,19 +106,27 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_TransFormWithClip(FPDF_PAGE page, FS_MATRIX* matrix, FS_RECTF* clipRect) { + if (!matrix && !clipRect) + return false; + CPDF_Page* pPage = CPDFPageFromFPDFPage(page); if (!pPage) return false; std::ostringstream textBuf; textBuf << "q "; - CFX_FloatRect rect = CFXFloatRectFromFSRECTF(*clipRect); - rect.Normalize(); - textBuf << ByteString::Format("%f %f %f %f re W* n ", rect.left, rect.bottom, - rect.Width(), rect.Height()); - textBuf << ByteString::Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, - matrix->c, matrix->d, matrix->e, matrix->f); + if (clipRect) { + CFX_FloatRect rect = CFXFloatRectFromFSRECTF(*clipRect); + rect.Normalize(); + + textBuf << ByteString::Format("%f %f %f %f re W* n ", rect.left, + rect.bottom, rect.Width(), rect.Height()); + } + if (matrix) { + textBuf << ByteString::Format("%f %f %f %f %f %f cm ", matrix->a, matrix->b, + matrix->c, matrix->d, matrix->e, matrix->f); + } CPDF_Dictionary* pPageDict = pPage->m_pFormDict.Get(); CPDF_Object* pContentObj = GetPageContent(pPageDict); |