diff options
author | Henrique Nakashima <hnakashima@chromium.org> | 2018-01-17 20:00:37 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-01-17 20:00:37 +0000 |
commit | 2914b6f1303445025764ec2d9f01a3be2df5cec0 (patch) | |
tree | 6aacd2a1acbef8ef44f7eaaa5c0a5da36dff3d7b /core/fpdfapi | |
parent | c37fa7d9c5c60ac407b46bfc2e7745afa0b2df85 (diff) | |
download | pdfium-2914b6f1303445025764ec2d9f01a3be2df5cec0.tar.xz |
Fix behavior of FPDF_RenderPageBitmapWithMatrix
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 <npm@chromium.org>
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/page/cpdf_page.cpp | 29 | ||||
-rw-r--r-- | core/fpdfapi/page/cpdf_page.h | 6 |
2 files changed, 0 insertions, 35 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp index c6f4fb2a39..ee7b5d408a 100644 --- a/core/fpdfapi/page/cpdf_page.cpp +++ b/core/fpdfapi/page/cpdf_page.cpp @@ -177,35 +177,6 @@ CFX_Matrix CPDF_Page::GetDisplayMatrix(int xPos, return matrix; } -// This method follows the same apparent logic as GetDisplayMatrix(). For -// example, consider point 0. First, take the top left coordinate of the -// rectangle in the transformed space. Now, calculate what this point was in the -// original space by inverting. Note that this is not necessarily the same as -// the top left corner of the original rectangle. -CFX_Matrix CPDF_Page::GetDisplayMatrixWithTransformation( - int xPos, - int yPos, - int xSize, - int ySize, - const CFX_Matrix& transformation) { - CFX_FloatRect rect(xPos, yPos, xPos + xSize, yPos + ySize); - rect = transformation.TransformRect(rect); - CFX_Matrix inverse = transformation.GetInverse(); - CFX_PointF point0(rect.left, rect.top); - CFX_PointF point1(rect.left, rect.bottom); - CFX_PointF point2(rect.right, rect.top); - point0 = inverse.Transform(point0); - point1 = inverse.Transform(point1); - point2 = inverse.Transform(point2); - - CFX_Matrix matrix = m_PageMatrix; - matrix.Concat(CFX_Matrix( - (point2.x - point0.x) / m_PageWidth, (point2.y - point0.y) / m_PageWidth, - (point1.x - point0.x) / m_PageHeight, - (point1.y - point0.y) / m_PageHeight, point0.x, point0.y)); - return matrix; -} - int CPDF_Page::GetPageRotation() const { CPDF_Object* pRotate = GetPageAttr("Rotate"); int rotate = pRotate ? (pRotate->GetInteger() / 90) % 4 : 0; diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h index e32a7f0fe8..e1b5bcfa44 100644 --- a/core/fpdfapi/page/cpdf_page.h +++ b/core/fpdfapi/page/cpdf_page.h @@ -38,12 +38,6 @@ class CPDF_Page : public CPDF_PageObjectHolder { int xSize, int ySize, int iRotate) const; - CFX_Matrix GetDisplayMatrixWithTransformation( - int xPos, - int yPos, - int xSize, - int ySize, - const CFX_Matrix& transformation); float GetPageWidth() const { return m_PageWidth; } float GetPageHeight() const { return m_PageHeight; } |