summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2016-10-27 13:33:34 -0700
committerLei Zhang <thestig@chromium.org>2016-10-27 13:33:34 -0700
commitfee1e9ff603527d2ccd45d3e6fd32886228b917a (patch)
tree004d6f65b7c82915b947c16c6385a0846f901766
parentd586fe81bc2ec6785fa6d34df73fc564d48a2866 (diff)
downloadpdfium-fee1e9ff603527d2ccd45d3e6fd32886228b917a.tar.xz
M55: Convert from int to float values.
The CPDF_Page::GetDisplayMatrix expects to set float values into the |display_matrix| but all of the input values are currently int. It is possible to overflow the int values, so this CL changes the variables to be int which closer reflects what they're being used for. BUG=chromium:652038 Review-Url: https://codereview.chromium.org/2412983002 (cherry picked from commit 798e18f5e5cfb672c7f3186f6358b84c5ff7785b) Review URL: https://codereview.chromium.org/2456943002 .
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp19
1 files changed, 9 insertions, 10 deletions
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 89d0b35f3e..2143ddb015 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -126,12 +126,12 @@ void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix,
return;
}
CFX_Matrix display_matrix;
- int x0 = 0;
- int y0 = 0;
- int x1 = 0;
- int y1 = 0;
- int x2 = 0;
- int y2 = 0;
+ float x0 = 0;
+ float y0 = 0;
+ float x1 = 0;
+ float y1 = 0;
+ float x2 = 0;
+ float y2 = 0;
iRotate %= 4;
switch (iRotate) {
case 0:
@@ -167,10 +167,9 @@ void CPDF_Page::GetDisplayMatrix(CFX_Matrix& matrix,
y2 = yPos;
break;
}
- display_matrix.Set(
- ((FX_FLOAT)(x2 - x0)) / m_PageWidth, ((FX_FLOAT)(y2 - y0)) / m_PageWidth,
- ((FX_FLOAT)(x1 - x0)) / m_PageHeight,
- ((FX_FLOAT)(y1 - y0)) / m_PageHeight, (FX_FLOAT)x0, (FX_FLOAT)y0);
+ display_matrix.Set((x2 - x0) / m_PageWidth, (y2 - y0) / m_PageWidth,
+ (x1 - x0) / m_PageHeight, (y1 - y0) / m_PageHeight, x0,
+ y0);
matrix = m_PageMatrix;
matrix.Concat(display_matrix);
}