From bec4ea1e64b8049c572dd088c9c09a94f49b2353 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Mon, 29 Feb 2016 13:23:13 -0800 Subject: Pass rect by const reference in SetClip_Rect(). R=dsinclair@chromium.org Review URL: https://codereview.chromium.org/1745243002 . --- fpdfsdk/src/fpdfformfill.cpp | 8 ++------ fpdfsdk/src/fpdfview.cpp | 8 ++------ fpdfsdk/src/fxedit/fxet_pageobjs.cpp | 27 +++++++++------------------ fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp | 6 ++---- fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 9 +++------ 5 files changed, 18 insertions(+), 40 deletions(-) (limited to 'fpdfsdk/src') diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp index a14c66fbc6..c2e75c34d5 100644 --- a/fpdfsdk/src/fpdfformfill.cpp +++ b/fpdfsdk/src/fpdfformfill.cpp @@ -332,11 +332,7 @@ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, CFX_Matrix matrix; pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); - FX_RECT clip; - clip.left = start_x; - clip.right = start_x + size_x; - clip.top = start_y; - clip.bottom = start_y + size_y; + FX_RECT clip(start_x, start_y, start_x + size_x, start_y + size_y); #ifdef _SKIA_SUPPORT_ std::unique_ptr pDevice(new CFX_SkiaDevice); @@ -345,7 +341,7 @@ DLLEXPORT void STDCALL FPDF_FFLDraw(FPDF_FORMHANDLE hHandle, #endif pDevice->Attach((CFX_DIBitmap*)bitmap); pDevice->SaveState(); - pDevice->SetClip_Rect(&clip); + pDevice->SetClip_Rect(clip); #ifndef PDF_ENABLE_XFA if (CPDFSDK_PageView* pPageView = FormHandleToPageView(hHandle, pPage)) diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp index a535866889..05c69acb99 100644 --- a/fpdfsdk/src/fpdfview.cpp +++ b/fpdfsdk/src/fpdfview.cpp @@ -891,13 +891,9 @@ void FPDF_RenderPage_Retail(CRenderContext* pContext, CFX_Matrix matrix; pPage->GetDisplayMatrix(matrix, start_x, start_y, size_x, size_y, rotate); - FX_RECT clip; - clip.left = start_x; - clip.right = start_x + size_x; - clip.top = start_y; - clip.bottom = start_y + size_y; pContext->m_pDevice->SaveState(); - pContext->m_pDevice->SetClip_Rect(&clip); + pContext->m_pDevice->SetClip_Rect( + FX_RECT(start_x, start_y, start_x + size_x, start_y + size_y)); pContext->m_pContext = new CPDF_RenderContext(pPage); pContext->m_pContext->AppendLayer(pPage, &matrix); diff --git a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp index d7803311a5..63ab467ebe 100644 --- a/fpdfsdk/src/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/src/fxedit/fxet_pageobjs.cpp @@ -100,12 +100,9 @@ void IFX_Edit::DrawUnderline(CFX_RenderDevice* pDevice, if (!rcClip.IsEmpty()) { CFX_FloatRect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); - FX_RECT rcDevClip; - rcDevClip.left = (int32_t)rcTemp.left; - rcDevClip.right = (int32_t)rcTemp.right; - rcDevClip.top = (int32_t)rcTemp.top; - rcDevClip.bottom = (int32_t)rcTemp.bottom; - pDevice->SetClip_Rect(&rcDevClip); + pDevice->SetClip_Rect(FX_RECT((int32_t)rcTemp.left, (int32_t)rcTemp.top, + (int32_t)rcTemp.right, + (int32_t)rcTemp.bottom)); } if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { @@ -174,12 +171,9 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, if (!rcClip.IsEmpty()) { CFX_FloatRect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); - FX_RECT rcDevClip; - rcDevClip.left = (int32_t)rcTemp.left; - rcDevClip.right = (int32_t)rcTemp.right; - rcDevClip.top = (int32_t)rcTemp.top; - rcDevClip.bottom = (int32_t)rcTemp.bottom; - pDevice->SetClip_Rect(&rcDevClip); + pDevice->SetClip_Rect(FX_RECT((int32_t)rcTemp.left, (int32_t)rcTemp.top, + (int32_t)rcTemp.right, + (int32_t)rcTemp.bottom)); } if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { @@ -299,12 +293,9 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, if (!rcClip.IsEmpty()) { CFX_FloatRect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); - FX_RECT rcDevClip; - rcDevClip.left = (int32_t)rcTemp.left; - rcDevClip.right = (int32_t)rcTemp.right; - rcDevClip.top = (int32_t)rcTemp.top; - rcDevClip.bottom = (int32_t)rcTemp.bottom; - pDevice->SetClip_Rect(&rcDevClip); + pDevice->SetClip_Rect(FX_RECT((int32_t)rcTemp.left, (int32_t)rcTemp.top, + (int32_t)rcTemp.right, + (int32_t)rcTemp.bottom)); } if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { diff --git a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp index 1c32ceb251..7c2c1f4d17 100644 --- a/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_ListCtrl.cpp @@ -141,10 +141,8 @@ void CPWL_ListCtrl::DrawChildAppearance(CFX_RenderDevice* pDevice, CFX_FloatRect rcClient = GetClientRect(); CFX_FloatRect rcTemp = rcClient; pUser2Device->TransformRect(rcTemp); - FX_RECT rcClip((int32_t)rcTemp.left, (int32_t)rcTemp.bottom, - (int32_t)rcTemp.right, (int32_t)rcTemp.top); - - pDevice->SetClip_Rect(&rcClip); + pDevice->SetClip_Rect(FX_RECT((int32_t)rcTemp.left, (int32_t)rcTemp.bottom, + (int32_t)rcTemp.right, (int32_t)rcTemp.top)); for (int32_t i = 0, sz = m_aChildren.GetSize(); i < sz; i++) { if (CPWL_Wnd* pChild = m_aChildren.GetAt(i)) { diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index 6cd5786e2e..db1323e78a 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -1696,12 +1696,9 @@ void CPWL_Utils::DrawEditSpellCheck(CFX_RenderDevice* pDevice, if (!rcClip.IsEmpty()) { CFX_FloatRect rcTemp = rcClip; pUser2Device->TransformRect(rcTemp); - FX_RECT rcDevClip; - rcDevClip.left = (int32_t)rcTemp.left; - rcDevClip.right = (int32_t)rcTemp.right; - rcDevClip.top = (int32_t)rcTemp.top; - rcDevClip.bottom = (int32_t)rcTemp.bottom; - pDevice->SetClip_Rect(&rcDevClip); + pDevice->SetClip_Rect(FX_RECT((int32_t)rcTemp.left, (int32_t)rcTemp.top, + (int32_t)rcTemp.right, + (int32_t)rcTemp.bottom)); } if (IFX_Edit_Iterator* pIterator = pEdit->GetIterator()) { -- cgit v1.2.3