From efcf362b6658346ae0f8f3cdb73d871fdd82c8af Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 23 Feb 2017 13:29:56 -0500 Subject: Merge CFX_PathGenerator into CFX_Path. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CFX_Path was the only user of the CFX_PathGenerator which in turn just proxied to the CFX_PathData. This CL removes the CFX_PathGenerator and merges the code up into CFX_Path. Change-Id: I9e1a3921c987830f29b2ff5bd4aceacd2082e8f0 Reviewed-on: https://pdfium-review.googlesource.com/2825 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- xfa/fwl/cfwl_edit.cpp | 6 ------ xfa/fwl/theme/cfwl_carettp.cpp | 1 - xfa/fwl/theme/cfwl_checkboxtp.cpp | 12 +----------- xfa/fwl/theme/cfwl_comboboxtp.cpp | 2 -- xfa/fwl/theme/cfwl_edittp.cpp | 1 - xfa/fwl/theme/cfwl_listboxtp.cpp | 1 - xfa/fwl/theme/cfwl_monthcalendartp.cpp | 14 -------------- xfa/fwl/theme/cfwl_pushbuttontp.cpp | 2 -- xfa/fwl/theme/cfwl_scrollbartp.cpp | 3 --- xfa/fwl/theme/cfwl_widgettp.cpp | 6 ------ 10 files changed, 1 insertion(+), 47 deletions(-) (limited to 'xfa/fwl') diff --git a/xfa/fwl/cfwl_edit.cpp b/xfa/fwl/cfwl_edit.cpp index d343090647..d36e28ab56 100644 --- a/xfa/fwl/cfwl_edit.cpp +++ b/xfa/fwl/cfwl_edit.cpp @@ -192,15 +192,11 @@ void CFWL_Edit::DrawSpellCheck(CFX_Graphics* pGraphics, CFX_Color crLine(0xFFFF0000); CFWL_EventCheckWord checkWordEvent(this); - CFX_ByteString sLatinWord; CFX_Path pathSpell; - pathSpell.Create(); - int32_t nStart = 0; FX_FLOAT fOffSetX = m_rtEngine.left - m_fScrollOffsetX; FX_FLOAT fOffSetY = m_rtEngine.top - m_fScrollOffsetY + m_fVAlignOffset; - CFX_WideString wsSpell = GetText(); int32_t nContentLen = wsSpell.GetLength(); for (int i = 0; i < nContentLen; i++) { @@ -550,7 +546,6 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, } CFX_Path path; - path.Create(); for (auto& rect : rectArr) { rect.left += fOffSetX; rect.top += fOffSetY; @@ -581,7 +576,6 @@ void CFWL_Edit::DrawContent(CFX_Graphics* pGraphics, if (m_pProperties->m_dwStyleExes & FWL_STYLEEXT_EDT_CombText) { pGraphics->RestoreGraphState(); CFX_Path path; - path.Create(); int32_t iLimit = m_nLimit > 0 ? m_nLimit : 1; FX_FLOAT fStep = m_rtEngine.width / iLimit; FX_FLOAT fLeft = m_rtEngine.left + 1; diff --git a/xfa/fwl/theme/cfwl_carettp.cpp b/xfa/fwl/theme/cfwl_carettp.cpp index 06df3f51e4..4a04f869f4 100644 --- a/xfa/fwl/theme/cfwl_carettp.cpp +++ b/xfa/fwl/theme/cfwl_carettp.cpp @@ -40,7 +40,6 @@ void CFWL_CaretTP::DrawCaretBK(CFX_Graphics* pGraphics, CFX_Color* crFill, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); CFX_RectF rect = *pRect; path.AddRectangle(rect.left, rect.top, rect.width, rect.height); if (crFill) { diff --git a/xfa/fwl/theme/cfwl_checkboxtp.cpp b/xfa/fwl/theme/cfwl_checkboxtp.cpp index 7876b71db5..1d185b4c33 100644 --- a/xfa/fwl/theme/cfwl_checkboxtp.cpp +++ b/xfa/fwl/theme/cfwl_checkboxtp.cpp @@ -79,7 +79,6 @@ void CFWL_CheckBoxTP::DrawSignCircle(CFX_Graphics* pGraphics, FX_ARGB argbFill, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); path.AddEllipse(*pRtSign); CFX_Color crFill(argbFill); pGraphics->SaveGraphState(); @@ -93,8 +92,6 @@ void CFWL_CheckBoxTP::DrawSignCross(CFX_Graphics* pGraphics, FX_ARGB argbFill, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); - FX_FLOAT fRight = pRtSign->right(); FX_FLOAT fBottom = pRtSign->bottom(); path.AddLine(pRtSign->TopLeft(), CFX_PointF(fRight, fBottom)); @@ -114,8 +111,6 @@ void CFWL_CheckBoxTP::DrawSignDiamond(CFX_Graphics* pGraphics, FX_ARGB argbFill, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); - FX_FLOAT fWidth = pRtSign->width; FX_FLOAT fHeight = pRtSign->height; FX_FLOAT fBottom = pRtSign->bottom(); @@ -137,7 +132,6 @@ void CFWL_CheckBoxTP::DrawSignSquare(CFX_Graphics* pGraphics, FX_ARGB argbFill, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); path.AddRectangle(pRtSign->left, pRtSign->top, pRtSign->width, pRtSign->height); CFX_Color crFill(argbFill); @@ -152,8 +146,6 @@ void CFWL_CheckBoxTP::DrawSignStar(CFX_Graphics* pGraphics, FX_ARGB argbFill, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); - FX_FLOAT fBottom = pRtSign->bottom(); FX_FLOAT fRadius = (pRtSign->top - fBottom) / (1 + static_cast(cos(FX_PI / 5.0f))); @@ -227,7 +219,6 @@ void CFWL_CheckBoxTP::SetThemeData() { void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) { if (!m_pCheckPath) { m_pCheckPath = pdfium::MakeUnique(); - m_pCheckPath->Create(); FX_FLOAT fWidth = kSignPath; FX_FLOAT fHeight = -kSignPath; @@ -275,8 +266,7 @@ void CFWL_CheckBoxTP::InitCheckPath(FX_FLOAT fCheckLen) { CFX_Matrix mt(1, 0, 0, 1, 0, 0); mt.Scale(fScale, fScale); - CFX_PathData* pData = m_pCheckPath->GetPathData(); - pData->Transform(&mt); + m_pCheckPath->TransformBy(mt); } } diff --git a/xfa/fwl/theme/cfwl_comboboxtp.cpp b/xfa/fwl/theme/cfwl_comboboxtp.cpp index 567cb2ec2b..53a6eae722 100644 --- a/xfa/fwl/theme/cfwl_comboboxtp.cpp +++ b/xfa/fwl/theme/cfwl_comboboxtp.cpp @@ -28,7 +28,6 @@ void CFWL_ComboBoxTP::DrawBackground(CFWL_ThemeBackground* pParams) { } case CFWL_Part::Background: { CFX_Path path; - path.Create(); CFX_RectF& rect = pParams->m_rtPart; path.AddRectangle(rect.left, rect.top, rect.width, rect.height); FX_ARGB argb_color; @@ -66,7 +65,6 @@ void CFWL_ComboBoxTP::DrawStrethHandler(CFWL_ThemeBackground* pParams, uint32_t dwStates, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, pParams->m_rtPart.width - 1, pParams->m_rtPart.height); CFX_Color cr(ArgbEncode(0xff, 0xff, 0, 0)); diff --git a/xfa/fwl/theme/cfwl_edittp.cpp b/xfa/fwl/theme/cfwl_edittp.cpp index eee5423201..43160177d7 100644 --- a/xfa/fwl/theme/cfwl_edittp.cpp +++ b/xfa/fwl/theme/cfwl_edittp.cpp @@ -53,7 +53,6 @@ void CFWL_EditTP::DrawBackground(CFWL_ThemeBackground* pParams) { pGraphics->RestoreGraphState(); } else { CFX_Path path; - path.Create(); path.AddRectangle(pParams->m_rtPart.left, pParams->m_rtPart.top, pParams->m_rtPart.width, pParams->m_rtPart.height); CFX_Color cr(FWLTHEME_COLOR_Background); diff --git a/xfa/fwl/theme/cfwl_listboxtp.cpp b/xfa/fwl/theme/cfwl_listboxtp.cpp index 7a9ba92bee..4e00420df5 100644 --- a/xfa/fwl/theme/cfwl_listboxtp.cpp +++ b/xfa/fwl/theme/cfwl_listboxtp.cpp @@ -70,7 +70,6 @@ void CFWL_ListBoxTP::DrawListBoxItem(CFX_Graphics* pGraphics, pGraphics->SetFillColor(&crFill); CFX_RectF rt(*prtItem); CFX_Path path; - path.Create(); #if (_FX_OS_ == _FX_MACOSX_) path.AddRectangle(rt.left, rt.top, rt.width - 1, rt.height - 1); #else diff --git a/xfa/fwl/theme/cfwl_monthcalendartp.cpp b/xfa/fwl/theme/cfwl_monthcalendartp.cpp index cf6306a53f..b14109d013 100644 --- a/xfa/fwl/theme/cfwl_monthcalendartp.cpp +++ b/xfa/fwl/theme/cfwl_monthcalendartp.cpp @@ -105,8 +105,6 @@ void CFWL_MonthCalendarTP::DrawText(CFWL_ThemeText* pParams) { void CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); - CFX_RectF rtTotal(pParams->m_rtPart); path.AddRectangle(rtTotal.left, rtTotal.top, rtTotal.width, rtTotal.height); pParams->m_pGraphics->SaveGraphState(); @@ -120,8 +118,6 @@ void CFWL_MonthCalendarTP::DrawTotalBK(CFWL_ThemeBackground* pParams, void CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); - CFX_RectF rtHead = pParams->m_rtPart; path.AddRectangle(rtHead.left, rtHead.top, rtHead.width, rtHead.height); pParams->m_pGraphics->SaveGraphState(); @@ -135,8 +131,6 @@ void CFWL_MonthCalendarTP::DrawHeadBk(CFWL_ThemeBackground* pParams, void CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); - CFX_RectF rtLBtn = pParams->m_rtPart; path.AddRectangle(rtLBtn.left, rtLBtn.top, rtLBtn.width, rtLBtn.height); pParams->m_pGraphics->SaveGraphState(); @@ -171,8 +165,6 @@ void CFWL_MonthCalendarTP::DrawLButton(CFWL_ThemeBackground* pParams, void CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); - CFX_RectF rtRBtn = pParams->m_rtPart; path.AddRectangle(rtRBtn.left, rtRBtn.top, rtRBtn.width, rtRBtn.height); pParams->m_pGraphics->SaveGraphState(); @@ -207,7 +199,6 @@ void CFWL_MonthCalendarTP::DrawRButton(CFWL_ThemeBackground* pParams, void CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); CFX_RectF rtHSep = pParams->m_rtPart; path.MoveTo(CFX_PointF(rtHSep.left, rtHSep.top + rtHSep.height / 2)); path.LineTo(CFX_PointF(rtHSep.right(), rtHSep.top + rtHSep.height / 2)); @@ -222,7 +213,6 @@ void CFWL_MonthCalendarTP::DrawHSeperator(CFWL_ThemeBackground* pParams, void CFWL_MonthCalendarTP::DrawWeekNumSep(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); CFX_RectF rtWeekSep = pParams->m_rtPart; path.MoveTo(rtWeekSep.TopLeft()); path.LineTo(rtWeekSep.BottomLeft()); @@ -239,7 +229,6 @@ void CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->SaveGraphState(); if (pParams->m_dwStates & CFWL_PartState_Selected) { CFX_Path path; - path.Create(); CFX_RectF rtSelDay = pParams->m_rtPart; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); @@ -248,7 +237,6 @@ void CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, pParams->m_pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); } else if (pParams->m_dwStates & CFWL_PartState_Hovered) { CFX_Path path; - path.Create(); CFX_RectF rtSelDay = pParams->m_rtPart; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); @@ -262,7 +250,6 @@ void CFWL_MonthCalendarTP::DrawDatesInBK(CFWL_ThemeBackground* pParams, void CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); CFX_RectF rtSelDay = pParams->m_rtPart; path.AddRectangle(rtSelDay.left, rtSelDay.top, rtSelDay.width, rtSelDay.height); @@ -276,7 +263,6 @@ void CFWL_MonthCalendarTP::DrawDatesInCircle(CFWL_ThemeBackground* pParams, void CFWL_MonthCalendarTP::DrawTodayCircle(CFWL_ThemeBackground* pParams, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); CFX_RectF rtTodayCircle = pParams->m_rtPart; path.AddRectangle(rtTodayCircle.left, rtTodayCircle.top, rtTodayCircle.width, rtTodayCircle.height); diff --git a/xfa/fwl/theme/cfwl_pushbuttontp.cpp b/xfa/fwl/theme/cfwl_pushbuttontp.cpp index ba7b2ca506..56268a8507 100644 --- a/xfa/fwl/theme/cfwl_pushbuttontp.cpp +++ b/xfa/fwl/theme/cfwl_pushbuttontp.cpp @@ -33,7 +33,6 @@ void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { FX_FLOAT fBottom = rect.bottom(); CFX_Path strokePath; - strokePath.Create(); strokePath.MoveTo( CFX_PointF(rect.left + PUSHBUTTON_SIZE_Corner, rect.top)); strokePath.LineTo(CFX_PointF(fRight - PUSHBUTTON_SIZE_Corner, rect.top)); @@ -50,7 +49,6 @@ void CFWL_PushButtonTP::DrawBackground(CFWL_ThemeBackground* pParams) { CFX_PointF(rect.left + PUSHBUTTON_SIZE_Corner, rect.top)); CFX_Path fillPath; - fillPath.Create(); fillPath.AddSubpath(&strokePath); CFX_Graphics* pGraphics = pParams->m_pGraphics; diff --git a/xfa/fwl/theme/cfwl_scrollbartp.cpp b/xfa/fwl/theme/cfwl_scrollbartp.cpp index 5f8f7dcd49..121d4dea34 100644 --- a/xfa/fwl/theme/cfwl_scrollbartp.cpp +++ b/xfa/fwl/theme/cfwl_scrollbartp.cpp @@ -81,7 +81,6 @@ void CFWL_ScrollBarTP::DrawThumbBtn(CFX_Graphics* pGraphics, return; CFX_Path path; - path.Create(); CFX_RectF rect(*pRect); if (bVert) { rect.Deflate(1, 0); @@ -124,7 +123,6 @@ void CFWL_ScrollBarTP::DrawPaw(CFX_Graphics* pGraphics, FWLTHEME_STATE eState, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); if (bVert) { FX_FLOAT fPawLen = kPawLength; if (pRect->width / 2 <= fPawLen) { @@ -214,7 +212,6 @@ void CFWL_ScrollBarTP::DrawTrack(CFX_Graphics* pGraphics, pGraphics->SaveGraphState(); CFX_Color colorLine(ArgbEncode(255, 238, 237, 229)); CFX_Path path; - path.Create(); FX_FLOAT fRight = pRect->right(); FX_FLOAT fBottom = pRect->bottom(); if (bVert) { diff --git a/xfa/fwl/theme/cfwl_widgettp.cpp b/xfa/fwl/theme/cfwl_widgettp.cpp index d7d98cd76f..fbcbcffb85 100644 --- a/xfa/fwl/theme/cfwl_widgettp.cpp +++ b/xfa/fwl/theme/cfwl_widgettp.cpp @@ -104,7 +104,6 @@ void CFWL_WidgetTP::DrawBorder(CFX_Graphics* pGraphics, if (!pRect) return; CFX_Path path; - path.Create(); path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); path.AddRectangle(pRect->left + 1, pRect->top + 1, pRect->width - 2, pRect->height - 2); @@ -133,7 +132,6 @@ void CFWL_WidgetTP::FillSoildRect(CFX_Graphics* pGraphics, CFX_Color crFill(fillColor); pGraphics->SetFillColor(&crFill); CFX_Path path; - path.Create(); path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); pGraphics->FillPath(&path, FXFILL_WINDING, pMatrix); pGraphics->RestoreGraphState(); @@ -175,7 +173,6 @@ void CFWL_WidgetTP::DrawFocus(CFX_Graphics* pGraphics, FX_FLOAT DashPattern[2] = {1, 1}; pGraphics->SetLineDash(0.0f, DashPattern, 2); CFX_Path path; - path.Create(); path.AddRectangle(pRect->left, pRect->top, pRect->width, pRect->height); pGraphics->StrokePath(&path, pMatrix); pGraphics->RestoreGraphState(); @@ -193,7 +190,6 @@ void CFWL_WidgetTP::DrawArrow(CFX_Graphics* pGraphics, FX_FLOAT fTop = (FX_FLOAT)(((pRect->height - (bVert ? 6 : 9)) / 2 + pRect->top) + 0.5); CFX_Path path; - path.Create(); switch (eDict) { case FWLTHEME_DIRECTION_Down: { path.MoveTo(CFX_PointF(fLeft, fTop + 1)); @@ -242,8 +238,6 @@ void CFWL_WidgetTP::DrawBtn(CFX_Graphics* pGraphics, FWLTHEME_STATE eState, CFX_Matrix* pMatrix) { CFX_Path path; - path.Create(); - InitializeArrowColorData(); FX_FLOAT fRight = pRect->right(); -- cgit v1.2.3