From 17aa0579f9ce11e5433b62ccb66c59b522b4f51e Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 9 Aug 2017 16:09:51 -0400 Subject: Remove CFDE_{Pen|Brush} classes These classes just hold a color value. Instead of creating the class to pass the color we just pass the colors. Change-Id: I7f65ca4100bfbdcb02171c1e7e46150508e338f4 Reviewed-on: https://pdfium-review.googlesource.com/10451 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fxfa/cxfa_textlayout.cpp | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) (limited to 'xfa/fxfa/cxfa_textlayout.cpp') 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(); - auto pPen = pdfium::MakeUnique(); 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(); 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, -- cgit v1.2.3