Change behaviour of FPDF_RenderPageBitmapWithMatrix
This CL changes the behavior of FPDF_RenderPageBitmapWithMatrix so it
transforms the bitmap. Before, the page would be transformed and the
assumption was that it would be drawn on a bitmap with the same
dimensions as the original page. This does not work well because a
transformation generally changes the dimensions of the page. The
rectangles test is modified to include small rectangles in the corner
of the page, so that it's clear that the whole original page is being
displayed.
Bug: pdfium:849
Change-Id: Ie89f959a1605fea59a15d239ca871ccd939ec92b
Reviewed-on: https://pdfium-review.googlesource.com/13510
Commit-Queue: Nicolás Peña <npm@chromium.org>
Reviewed-by: Lei Zhang <thestig@chromium.org>
Reviewed-by: Henrique Nakashima <hnakashima@chromium.org>
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index e93e8bc..5bcc643 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -1004,15 +1004,13 @@
clipping_rect.top = clipping->top;
}
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);
+ 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);
pPage->SetRenderContext(nullptr);
}