From 60bde10736fd78a2333cf1513aea779df9346b35 Mon Sep 17 00:00:00 2001 From: Nicolas Pena Date: Wed, 26 Jul 2017 13:50:12 -0400 Subject: Fix FPDF_RenderPageBitmapWithMatrix This CL fixes FPDF_RenderPageBitmapWithMatrix and improves tests. Bug: pdfium:837 Change-Id: I98f90b667cc9a50fb0e915b8a758603488b44d40 Reviewed-on: https://pdfium-review.googlesource.com/9010 Reviewed-by: Lei Zhang Reviewed-by: dsinclair Commit-Queue: dsinclair --- fpdfsdk/fpdfview.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'fpdfsdk/fpdfview.cpp') diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 956e6db671..c51ee90fe0 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -967,12 +967,6 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, CFX_RetainPtr pBitmap(CFXBitmapFromFPDFBitmap(bitmap)); pDevice->Attach(pBitmap, !!(flags & FPDF_REVERSE_BYTE_ORDER), nullptr, false); - CFX_Matrix transform_matrix = pPage->GetPageMatrix(); - if (matrix) { - transform_matrix.Concat(CFX_Matrix(matrix->a, matrix->b, matrix->c, - matrix->d, matrix->e, matrix->f)); - } - CFX_FloatRect clipping_rect; if (clipping) { clipping_rect.left = clipping->left; @@ -980,8 +974,16 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap, clipping_rect.right = clipping->right; clipping_rect.top = clipping->top; } - RenderPageImpl(pContext, pPage, transform_matrix, clipping_rect.ToFxRect(), - flags, true, nullptr); + FX_RECT clip_rect = clipping_rect.ToFxRect(); + + CFX_Matrix transform_matrix = pPage->GetDisplayMatrix( + clip_rect.left, clip_rect.top, clip_rect.Width(), clip_rect.Height(), 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