diff options
author | Dan Sinclair <dsinclair@chromium.org> | 2017-08-14 17:23:25 -0400 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-08-15 13:42:32 +0000 |
commit | 73b492a5d775c05d8c186c8478d1003edfffd34c (patch) | |
tree | 0815bab5627ae27f5eb2f1a45b90bb9dc10b9e1c /xfa/fxfa/cxfa_textlayout.cpp | |
parent | 5f0e64435c97755a7d309e80ea0a4dad83e76e73 (diff) | |
download | pdfium-73b492a5d775c05d8c186c8478d1003edfffd34c.tar.xz |
Remove CFDE_RenderDevice
This CL removes CFDE_RenderDevice. For most of the proxy'd calls we call
the CFX_RenderDevice directly now. To set the clip rect an overload was
added to accept a CFX_RectF and handle the casting to FX_RECT. The one
needed method, DrawString, is move to a static on CFDE_TextOut.
Change-Id: I95ea7e1fa1fd4702074b797c06423c9c9cb51db9
Reviewed-on: https://pdfium-review.googlesource.com/10951
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/cxfa_textlayout.cpp')
-rw-r--r-- | xfa/fxfa/cxfa_textlayout.cpp | 34 |
1 files changed, 20 insertions, 14 deletions
diff --git a/xfa/fxfa/cxfa_textlayout.cpp b/xfa/fxfa/cxfa_textlayout.cpp index d22bee2a79..25bbe45e1b 100644 --- a/xfa/fxfa/cxfa_textlayout.cpp +++ b/xfa/fxfa/cxfa_textlayout.cpp @@ -14,10 +14,11 @@ #include "core/fxcrt/xml/cfx_xmlelement.h" #include "core/fxcrt/xml/cfx_xmlnode.h" #include "core/fxcrt/xml/cfx_xmltext.h" +#include "core/fxge/cfx_graphstatedata.h" #include "core/fxge/cfx_pathdata.h" #include "third_party/base/ptr_util.h" #include "third_party/base/stl_util.h" -#include "xfa/fde/cfde_renderdevice.h" +#include "xfa/fde/cfde_textout.h" #include "xfa/fxfa/cxfa_linkuserdata.h" #include "xfa/fxfa/cxfa_loadercontext.h" #include "xfa/fxfa/cxfa_pieceline.h" @@ -557,9 +558,8 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, if (!pFxDevice) return false; - auto pDevice = pdfium::MakeUnique<CFDE_RenderDevice>(pFxDevice); - pDevice->SaveState(); - pDevice->SetClipRect(rtClip); + pFxDevice->SaveState(); + pFxDevice->SetClip_Rect(rtClip); if (m_pieceLines.empty()) { int32_t iBlockCount = CountBlocks(); @@ -598,13 +598,12 @@ bool CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, iCharCount = iChars; } memset(pCharPos, 0, iCharCount * sizeof(FXTEXT_CHARPOS)); - RenderString(pDevice.get(), pPieceLine, j, pCharPos, tmDoc2Device); - } - for (j = 0; j < iPieces; j++) { - RenderPath(pDevice.get(), pPieceLine, j, pCharPos, tmDoc2Device); + RenderString(pFxDevice, pPieceLine, j, pCharPos, tmDoc2Device); } + for (j = 0; j < iPieces; j++) + RenderPath(pFxDevice, pPieceLine, j, pCharPos, tmDoc2Device); } - pDevice->RestoreState(); + pFxDevice->RestoreState(false); FX_Free(pCharPos); return iPieceLines > 0; } @@ -1137,7 +1136,7 @@ void CXFA_TextLayout::AppendTextLine(CFX_BreakType dwStatus, m_iLines++; } -void CXFA_TextLayout::RenderString(CFDE_RenderDevice* pDevice, +void CXFA_TextLayout::RenderString(CFX_RenderDevice* pDevice, CXFA_PieceLine* pPieceLine, int32_t iPiece, FXTEXT_CHARPOS* pCharPos, @@ -1145,13 +1144,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) { - pDevice->DrawString(pPiece->dwColor, pPiece->pFont, pCharPos, iCount, - pPiece->fFontSize, &tmDoc2Device); + CFDE_TextOut::DrawString(pDevice, pPiece->dwColor, pPiece->pFont, pCharPos, + iCount, pPiece->fFontSize, &tmDoc2Device); } pPieceLine->m_charCounts.push_back(iCount); } -void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, +void CXFA_TextLayout::RenderPath(CFX_RenderDevice* pDevice, CXFA_PieceLine* pPieceLine, int32_t iPiece, FXTEXT_CHARPOS* pCharPos, @@ -1260,7 +1259,14 @@ void CXFA_TextLayout::RenderPath(CFDE_RenderDevice* pDevice, fEndY += 2.0f; } } - pDevice->DrawPath(pPiece->dwColor, 1, path, &tmDoc2Device); + + CFX_GraphStateData graphState; + graphState.m_LineCap = CFX_GraphStateData::LineCapButt; + graphState.m_LineJoin = CFX_GraphStateData::LineJoinMiter; + graphState.m_LineWidth = 1; + graphState.m_MiterLimit = 10; + graphState.m_DashPhase = 0; + pDevice->DrawPath(&path, &tmDoc2Device, &graphState, 0, pPiece->dwColor, 0); } int32_t CXFA_TextLayout::GetDisplayPos(const CXFA_TextPiece* pPiece, |