From 25fa42f398d1f8007aa36531e0436dc769817ad3 Mon Sep 17 00:00:00 2001 From: thestig Date: Wed, 25 May 2016 21:39:46 -0700 Subject: Clean up fx_ge.h and IWYU. Review-Url: https://codereview.chromium.org/2009253003 --- fpdfsdk/formfiller/cffl_iformfiller.cpp | 77 +++++++++++++++++---------------- 1 file changed, 39 insertions(+), 38 deletions(-) (limited to 'fpdfsdk/formfiller/cffl_iformfiller.cpp') diff --git a/fpdfsdk/formfiller/cffl_iformfiller.cpp b/fpdfsdk/formfiller/cffl_iformfiller.cpp index 75e57512df..06f24182ce 100644 --- a/fpdfsdk/formfiller/cffl_iformfiller.cpp +++ b/fpdfsdk/formfiller/cffl_iformfiller.cpp @@ -8,6 +8,7 @@ #include "core/fpdfapi/fpdf_page/include/cpdf_page.h" #include "core/fpdfapi/fpdf_parser/include/cpdf_document.h" +#include "core/fxge/include/fx_ge.h" #include "fpdfsdk/formfiller/cffl_checkbox.h" #include "fpdfsdk/formfiller/cffl_combobox.h" #include "fpdfsdk/formfiller/cffl_formfiller.h" @@ -33,9 +34,7 @@ FX_BOOL CFFL_IFormFiller::Annot_HitTest(CPDFSDK_PageView* pPageView, CPDFSDK_Annot* pAnnot, CFX_FloatPoint point) { CFX_FloatRect rc = pAnnot->GetRect(); - if (rc.Contains(point.x, point.y)) - return TRUE; - return FALSE; + return rc.Contains(point.x, point.y); } FX_RECT CFFL_IFormFiller::GetViewBBox(CPDFSDK_PageView* pPageView, @@ -61,46 +60,48 @@ void CFFL_IFormFiller::OnDraw(CPDFSDK_PageView* pPageView, ASSERT(pPageView); CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pAnnot; - if (IsVisible(pWidget)) { - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { - if (pFormFiller->IsValid()) { - pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); - pAnnot->GetPDFPage(); - - CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); - if (pDocument->GetFocusAnnot() == pAnnot) { - CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); - if (!rcFocus.IsEmpty()) { - CFX_PathData path; - path.SetPointCount(5); - path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); - path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); - path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); - path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); - path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); - - CFX_GraphStateData gsd; - gsd.SetDashCount(1); - gsd.m_DashArray[0] = 1.0f; - gsd.m_DashPhase = 0; - gsd.m_LineWidth = 1.0f; - pDevice->DrawPath(&path, pUser2Device, &gsd, 0, - ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE); - } + if (!IsVisible(pWidget)) + return; + + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { + if (pFormFiller->IsValid()) { + pFormFiller->OnDraw(pPageView, pAnnot, pDevice, pUser2Device, dwFlags); + pAnnot->GetPDFPage(); + + CPDFSDK_Document* pDocument = m_pApp->GetSDKDocument(); + if (pDocument->GetFocusAnnot() == pAnnot) { + CFX_FloatRect rcFocus = pFormFiller->GetFocusBox(pPageView); + if (!rcFocus.IsEmpty()) { + CFX_PathData path; + path.SetPointCount(5); + path.SetPoint(0, rcFocus.left, rcFocus.top, FXPT_MOVETO); + path.SetPoint(1, rcFocus.left, rcFocus.bottom, FXPT_LINETO); + path.SetPoint(2, rcFocus.right, rcFocus.bottom, FXPT_LINETO); + path.SetPoint(3, rcFocus.right, rcFocus.top, FXPT_LINETO); + path.SetPoint(4, rcFocus.left, rcFocus.top, FXPT_LINETO); + + CFX_GraphStateData gsd; + gsd.SetDashCount(1); + gsd.m_DashArray[0] = 1.0f; + gsd.m_DashPhase = 0; + gsd.m_LineWidth = 1.0f; + pDevice->DrawPath(&path, pUser2Device, &gsd, 0, + ArgbEncode(255, 0, 0, 0), FXFILL_ALTERNATE); } - return; } + return; } + } - if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) - pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device, - dwFlags); - else - pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); - - if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) - pWidget->DrawShadow(pDevice, pPageView); + if (CFFL_FormFiller* pFormFiller = GetFormFiller(pAnnot, FALSE)) { + pFormFiller->OnDrawDeactive(pPageView, pAnnot, pDevice, pUser2Device, + dwFlags); + } else { + pWidget->DrawAppearance(pDevice, pUser2Device, CPDF_Annot::Normal, NULL); } + + if (!IsReadOnly(pWidget) && IsFillingAllowed(pWidget)) + pWidget->DrawShadow(pDevice, pPageView); } void CFFL_IFormFiller::OnCreate(CPDFSDK_Annot* pAnnot) { -- cgit v1.2.3