diff options
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/cpdfsdk_widget.cpp | 10 | ||||
-rw-r--r-- | fpdfsdk/formfiller/cffl_formfiller.cpp | 11 | ||||
-rw-r--r-- | fpdfsdk/fpdfview.cpp | 18 | ||||
-rw-r--r-- | fpdfsdk/fpdfxfa/cpdfxfa_page.cpp | 18 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.cpp | 55 | ||||
-rw-r--r-- | fpdfsdk/fxedit/fxet_edit.h | 1 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 14 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_ListBox.cpp | 8 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Wnd.cpp | 13 | ||||
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Wnd.h | 5 |
10 files changed, 49 insertions, 104 deletions
diff --git a/fpdfsdk/cpdfsdk_widget.cpp b/fpdfsdk/cpdfsdk_widget.cpp index 8925c9a302..a4506e74a6 100644 --- a/fpdfsdk/cpdfsdk_widget.cpp +++ b/fpdfsdk/cpdfsdk_widget.cpp @@ -845,8 +845,14 @@ void CPDFSDK_Widget::DrawShadow(CFX_RenderDevice* pDevice, pPageView->GetCurrentMatrix(page2device); CFX_FloatRect rcDevice = GetRect(); - page2device.TransformPoint(rcDevice.left, rcDevice.bottom); - page2device.TransformPoint(rcDevice.right, rcDevice.top); + CFX_PointF tmp = + page2device.Transform(CFX_PointF(rcDevice.left, rcDevice.bottom)); + rcDevice.left = tmp.x; + rcDevice.bottom = tmp.y; + + tmp = page2device.Transform(CFX_PointF(rcDevice.right, rcDevice.top)); + rcDevice.right = tmp.x; + rcDevice.top = tmp.y; rcDevice.Normalize(); FX_RECT rcDev = rcDevice.ToFxRect(); diff --git a/fpdfsdk/formfiller/cffl_formfiller.cpp b/fpdfsdk/formfiller/cffl_formfiller.cpp index 44df8dd770..da6f9208e0 100644 --- a/fpdfsdk/formfiller/cffl_formfiller.cpp +++ b/fpdfsdk/formfiller/cffl_formfiller.cpp @@ -483,18 +483,11 @@ CFX_FloatRect CFFL_FormFiller::PWLtoFFL(const CFX_FloatRect& rect) { CFX_PointF CFFL_FormFiller::FFLtoPWL(const CFX_PointF& point) { CFX_Matrix mt; mt.SetReverse(GetCurMatrix()); - - CFX_PointF pt = point; - mt.TransformPoint(pt.x, pt.y); - return pt; + return mt.Transform(point); } CFX_PointF CFFL_FormFiller::PWLtoFFL(const CFX_PointF& point) { - CFX_Matrix mt = GetCurMatrix(); - - CFX_PointF pt = point; - mt.TransformPoint(pt.x, pt.y); - return pt; + return GetCurMatrix().Transform(point); } CFX_PointF CFFL_FormFiller::WndtoPWL(CPDFSDK_PageView* pPageView, diff --git a/fpdfsdk/fpdfview.cpp b/fpdfsdk/fpdfview.cpp index 57d5d4d343..e1fba8df66 100644 --- a/fpdfsdk/fpdfview.cpp +++ b/fpdfsdk/fpdfview.cpp @@ -855,12 +855,11 @@ DLLEXPORT void STDCALL FPDF_DeviceToPage(FPDF_PAGE page, CFX_Matrix device2page; device2page.SetReverse(page2device); - FX_FLOAT page_x_f = static_cast<FX_FLOAT>(device_x); - FX_FLOAT page_y_f = static_cast<FX_FLOAT>(device_y); - device2page.TransformPoint(page_x_f, page_y_f); + CFX_PointF pos = device2page.Transform(CFX_PointF( + static_cast<FX_FLOAT>(device_x), static_cast<FX_FLOAT>(device_y))); - *page_x = page_x_f; - *page_y = page_y_f; + *page_x = pos.x; + *page_y = pos.y; #endif // PDF_ENABLE_XFA } @@ -885,12 +884,11 @@ DLLEXPORT void STDCALL FPDF_PageToDevice(FPDF_PAGE page, #else // PDF_ENABLE_XFA CFX_Matrix page2device = pPage->GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate); - FX_FLOAT device_x_f = static_cast<FX_FLOAT>(page_x); - FX_FLOAT device_y_f = static_cast<FX_FLOAT>(page_y); - page2device.TransformPoint(device_x_f, device_y_f); + CFX_PointF pos = page2device.Transform( + CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y))); - *device_x = FXSYS_round(device_x_f); - *device_y = FXSYS_round(device_y_f); + *device_x = FXSYS_round(pos.x); + *device_y = FXSYS_round(pos.y); #endif // PDF_ENABLE_XFA } diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp index b708a361e5..8b5bb3d279 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_page.cpp @@ -158,12 +158,11 @@ void CPDFXFA_Page::DeviceToPage(int start_x, device2page.SetReverse( GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate)); - FX_FLOAT page_x_f = static_cast<FX_FLOAT>(device_x); - FX_FLOAT page_y_f = static_cast<FX_FLOAT>(device_y); - device2page.TransformPoint(page_x_f, page_y_f); + CFX_PointF pos = device2page.Transform(CFX_PointF( + static_cast<FX_FLOAT>(device_x), static_cast<FX_FLOAT>(device_y))); - *page_x = page_x_f; - *page_y = page_y_f; + *page_x = pos.x; + *page_y = pos.y; } void CPDFXFA_Page::PageToDevice(int start_x, @@ -181,12 +180,11 @@ void CPDFXFA_Page::PageToDevice(int start_x, CFX_Matrix page2device = GetDisplayMatrix(start_x, start_y, size_x, size_y, rotate); - FX_FLOAT device_x_f = static_cast<FX_FLOAT>(page_x); - FX_FLOAT device_y_f = static_cast<FX_FLOAT>(page_y); - page2device.TransformPoint(device_x_f, device_y_f); + CFX_PointF pos = page2device.Transform( + CFX_PointF(static_cast<FX_FLOAT>(page_x), static_cast<FX_FLOAT>(page_y))); - *device_x = FXSYS_round(device_x_f); - *device_y = FXSYS_round(device_y_f); + *device_x = FXSYS_round(pos.x); + *device_y = FXSYS_round(pos.y); } CFX_Matrix CPDFXFA_Page::GetDisplayMatrix(int xPos, diff --git a/fpdfsdk/fxedit/fxet_edit.cpp b/fpdfsdk/fxedit/fxet_edit.cpp index 5b6fd55685..1acc57795a 100644 --- a/fpdfsdk/fxedit/fxet_edit.cpp +++ b/fpdfsdk/fxedit/fxet_edit.cpp @@ -63,10 +63,8 @@ void DrawTextString(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, const CFX_ByteString& str, FX_ARGB crTextFill, - FX_ARGB crTextStroke, int32_t nHorzScale) { - FX_FLOAT x = pt.x, y = pt.y; - pUser2Device->TransformPoint(x, y); + CFX_PointF pos = pUser2Device->Transform(pt); if (pFont) { if (nHorzScale != 100) { @@ -77,44 +75,16 @@ void DrawTextString(CFX_RenderDevice* pDevice, ro.m_Flags = RENDER_CLEARTYPE; ro.m_ColorMode = RENDER_COLOR_NORMAL; - if (crTextStroke != 0) { - CFX_PointF pt1; - CFX_PointF pt2; - pUser2Device->TransformPoint(pt1.x, pt1.y); - pUser2Device->TransformPoint(pt2.x, pt2.y); - CFX_GraphStateData gsd; - gsd.m_LineWidth = - (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y)); - - CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt, - str, crTextFill, crTextStroke, &gsd, - &ro); - } else { - CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, &mt, - str, crTextFill, 0, nullptr, &ro); - } + CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize, + &mt, str, crTextFill, nullptr, &ro); } else { CPDF_RenderOptions ro; ro.m_Flags = RENDER_CLEARTYPE; ro.m_ColorMode = RENDER_COLOR_NORMAL; - if (crTextStroke != 0) { - CFX_PointF pt1; - CFX_PointF pt2; - pUser2Device->TransformPoint(pt1.x, pt1.y); - pUser2Device->TransformPoint(pt2.x, pt2.y); - CFX_GraphStateData gsd; - gsd.m_LineWidth = - (FX_FLOAT)FXSYS_fabs((pt2.x + pt2.y) - (pt1.x + pt1.y)); - - CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, - pUser2Device, str, crTextFill, - crTextStroke, &gsd, &ro); - } else { - CPDF_TextRenderer::DrawTextString(pDevice, x, y, pFont, fFontSize, - pUser2Device, str, crTextFill, 0, - nullptr, &ro); - } + CPDF_TextRenderer::DrawTextString(pDevice, pos.x, pos.y, pFont, fFontSize, + pUser2Device, str, crTextFill, nullptr, + &ro); } } } @@ -748,7 +718,6 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, CFX_Edit* pEdit, FX_COLORREF crTextFill, - FX_COLORREF crTextStroke, const CFX_FloatRect& rcClip, const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, @@ -830,7 +799,7 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, DrawTextString( pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, - sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); + sTextBuf.MakeString(), crOldFill, nHorzScale); sTextBuf.Clear(); } @@ -848,17 +817,17 @@ void CFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, word.ptWord.y + ptOffset.y), pFontMap->GetPDFFont(word.nFontIndex), fFontSize, pUser2Device, GetPDFWordString(pFontMap, word.nFontIndex, word.Word, SubWord), - crCurFill, crTextStroke, nHorzScale); + crCurFill, nHorzScale); } oldplace = place; } } if (sTextBuf.GetLength() > 0) { - DrawTextString( - pDevice, CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), - pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, - sTextBuf.MakeString(), crOldFill, crTextStroke, nHorzScale); + DrawTextString(pDevice, + CFX_PointF(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, + sTextBuf.MakeString(), crOldFill, nHorzScale); } } diff --git a/fpdfsdk/fxedit/fxet_edit.h b/fpdfsdk/fxedit/fxet_edit.h index c8caeb9844..ab83af2e3b 100644 --- a/fpdfsdk/fxedit/fxet_edit.h +++ b/fpdfsdk/fxedit/fxet_edit.h @@ -324,7 +324,6 @@ class CFX_Edit { CFX_Matrix* pUser2Device, CFX_Edit* pEdit, FX_COLORREF crTextFill, - FX_COLORREF crTextStroke, const CFX_FloatRect& rcClip, const CFX_PointF& ptOffset, const CPVT_WordRange* pRange, diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index 4aa3d927d7..f96455e22d 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -266,7 +266,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { m_pEdit->GetPasswordChar()); if (sEditBefore.GetLength() > 0) - sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() + sText << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() << sEditBefore.AsStringC() << "ET\n"; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect); @@ -286,7 +287,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { m_pEdit->GetPasswordChar()); if (sEditAfter.GetLength() > 0) - sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() + sText << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() << sEditAfter.AsStringC() << "ET\n"; if (sText.GetLength() > 0) { @@ -394,9 +396,8 @@ void CPWL_Edit::DrawThisAppearance(CFX_RenderDevice* pDevice, CFX_SystemHandler* pSysHandler = GetSystemHandler(); CFX_Edit::DrawEdit( pDevice, pUser2Device, m_pEdit.get(), - CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor(), GetTransparency()), - rcClip, CFX_PointF(), pRange, pSysHandler, m_pFormFiller); + CPWL_Utils::PWLColorToFXColor(GetTextColor(), GetTransparency()), rcClip, + CFX_PointF(), pRange, pSysHandler, m_pFormFiller); } bool CPWL_Edit::OnLButtonDown(const CFX_PointF& point, uint32_t nFlag) { @@ -491,7 +492,8 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream( CFX_ByteTextBuf sRet; CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit.get(), ptOffset); if (sEdit.GetLength() > 0) { - sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() + sRet << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsStringC() << sEdit.AsStringC() << "ET\n"; } return sRet.MakeString(); diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp index 3f5dfef142..c7e8c9e97c 100644 --- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp +++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp @@ -172,7 +172,6 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, if (pSysHandler && pSysHandler->IsSelectionImplemented()) { CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), CPWL_Utils::PWLColorToFXColor(GetTextColor()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), rcList, ptOffset, nullptr, pSysHandler, m_pFormFiller); pSysHandler->OutputSelectedRect(m_pFormFiller, rcItem); @@ -180,15 +179,14 @@ void CPWL_ListBox::DrawThisAppearance(CFX_RenderDevice* pDevice, CPWL_Utils::DrawFillRect(pDevice, pUser2Device, rcItem, ArgbEncode(255, 0, 51, 113)); CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), - ArgbEncode(255, 255, 255, 255), 0, rcList, ptOffset, + ArgbEncode(255, 255, 255, 255), rcList, ptOffset, nullptr, pSysHandler, m_pFormFiller); } } else { CFX_SystemHandler* pSysHandler = GetSystemHandler(); CFX_Edit::DrawEdit(pDevice, pUser2Device, m_pList->GetItemEdit(i), - CPWL_Utils::PWLColorToFXColor(GetTextColor()), - CPWL_Utils::PWLColorToFXColor(GetTextStrokeColor()), - rcList, ptOffset, nullptr, pSysHandler, nullptr); + CPWL_Utils::PWLColorToFXColor(GetTextColor()), rcList, + ptOffset, nullptr, pSysHandler, nullptr); } } } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/pdfwindow/PWL_Wnd.cpp index f5d97adc19..1f13e2ab6c 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/pdfwindow/PWL_Wnd.cpp @@ -32,7 +32,6 @@ PWL_CREATEPARAM::PWL_CREATEPARAM() dwBorderWidth(1), sBorderColor(), sTextColor(), - sTextStrokeColor(), nTransparency(255), fFontSize(PWL_DEFAULT_FONTSIZE), sDash(3, 0, 0), @@ -559,22 +558,10 @@ void CPWL_Wnd::SetBackgroundColor(const CPWL_Color& color) { m_sPrivateParam.sBackgroundColor = color; } -void CPWL_Wnd::SetTextColor(const CPWL_Color& color) { - m_sPrivateParam.sTextColor = color; -} - -void CPWL_Wnd::SetTextStrokeColor(const CPWL_Color& color) { - m_sPrivateParam.sTextStrokeColor = color; -} - CPWL_Color CPWL_Wnd::GetTextColor() const { return m_sPrivateParam.sTextColor; } -CPWL_Color CPWL_Wnd::GetTextStrokeColor() const { - return m_sPrivateParam.sTextStrokeColor; -} - BorderStyle CPWL_Wnd::GetBorderStyle() const { return m_sPrivateParam.nBorderStyle; } diff --git a/fpdfsdk/pdfwindow/PWL_Wnd.h b/fpdfsdk/pdfwindow/PWL_Wnd.h index 92c099f9cd..9c378f06c5 100644 --- a/fpdfsdk/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/pdfwindow/PWL_Wnd.h @@ -181,7 +181,6 @@ struct PWL_CREATEPARAM { dwBorderWidth = 0; sBorderColor.Reset(); sTextColor.Reset(); - sTextStrokeColor.Reset(); nTransparency = 0; fFontSize = 0.0f; sDash.Reset(); @@ -204,7 +203,6 @@ struct PWL_CREATEPARAM { int32_t dwBorderWidth; // optional CPWL_Color sBorderColor; // optional CPWL_Color sTextColor; // optional - CPWL_Color sTextStrokeColor; // optional int32_t nTransparency; // optional FX_FLOAT fFontSize; // optional CPWL_Dash sDash; // optional @@ -286,15 +284,12 @@ class CPWL_Wnd : public CPWL_TimerHandler { uint32_t msg, intptr_t wParam = 0, intptr_t lParam = 0); - virtual void SetTextColor(const CPWL_Color& color); - virtual void SetTextStrokeColor(const CPWL_Color& color); virtual void SetVisible(bool bVisible); virtual CFX_FloatRect GetFocusRect() const; virtual CPWL_Color GetBackgroundColor() const; virtual CPWL_Color GetBorderColor() const; virtual CPWL_Color GetTextColor() const; - virtual CPWL_Color GetTextStrokeColor() const; virtual FX_FLOAT GetFontSize() const; virtual int32_t GetInnerBorderWidth() const; virtual CPWL_Color GetBorderLeftTopColor(BorderStyle nBorderStyle) const; |