From b8fd43f9ca1ec790ef16590dbd909b81c3e09580 Mon Sep 17 00:00:00 2001 From: Lei Zhang Date: Thu, 18 Oct 2018 17:51:42 +0000 Subject: Avoid pass by value in FPDFPage_Flatten()'s GetMatrix() helper. Change-Id: I281ca39655d593264d9b0ae074d4faec2f36d01c Reviewed-on: https://pdfium-review.googlesource.com/c/44253 Commit-Queue: Lei Zhang Reviewed-by: Tom Sepez --- fpdfsdk/fpdf_flatten.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 0cee611144..58074bd7f7 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -225,21 +225,21 @@ void SetPageContents(const ByteString& key, } } -CFX_Matrix GetMatrix(CFX_FloatRect rcAnnot, - CFX_FloatRect rcStream, +CFX_Matrix GetMatrix(const CFX_FloatRect& rcAnnot, + const CFX_FloatRect& rcStream, const CFX_Matrix& matrix) { if (rcStream.IsEmpty()) return CFX_Matrix(); - rcStream = matrix.TransformRect(rcStream); - rcStream.Normalize(); + CFX_FloatRect rcTransformed = matrix.TransformRect(rcStream); + rcTransformed.Normalize(); - float a = rcAnnot.Width() / rcStream.Width(); - float d = rcAnnot.Height() / rcStream.Height(); + float a = rcAnnot.Width() / rcTransformed.Width(); + float d = rcAnnot.Height() / rcTransformed.Height(); - float e = rcAnnot.left - rcStream.left * a; - float f = rcAnnot.bottom - rcStream.bottom * d; - return CFX_Matrix(a, 0, 0, d, e, f); + float e = rcAnnot.left - rcTransformed.left * a; + float f = rcAnnot.bottom - rcTransformed.bottom * d; + return CFX_Matrix(a, 0.0f, 0.0f, d, e, f); } } // namespace -- cgit v1.2.3