diff options
-rw-r--r-- | BUILD.gn | 2 | ||||
-rw-r--r-- | xfa/fde/cfde_brush.h | 23 | ||||
-rw-r--r-- | xfa/fde/cfde_pen.h | 24 | ||||
-rw-r--r-- | xfa/fde/cfde_rendercontext.cpp | 10 | ||||
-rw-r--r-- | xfa/fde/cfde_rendercontext.h | 1 | ||||
-rw-r--r-- | xfa/fde/cfde_renderdevice.cpp | 93 | ||||
-rw-r--r-- | xfa/fde/cfde_renderdevice.h | 40 | ||||
-rw-r--r-- | xfa/fde/cfde_textout.cpp | 15 | ||||
-rw-r--r-- | xfa/fde/cfde_textout.h | 3 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_textlayout.cpp | 18 | ||||
-rw-r--r-- | xfa/fxfa/cxfa_textlayout.h | 4 |
11 files changed, 66 insertions, 167 deletions
@@ -1452,10 +1452,8 @@ if (pdf_enable_xfa) { pdf_source_set("xfa") { sources = [ - "xfa/fde/cfde_brush.h", "xfa/fde/cfde_path.cpp", "xfa/fde/cfde_path.h", - "xfa/fde/cfde_pen.h", "xfa/fde/cfde_rendercontext.cpp", "xfa/fde/cfde_rendercontext.h", "xfa/fde/cfde_renderdevice.cpp", diff --git a/xfa/fde/cfde_brush.h b/xfa/fde/cfde_brush.h deleted file mode 100644 index 7a070c8605..0000000000 --- a/xfa/fde/cfde_brush.h +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FDE_CFDE_BRUSH_H_ -#define XFA_FDE_CFDE_BRUSH_H_ - -#include "core/fxge/fx_dib.h" - -class CFDE_Brush { - public: - CFDE_Brush() : m_Color(0xFF000000) {} - - FX_ARGB GetColor() const { return m_Color; } - void SetColor(FX_ARGB color) { m_Color = color; } - - private: - FX_ARGB m_Color; -}; - -#endif // XFA_FDE_CFDE_BRUSH_H_ diff --git a/xfa/fde/cfde_pen.h b/xfa/fde/cfde_pen.h deleted file mode 100644 index ac49571bd0..0000000000 --- a/xfa/fde/cfde_pen.h +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 PDFium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com - -#ifndef XFA_FDE_CFDE_PEN_H_ -#define XFA_FDE_CFDE_PEN_H_ - -#include "core/fxge/fx_dib.h" - -class CFDE_Pen { - public: - CFDE_Pen() : m_Color(0) {} - ~CFDE_Pen() {} - - FX_ARGB GetColor() const { return m_Color; } - void SetColor(FX_ARGB color) { m_Color = color; } - - private: - FX_ARGB m_Color; -}; - -#endif // XFA_FDE_CFDE_PEN_H_ diff --git a/xfa/fde/cfde_rendercontext.cpp b/xfa/fde/cfde_rendercontext.cpp index dc2a628c23..7e7baebee2 100644 --- a/xfa/fde/cfde_rendercontext.cpp +++ b/xfa/fde/cfde_rendercontext.cpp @@ -8,7 +8,6 @@ #include "third_party/base/logging.h" #include "third_party/base/ptr_util.h" -#include "xfa/fde/cfde_brush.h" #include "xfa/fde/cfde_renderdevice.h" #include "xfa/fde/cfde_txtedttextset.h" @@ -83,15 +82,10 @@ void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet, int32_t iCount = pTextSet->GetDisplayPos(*pText, nullptr, false); if (iCount < 1) return; - if (!m_pBrush) - m_pBrush = pdfium::MakeUnique<CFDE_Brush>(); if (m_CharPos.size() < static_cast<size_t>(iCount)) m_CharPos.resize(iCount, FXTEXT_CHARPOS()); iCount = pTextSet->GetDisplayPos(*pText, m_CharPos.data(), false); - float fFontSize = pTextSet->GetFontSize(); - FX_ARGB dwColor = pTextSet->GetFontColor(); - m_pBrush->SetColor(dwColor); - m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_CharPos.data(), iCount, - fFontSize, &m_Transform); + m_pRenderDevice->DrawString(pTextSet->GetFontColor(), pFont, m_CharPos.data(), + iCount, pTextSet->GetFontSize(), &m_Transform); } diff --git a/xfa/fde/cfde_rendercontext.h b/xfa/fde/cfde_rendercontext.h index 7f54e28c6d..3823255e95 100644 --- a/xfa/fde/cfde_rendercontext.h +++ b/xfa/fde/cfde_rendercontext.h @@ -34,7 +34,6 @@ class CFDE_RenderContext { CFDE_RenderDevice* m_pRenderDevice; CFX_Matrix m_Transform; std::vector<FXTEXT_CHARPOS> m_CharPos; - std::unique_ptr<CFDE_Brush> m_pBrush; std::unique_ptr<CFDE_VisualSetIterator> m_pIterator; }; diff --git a/xfa/fde/cfde_renderdevice.cpp b/xfa/fde/cfde_renderdevice.cpp index ec1fc2fed1..8a1b980724 100644 --- a/xfa/fde/cfde_renderdevice.cpp +++ b/xfa/fde/cfde_renderdevice.cpp @@ -15,9 +15,7 @@ #include "core/fxge/cfx_substfont.h" #include "core/fxge/dib/cfx_imagerenderer.h" #include "third_party/base/ptr_util.h" -#include "xfa/fde/cfde_brush.h" #include "xfa/fde/cfde_path.h" -#include "xfa/fde/cfde_pen.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #include "xfa/fgas/font/cfgas_gefont.h" @@ -117,15 +115,14 @@ bool CFDE_RenderDevice::DrawImage(const CFX_RetainPtr<CFX_DIBSource>& pDib, return !!handle; } -bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, +bool CFDE_RenderDevice::DrawString(FX_ARGB color, const CFX_RetainPtr<CFGAS_GEFont>& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, float fFontSize, const CFX_Matrix* pMatrix) { - ASSERT(pBrush && pFont && pCharPos && iCount > 0); + ASSERT(pFont && pCharPos && iCount > 0); CFX_Font* pFxFont = pFont->GetDevFont(); - FX_ARGB argb = pBrush->GetColor(); if ((pFont->GetFontStyles() & FX_FONTSTYLE_Italic) != 0 && !pFxFont->IsItalic()) { FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; @@ -165,10 +162,10 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, #if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ FxFont.SetFace(pFxFont->GetFace()); m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize, - pMatrix, argb, FXTEXT_CLEARTYPE); + pMatrix, color, FXTEXT_CLEARTYPE); #else m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, - pMatrix, argb, FXTEXT_CLEARTYPE); + pMatrix, color, FXTEXT_CLEARTYPE); #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ } pCurFont = pSTFont; @@ -185,12 +182,12 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, FxFont.SetFace(pFxFont->GetFace()); bool bRet = m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize, - pMatrix, argb, FXTEXT_CLEARTYPE); + pMatrix, color, FXTEXT_CLEARTYPE); FxFont.SetFace(nullptr); return bRet; #else return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, - pMatrix, argb, FXTEXT_CLEARTYPE); + pMatrix, color, FXTEXT_CLEARTYPE); #endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ } @@ -201,7 +198,7 @@ bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, return true; } -bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, +bool CFDE_RenderDevice::DrawBezier(FX_ARGB color, float fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, @@ -215,10 +212,10 @@ bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, points.push_back(pt4); CFDE_Path path; path.AddBezier(points); - return DrawPath(pPen, fPenWidth, &path, pMatrix); + return DrawPath(color, fPenWidth, &path, pMatrix); } -bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, +bool CFDE_RenderDevice::DrawCurve(FX_ARGB color, float fPenWidth, const std::vector<CFX_PointF>& points, bool bClosed, @@ -226,38 +223,38 @@ bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddCurve(points, bClosed, fTension); - return DrawPath(pPen, fPenWidth, &path, pMatrix); + return DrawPath(color, fPenWidth, &path, pMatrix); } -bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, +bool CFDE_RenderDevice::DrawEllipse(FX_ARGB color, float fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddEllipse(rect); - return DrawPath(pPen, fPenWidth, &path, pMatrix); + return DrawPath(color, fPenWidth, &path, pMatrix); } -bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, +bool CFDE_RenderDevice::DrawLines(FX_ARGB color, float fPenWidth, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddLines(points); - return DrawPath(pPen, fPenWidth, &path, pMatrix); + return DrawPath(color, fPenWidth, &path, pMatrix); } -bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, +bool CFDE_RenderDevice::DrawLine(FX_ARGB color, float fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddLine(pt1, pt2); - return DrawPath(pPen, fPenWidth, &path, pMatrix); + return DrawPath(color, fPenWidth, &path, pMatrix); } -bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen, +bool CFDE_RenderDevice::DrawPath(FX_ARGB color, float fPenWidth, const CFDE_Path* pPath, const CFX_Matrix* pMatrix) { @@ -266,86 +263,72 @@ bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen, return false; CFX_GraphStateData graphState; - if (!CreatePen(pPen, fPenWidth, graphState)) { - return false; - } + graphState.m_LineCap = CFX_GraphStateData::LineCapButt; + graphState.m_LineJoin = CFX_GraphStateData::LineJoinMiter; + graphState.m_LineWidth = fPenWidth; + graphState.m_MiterLimit = 10; + graphState.m_DashPhase = 0; return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix, - &graphState, 0, pPen->GetColor(), 0); + &graphState, 0, color, 0); } -bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, +bool CFDE_RenderDevice::DrawPolygon(FX_ARGB color, float fPenWidth, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddPolygon(points); - return DrawPath(pPen, fPenWidth, &path, pMatrix); + return DrawPath(color, fPenWidth, &path, pMatrix); } -bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, +bool CFDE_RenderDevice::DrawRectangle(FX_ARGB color, float fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddRectangle(rect); - return DrawPath(pPen, fPenWidth, &path, pMatrix); + return DrawPath(color, fPenWidth, &path, pMatrix); } -bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush, +bool CFDE_RenderDevice::FillClosedCurve(FX_ARGB color, const std::vector<CFX_PointF>& points, float fTension, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddCurve(points, true, fTension); - return FillPath(pBrush, &path, pMatrix); + return FillPath(color, &path, pMatrix); } -bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush, +bool CFDE_RenderDevice::FillEllipse(FX_ARGB color, const CFX_RectF& rect, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddEllipse(rect); - return FillPath(pBrush, &path, pMatrix); + return FillPath(color, &path, pMatrix); } -bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush, +bool CFDE_RenderDevice::FillPolygon(FX_ARGB color, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddPolygon(points); - return FillPath(pBrush, &path, pMatrix); + return FillPath(color, &path, pMatrix); } -bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush, +bool CFDE_RenderDevice::FillRectangle(FX_ARGB color, const CFX_RectF& rect, const CFX_Matrix* pMatrix) { CFDE_Path path; path.AddRectangle(rect); - return FillPath(pBrush, &path, pMatrix); + return FillPath(color, &path, pMatrix); } -bool CFDE_RenderDevice::CreatePen(CFDE_Pen* pPen, - float fPenWidth, - CFX_GraphStateData& graphState) { - if (!pPen) - return false; - - graphState.m_LineCap = CFX_GraphStateData::LineCapButt; - graphState.m_LineJoin = CFX_GraphStateData::LineJoinMiter; - graphState.m_LineWidth = fPenWidth; - graphState.m_MiterLimit = 10; - graphState.m_DashPhase = 0; - return true; -} - -bool CFDE_RenderDevice::FillPath(CFDE_Brush* pBrush, +bool CFDE_RenderDevice::FillPath(FX_ARGB color, const CFDE_Path* pPath, const CFX_Matrix* pMatrix) { CFDE_Path* pGePath = (CFDE_Path*)pPath; if (!pGePath) return false; - if (!pBrush) - return false; - return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, - pBrush->GetColor(), 0, FXFILL_WINDING); + return m_pDevice->DrawPath(&pGePath->m_Path, pMatrix, nullptr, color, 0, + FXFILL_WINDING); } diff --git a/xfa/fde/cfde_renderdevice.h b/xfa/fde/cfde_renderdevice.h index d9f4ce0d34..a372c23f9d 100644 --- a/xfa/fde/cfde_renderdevice.h +++ b/xfa/fde/cfde_renderdevice.h @@ -12,9 +12,7 @@ #include "core/fxge/cfx_renderdevice.h" #include "xfa/fgas/font/cfgas_gefont.h" -class CFDE_Brush; class CFDE_Path; -class CFDE_Pen; class CFX_GraphStateData; class CFDE_RenderDevice { @@ -39,85 +37,81 @@ class CFDE_RenderDevice { const CFX_RectF& dstRect, const CFX_Matrix* pImgMatrix = nullptr, const CFX_Matrix* pDevMatrix = nullptr); - bool DrawString(CFDE_Brush* pBrush, + bool DrawString(FX_ARGB color, const CFX_RetainPtr<CFGAS_GEFont>& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, float fFontSize, const CFX_Matrix* pMatrix = nullptr); - bool DrawBezier(CFDE_Pen* pPen, + bool DrawBezier(FX_ARGB color, float fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, const CFX_PointF& pt3, const CFX_PointF& pt4, const CFX_Matrix* pMatrix = nullptr); - bool DrawCurve(CFDE_Pen* pPen, + bool DrawCurve(FX_ARGB color, float fPenWidth, const std::vector<CFX_PointF>& points, bool bClosed, float fTension = 0.5f, const CFX_Matrix* pMatrix = nullptr); - bool DrawEllipse(CFDE_Pen* pPen, + bool DrawEllipse(FX_ARGB color, float fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix = nullptr); - bool DrawLines(CFDE_Pen* pPen, + bool DrawLines(FX_ARGB color, float fPenWidth, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix = nullptr); - bool DrawLine(CFDE_Pen* pPen, + bool DrawLine(FX_ARGB color, float fPenWidth, const CFX_PointF& pt1, const CFX_PointF& pt2, const CFX_Matrix* pMatrix = nullptr); - bool DrawPath(CFDE_Pen* pPen, + bool DrawPath(FX_ARGB color, float fPenWidth, const CFDE_Path* pPath, const CFX_Matrix* pMatrix = nullptr); - bool DrawPolygon(CFDE_Pen* pPen, + bool DrawPolygon(FX_ARGB color, float fPenWidth, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix = nullptr); - bool DrawRectangle(CFDE_Pen* pPen, + bool DrawRectangle(FX_ARGB color, float fPenWidth, const CFX_RectF& rect, const CFX_Matrix* pMatrix = nullptr); - bool FillClosedCurve(CFDE_Brush* pBrush, + bool FillClosedCurve(FX_ARGB color, const std::vector<CFX_PointF>& points, float fTension = 0.5f, const CFX_Matrix* pMatrix = nullptr); - bool FillEllipse(CFDE_Brush* pBrush, + bool FillEllipse(FX_ARGB color, const CFX_RectF& rect, const CFX_Matrix* pMatrix = nullptr); - bool FillPath(CFDE_Brush* pBrush, + bool FillPath(FX_ARGB color, const CFDE_Path* pPath, const CFX_Matrix* pMatrix = nullptr); - bool FillPolygon(CFDE_Brush* pBrush, + bool FillPolygon(FX_ARGB color, const std::vector<CFX_PointF>& points, const CFX_Matrix* pMatrix = nullptr); - bool FillRectangle(CFDE_Brush* pBrush, + bool FillRectangle(FX_ARGB color, const CFX_RectF& rect, const CFX_Matrix* pMatrix = nullptr); - bool DrawSolidString(CFDE_Brush* pBrush, + bool DrawSolidString(FX_ARGB color, const CFX_RetainPtr<CFGAS_GEFont>& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, float fFontSize, const CFX_Matrix* pMatrix); - bool DrawStringPath(CFDE_Brush* pBrush, + bool DrawStringPath(FX_ARGB color, const CFX_RetainPtr<CFGAS_GEFont>& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, float fFontSize, const CFX_Matrix* pMatrix); - protected: - bool CreatePen(CFDE_Pen* pPen, - float fPenWidth, - CFX_GraphStateData& graphState); - + private: CFX_RenderDevice* const m_pDevice; CFX_RectF m_rtClip; int32_t m_iCharCount; diff --git a/xfa/fde/cfde_textout.cpp b/xfa/fde/cfde_textout.cpp index 5d84b6d12b..202074bdc4 100644 --- a/xfa/fde/cfde_textout.cpp +++ b/xfa/fde/cfde_textout.cpp @@ -13,9 +13,7 @@ #include "core/fxcrt/fx_system.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fde/cfde_brush.h" #include "xfa/fde/cfde_path.h" -#include "xfa/fde/cfde_pen.h" #include "xfa/fde/cfde_renderdevice.h" #include "xfa/fgas/layout/cfx_txtbreak.h" @@ -651,15 +649,10 @@ void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) { if (!m_pRenderDevice || m_ttoLines.empty()) return; - auto pBrush = pdfium::MakeUnique<CFDE_Brush>(); - pBrush->SetColor(m_TxtColor); m_pRenderDevice->SaveState(); if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) m_pRenderDevice->SetClipRect(rtClip); - auto pPen = pdfium::MakeUnique<CFDE_Pen>(); - pPen->SetColor(m_TxtColor); - for (auto& line : m_ttoLines) { int32_t iPieces = line.GetSize(); for (int32_t j = 0; j < iPieces; j++) { @@ -669,10 +662,10 @@ void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) { int32_t iCount = GetDisplayPos(pPiece); if (iCount > 0) { - m_pRenderDevice->DrawString(pBrush.get(), m_pFont, m_CharPos.data(), + m_pRenderDevice->DrawString(m_TxtColor, m_pFont, m_CharPos.data(), iCount, m_fFontSize, &m_Matrix); } - DrawLine(pPiece, pPen.get()); + DrawLine(pPiece, m_TxtColor); } } m_pRenderDevice->RestoreState(); @@ -704,7 +697,7 @@ FX_TXTRUN CFDE_TextOut::ToTextRun(const FDE_TTOPIECE* pPiece) { return tr; } -void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen* pPen) { +void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, FX_ARGB color) { bool bUnderLine = !!(m_dwStyles & FDE_TTOSTYLE_Underline); bool bStrikeOut = !!(m_dwStyles & FDE_TTOSTYLE_Strikeout); bool bHotKey = !!(m_dwStyles & FDE_TTOSTYLE_HotKey); @@ -748,7 +741,7 @@ void CFDE_TextOut::DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen* pPen) { } } if (iLineCount > 0) - m_pRenderDevice->DrawPath(pPen, 1, pPath.get(), &m_Matrix); + m_pRenderDevice->DrawPath(color, 1, pPath.get(), &m_Matrix); } CFDE_TTOLine::CFDE_TTOLine() : m_bNewReload(false) {} diff --git a/xfa/fde/cfde_textout.h b/xfa/fde/cfde_textout.h index a52814041b..98a7d11cd4 100644 --- a/xfa/fde/cfde_textout.h +++ b/xfa/fde/cfde_textout.h @@ -37,7 +37,6 @@ #define FDE_TTOALIGNMENT_BottomRight 10 #define FDE_TTOALIGNMENT_BottomAuto 11 -class CFDE_Pen; class CFDE_RenderDevice; class CFX_RenderDevice; class CFX_TxtBreak; @@ -139,7 +138,7 @@ class CFDE_TextOut { int32_t GetCharRects(const FDE_TTOPIECE* pPiece); FX_TXTRUN ToTextRun(const FDE_TTOPIECE* pPiece); - void DrawLine(const FDE_TTOPIECE* pPiece, CFDE_Pen* pPen); + void DrawLine(const FDE_TTOPIECE* pPiece, FX_ARGB color); std::unique_ptr<CFX_TxtBreak> m_pTxtBreak; CFX_RetainPtr<CFGAS_GEFont> m_pFont; diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index 125c73a11d..05cc165d52 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -16,9 +16,7 @@ #include "core/fxcrt/xml/cfx_xmltext.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fde/cfde_brush.h" #include "xfa/fde/cfde_path.h" -#include "xfa/fde/cfde_pen.h" #include "xfa/fde/cfde_renderdevice.h" #include "xfa/fxfa/cxfa_linkuserdata.h" #include "xfa/fxfa/cxfa_loadercontext.h" @@ -563,8 +561,6 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, pDevice->SaveState(); pDevice->SetClipRect(rtClip); - auto pSolidBrush = pdfium::MakeUnique<CFDE_Brush>(); - auto pPen = pdfium::MakeUnique<CFDE_Pen>(); if (m_pieceLines.empty()) { int32_t iBlockCount = CountBlocks(); for (int32_t i = 0; i < iBlockCount; i++) @@ -602,12 +598,10 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, iCharCount = iChars; } memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS)); - RenderString(pDevice.get(), pSolidBrush.get(), pPieceLine, j, pCharPos, - tmDoc2Device); + RenderString(pDevice.get(), pPieceLine, j, pCharPos, tmDoc2Device); } for (j = 0; j < iPieces; j++) { - RenderPath(pDevice.get(), pPen.get(), pPieceLine, j, pCharPos, - tmDoc2Device); + RenderPath(pDevice.get(), pPieceLine, j, pCharPos, tmDoc2Device); } } pDevice->RestoreState(); @@ -1144,7 +1138,6 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, } void CXFA_TextLayout::RenderString(CFDE_RenderDevice* pDevice, - CFDE_Brush* pBrush, CXFA_PieceLine* pPieceLine, int32_t iPiece, FXTEXT_CHARPOS* pCharPos, @@ -1152,15 +1145,13 @@ void CXFA_TextLayout::RenderString(CFDE_RenderDevice* pDevice, const CXFA_TextPiece* pPiece = pPieceLine->m_textPieces[iPiece].get(); int32_t iCount = GetDisplayPos(pPiece, pCharPos); if (iCount > 0) { - pBrush->SetColor(pPiece->dwColor); - pDevice->DrawString(pBrush, pPiece->pFont, pCharPos, iCount, + pDevice->DrawString(pPiece->dwColor, pPiece->pFont, pCharPos, iCount, pPiece->fFontSize, &tmDoc2Device); } pPieceLine->m_charCounts.push_back(iCount); } void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, - CFDE_Pen* pPen, CXFA_PieceLine* pPieceLine, int32_t iPiece, FXTEXT_CHARPOS* pCharPos, @@ -1171,7 +1162,6 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, if (bNoUnderline && bNoLineThrough) return; - pPen->SetColor(pPiece->dwColor); auto pPath = pdfium::MakeUnique<CFDE_Path>(); int32_t iChars = GetDisplayPos(pPiece, pCharPos); if (iChars > 0) { @@ -1270,7 +1260,7 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, fEndY += 2.0f; } } - pDevice->DrawPath(pPen, 1, pPath.get(), &tmDoc2Device); + pDevice->DrawPath(pPiece->dwColor, 1, pPath.get(), &tmDoc2Device); } int32_t CXFA_TextLayout::GetDisplayPos(const CXFA_TextPiece* pPiece, diff --git a/xfa/fxfa/cxfa_textlayout.h b/xfa/fxfa/cxfa_textlayout.h index 642fa25dd9..d2ff0d21ea 100644 --- a/xfa/fxfa/cxfa_textlayout.h +++ b/xfa/fxfa/cxfa_textlayout.h @@ -17,9 +17,7 @@ #include "xfa/fgas/layout/cfx_rtfbreak.h" #include "xfa/fxfa/cxfa_textparser.h" -class CFDE_Brush; class CFX_CSSComputedStyle; -class CFDE_Pen; class CFDE_RenderDevice; class CFX_XMLNode; class CFX_RTFBreak; @@ -101,13 +99,11 @@ class CXFA_TextLayout { void ProcessText(CFX_WideString& wsText); void UpdateAlign(float fHeight, float fBottom); void RenderString(CFDE_RenderDevice* pDevice, - CFDE_Brush* pBrush, CXFA_PieceLine* pPieceLine, int32_t iPiece, FXTEXT_CHARPOS* pCharPos, const CFX_Matrix& tmDoc2Device); void RenderPath(CFDE_RenderDevice* pDevice, - CFDE_Pen* pPen, CXFA_PieceLine* pPieceLine, int32_t iPiece, FXTEXT_CHARPOS* pCharPos, |