summaryrefslogtreecommitdiff
path: root/fpdfsdk
diff options
context:
space:
mode:
authorDan Sinclair <dsinclair@chromium.org>2017-02-07 16:36:39 -0500
committerChromium commit bot <commit-bot@chromium.org>2017-02-08 01:36:02 +0000
commitbba2a7cf30da9e84bcc14ef32dbb0bb944229219 (patch)
tree94a74de8d07b3e395bf6e08a62811a3a0d652d19 /fpdfsdk
parent55e026b7b6eec17b012c819c4a7d39e63094b5c4 (diff)
downloadpdfium-bba2a7cf30da9e84bcc14ef32dbb0bb944229219.tar.xz
Update to use CFX_Rect{F} and CFX_Matrix constructors.
This Cl updates the code to use the constructors instead of creating an empty object and calling Set(). It also removes the various memsets of the CFX_Rect{F} classes. Change-Id: I6e20cec00866a38372858dcba5a30d31103172e4 Reviewed-on: https://pdfium-review.googlesource.com/2550 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: Nicolás Peña <npm@chromium.org> Reviewed-by: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fpdfsdk')
-rw-r--r--fpdfsdk/cpdfsdk_pageview.cpp9
-rw-r--r--fpdfsdk/cpdfsdk_xfawidgethandler.cpp4
-rw-r--r--fpdfsdk/formfiller/cffl_formfiller.cpp1
-rw-r--r--fpdfsdk/fpdfview.cpp10
-rw-r--r--fpdfsdk/fpdfxfa/cpdfxfa_page.cpp9
5 files changed, 12 insertions, 21 deletions
diff --git a/fpdfsdk/cpdfsdk_pageview.cpp b/fpdfsdk/cpdfsdk_pageview.cpp
index 416adffbe6..aae903eeb1 100644
--- a/fpdfsdk/cpdfsdk_pageview.cpp
+++ b/fpdfsdk/cpdfsdk_pageview.cpp
@@ -97,11 +97,10 @@ void CPDFSDK_PageView::PageView_OnDraw(CFX_RenderDevice* pDevice,
if (pPage->GetContext()->GetDocType() == DOCTYPE_DYNAMIC_XFA) {
CFX_Graphics gs;
gs.Create(pDevice);
- CFX_RectF rectClip;
- rectClip.Set(static_cast<FX_FLOAT>(pClip.left),
- static_cast<FX_FLOAT>(pClip.top),
- static_cast<FX_FLOAT>(pClip.Width()),
- static_cast<FX_FLOAT>(pClip.Height()));
+ CFX_RectF rectClip(static_cast<FX_FLOAT>(pClip.left),
+ static_cast<FX_FLOAT>(pClip.top),
+ static_cast<FX_FLOAT>(pClip.Width()),
+ static_cast<FX_FLOAT>(pClip.Height()));
gs.SetClipRect(rectClip);
std::unique_ptr<CXFA_RenderContext> pRenderContext(new CXFA_RenderContext);
CXFA_RenderOptions renderOptions;
diff --git a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
index eff351b55d..8d511fcc96 100644
--- a/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
+++ b/fpdfsdk/cpdfsdk_xfawidgethandler.cpp
@@ -56,9 +56,7 @@ void CPDFSDK_XFAWidgetHandler::OnDraw(CPDFSDK_PageView* pPageView,
CFX_Graphics gs;
gs.Create(pDevice);
- CFX_Matrix mt;
- mt = *pUser2Device;
-
+ CFX_Matrix mt = *pUser2Device;
bool bIsHighlight = false;
if (pPageView->GetFormFillEnv()->GetFocusAnnot() != pAnnot)
bIsHighlight = true;
diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp
index 281057a6ac..71feb54bef 100644
--- a/fpdfsdk/formfiller/cffl_formfiller.cpp
+++ b/fpdfsdk/formfiller/cffl_formfiller.cpp
@@ -395,6 +395,7 @@ CFX_Matrix CFFL_FormFiller::GetWindowMatrix(void* pAttachedData) {
if (pPrivateData->pPageView) {
CFX_Matrix mtPageView;
pPrivateData->pPageView->GetCurrentMatrix(mtPageView);
+
CFX_Matrix mt = GetCurMatrix();
mt.Concat(mtPageView);
diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp
index c1dc0df73e..8aa6ec0fb9 100644
--- a/fpdfsdk/fpdfview.cpp
+++ b/fpdfsdk/fpdfview.cpp
@@ -756,14 +756,8 @@ DLLEXPORT void STDCALL FPDF_RenderPageBitmapWithMatrix(FPDF_BITMAP bitmap,
CFX_Matrix transform_matrix = pPage->GetPageMatrix();
if (matrix) {
- CFX_Matrix cmatrix;
- cmatrix.a = matrix->a;
- cmatrix.b = matrix->b;
- cmatrix.c = matrix->c;
- cmatrix.d = matrix->d;
- cmatrix.e = matrix->e;
- cmatrix.f = matrix->f;
- transform_matrix.Concat(cmatrix);
+ transform_matrix.Concat(CFX_Matrix(matrix->a, matrix->b, matrix->c,
+ matrix->d, matrix->e, matrix->f));
}
CFX_FloatRect clipping_rect;
diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
index 8cc325009b..8011295f96 100644
--- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
+++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp
@@ -156,12 +156,12 @@ void CPDFXFA_Page::DeviceToPage(int start_x,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- CFX_Matrix page2device;
- CFX_Matrix device2page;
FX_FLOAT page_x_f, page_y_f;
+ CFX_Matrix page2device;
GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate);
+ CFX_Matrix device2page;
device2page.SetReverse(page2device);
device2page.Transform((FX_FLOAT)(device_x), (FX_FLOAT)(device_y), page_x_f,
page_y_f);
@@ -182,9 +182,9 @@ void CPDFXFA_Page::PageToDevice(int start_x,
if (!m_pPDFPage && !m_pXFAPageView)
return;
- CFX_Matrix page2device;
FX_FLOAT device_x_f, device_y_f;
+ CFX_Matrix page2device;
GetDisplayMatrix(page2device, start_x, start_y, size_x, size_y, rotate);
page2device.Transform(((FX_FLOAT)page_x), ((FX_FLOAT)page_y), device_x_f,
@@ -207,8 +207,7 @@ void CPDFXFA_Page::GetDisplayMatrix(CFX_Matrix& matrix,
switch (nDocType) {
case DOCTYPE_DYNAMIC_XFA: {
if (m_pXFAPageView) {
- CFX_Rect rect;
- rect.Set(xPos, yPos, xSize, ySize);
+ CFX_Rect rect(xPos, yPos, xSize, ySize);
m_pXFAPageView->GetDisplayMatrix(matrix, rect, iRotate);
}
} break;