Commit bf0eebe9 authored by Daniel Hosseinian's avatar Daniel Hosseinian Committed by Commit Bot

Use float variants of PDFium page width/height APIs

FPDF_GetPage[Width|Height]F() are encouraged over
FPDF_GetPage[Width|Height](), which will be deprecated in the future.

Change-Id: I0445d7cb0a36249fc52d4ff60751543b787b2531
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2393246Reviewed-by: default avatarLei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Commit-Queue: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#804503}
parent a5fed04f
...@@ -37,9 +37,9 @@ int CalculatePosition(FPDF_PAGE page, ...@@ -37,9 +37,9 @@ int CalculatePosition(FPDF_PAGE page,
// settings.bounds is in terms of the max DPI. Convert page sizes to match. // settings.bounds is in terms of the max DPI. Convert page sizes to match.
int dpi = std::max(settings.dpi_x, settings.dpi_y); int dpi = std::max(settings.dpi_x, settings.dpi_y);
int page_width = static_cast<int>( int page_width = static_cast<int>(
ConvertUnitDouble(FPDF_GetPageWidth(page), kPointsPerInch, dpi)); ConvertUnitDouble(FPDF_GetPageWidthF(page), kPointsPerInch, dpi));
int page_height = static_cast<int>( int page_height = static_cast<int>(
ConvertUnitDouble(FPDF_GetPageHeight(page), kPointsPerInch, dpi)); ConvertUnitDouble(FPDF_GetPageHeightF(page), kPointsPerInch, dpi));
// Start by assuming that we will draw exactly to the bounds rect // Start by assuming that we will draw exactly to the bounds rect
// specified. // specified.
......
...@@ -60,8 +60,8 @@ bool IsValidLink(const std::string& url) { ...@@ -60,8 +60,8 @@ bool IsValidLink(const std::string& url) {
pp::FloatRect FloatPageRectToPixelRect(FPDF_PAGE page, pp::FloatRect FloatPageRectToPixelRect(FPDF_PAGE page,
const pp::FloatRect& input) { const pp::FloatRect& input) {
int output_width = FPDF_GetPageWidth(page); int output_width = FPDF_GetPageWidthF(page);
int output_height = FPDF_GetPageHeight(page); int output_height = FPDF_GetPageHeightF(page);
int min_x; int min_x;
int min_y; int min_y;
......
...@@ -317,7 +317,7 @@ bool PDFiumPrint::IsSourcePdfLandscape(FPDF_DOCUMENT doc) { ...@@ -317,7 +317,7 @@ bool PDFiumPrint::IsSourcePdfLandscape(FPDF_DOCUMENT doc) {
DCHECK(pdf_page); DCHECK(pdf_page);
bool is_source_landscape = bool is_source_landscape =
FPDF_GetPageWidth(pdf_page.get()) > FPDF_GetPageHeight(pdf_page.get()); FPDF_GetPageWidthF(pdf_page.get()) > FPDF_GetPageHeightF(pdf_page.get());
return is_source_landscape; return is_source_landscape;
} }
...@@ -423,8 +423,8 @@ ScopedFPDFDocument PDFiumPrint::CreateSinglePageRasterPdf( ...@@ -423,8 +423,8 @@ ScopedFPDFDocument PDFiumPrint::CreateSinglePageRasterPdf(
ScopedFPDFDocument temp_doc(FPDF_CreateNewDocument()); ScopedFPDFDocument temp_doc(FPDF_CreateNewDocument());
DCHECK(temp_doc); DCHECK(temp_doc);
double source_page_width = FPDF_GetPageWidth(page_to_print); float source_page_width = FPDF_GetPageWidthF(page_to_print);
double source_page_height = FPDF_GetPageHeight(page_to_print); float source_page_height = FPDF_GetPageHeightF(page_to_print);
// For computing size in pixels, use a square dpi since the source PDF page // For computing size in pixels, use a square dpi since the source PDF page
// has square DPI. // has square DPI.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment