summaryrefslogtreecommitdiff
path: root/fpdfsdk/fpdf_view.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-12 16:23:01 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-12 16:23:01 +0000
commita105fa126cfc2de661dca824bd307aa329e22c9d (patch)
tree31ca3f7c7a8b8b0e52fda7219a385d5a293633ec /fpdfsdk/fpdf_view.cpp
parentc4242b24262d082f3ad70805aca779a3ff540c2c (diff)
downloadpdfium-a105fa126cfc2de661dca824bd307aa329e22c9d.tar.xz
Change some CPDFXFA_Page methods to take rects and points.
Instead of many int in-parameters. Change-Id: I58b493ac0155f6b45f52963c0f61159633d88e28 Reviewed-on: https://pdfium-review.googlesource.com/30056 Commit-Queue: Lei Zhang <thestig@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'fpdfsdk/fpdf_view.cpp')
-rw-r--r--fpdfsdk/fpdf_view.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp
index b04276ee51..51cfd8976b 100644
--- a/fpdfsdk/fpdf_view.cpp
+++ b/fpdfsdk/fpdf_view.cpp
@@ -743,12 +743,13 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_DeviceToPage(FPDF_PAGE page,
double* page_y) {
if (!page || !page_x || !page_y)
return;
+
UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
+ const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
#ifdef PDF_ENABLE_XFA
- pPage->DeviceToPage(start_x, start_y, size_x, size_y, rotate, device_x,
- device_y, page_x, page_y);
+ pPage->DeviceToPage(rect, rotate, CFX_PointF(device_x, device_y), page_x,
+ page_y);
#else // PDF_ENABLE_XFA
- const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
CFX_Matrix page2device = pPage->GetDisplayMatrix(rect, rotate);
CFX_PointF pos = page2device.GetInverse().Transform(
@@ -769,16 +770,14 @@ FPDF_EXPORT void FPDF_CALLCONV FPDF_PageToDevice(FPDF_PAGE page,
double page_y,
int* device_x,
int* device_y) {
- if (!device_x || !device_y)
+ if (!page || !device_x || !device_y)
return;
+
UnderlyingPageType* pPage = UnderlyingFromFPDFPage(page);
- if (!pPage)
- return;
+ const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
#ifdef PDF_ENABLE_XFA
- pPage->PageToDevice(start_x, start_y, size_x, size_y, rotate, page_x, page_y,
- device_x, device_y);
+ pPage->PageToDevice(rect, rotate, page_x, page_y, device_x, device_y);
#else // PDF_ENABLE_XFA
- const FX_RECT rect(start_x, start_y, start_x + size_x, start_y + size_y);
CFX_Matrix page2device = pPage->GetDisplayMatrix(rect, rotate);
CFX_PointF pos = page2device.Transform(
CFX_PointF(static_cast<float>(page_x), static_cast<float>(page_y)));