From 2914b6f1303445025764ec2d9f01a3be2df5cec0 Mon Sep 17 00:00:00 2001 From: Henrique Nakashima Date: Wed, 17 Jan 2018 20:00:37 +0000 Subject: Fix behavior of FPDF_RenderPageBitmapWithMatrix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This functional part of this CL is mostly a revert of "Change behaviour of FPDF_RenderPageBitmapWithMatrix" 24b0733a72bbc4013bff8628f198b0aea807aa06 Besides the revert, the parameters passed to pPage->GetDisplayMatrix() are changed to fix a bug with the previous implementation: the page was scaled to fit inside the clipping_rect, instead of clipped. Bug: pdfium:849 Change-Id: I95d0a303a979c998026a3bd6963c8684a1209f03 Reviewed-on: https://pdfium-review.googlesource.com/22931 Reviewed-by: Nicolás Peña Moreno Reviewed-by: dsinclair Commit-Queue: Henrique Nakashima --- fpdfsdk/fpdfview.cpp | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'fpdfsdk/fpdfview.cpp') diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index cec44a48f9..97fc02a234 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -1034,13 +1034,16 @@ FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, if (clipping) clipping_rect = CFXFloatRectFromFSRECTF(*clipping); FX_RECT clip_rect = clipping_rect.ToFxRect(); - RenderPageImpl( - pContext, pPage, - pPage->GetDisplayMatrixWithTransformation( - clip_rect.left, clip_rect.top, clip_rect.Width(), clip_rect.Height(), - CFX_Matrix(matrix->a, matrix->b, matrix->c, matrix->d, matrix->e, - matrix->f)), - clip_rect, flags, true, nullptr); + + CFX_Matrix transform_matrix = pPage->GetDisplayMatrix( + 0, 0, pPage->GetPageWidth(), pPage->GetPageHeight(), 0); + + if (matrix) { + transform_matrix.Concat(CFX_Matrix(matrix->a, matrix->b, matrix->c, + matrix->d, matrix->e, matrix->f)); + } + RenderPageImpl(pContext, pPage, transform_matrix, clip_rect, flags, true, + nullptr); pPage->SetRenderContext(nullptr); } -- cgit v1.2.3