From d9828fd1653f0334c4e9b027d708dbc3df8c838a Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Thu, 30 Mar 2017 10:58:49 -0400 Subject: Rename FDE files to match contents. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This CL renames files in xfa/fde to match the contents. The fde_object.h file is split apart into cfde_pen and cfde_brush. Change-Id: I953f102182caa6d87c5ee9b99bbeb01c34a01aa9 Reviewed-on: https://pdfium-review.googlesource.com/3371 Reviewed-by: Nicolás Peña Commit-Queue: dsinclair --- xfa/fde/cfde_brush.h | 23 +++ xfa/fde/cfde_path.cpp | 1 - xfa/fde/cfde_pen.h | 24 +++ xfa/fde/cfde_rendercontext.cpp | 128 +++++++++++++ xfa/fde/cfde_rendercontext.h | 50 ++++++ xfa/fde/cfde_renderdevice.cpp | 355 +++++++++++++++++++++++++++++++++++++ xfa/fde/cfde_renderdevice.h | 127 +++++++++++++ xfa/fde/cfde_txtedtpage.h | 2 +- xfa/fde/cfde_txtedttextset.h | 2 +- xfa/fde/cfde_visualsetiterator.cpp | 94 ++++++++++ xfa/fde/cfde_visualsetiterator.h | 40 +++++ xfa/fde/fde_gedevice.cpp | 355 ------------------------------------- xfa/fde/fde_gedevice.h | 127 ------------- xfa/fde/fde_iterator.cpp | 94 ---------- xfa/fde/fde_iterator.h | 40 ----- xfa/fde/fde_object.h | 37 ---- xfa/fde/fde_render.cpp | 129 -------------- xfa/fde/fde_render.h | 50 ------ xfa/fde/fde_visualset.h | 50 ------ xfa/fde/ifde_visualset.h | 49 +++++ xfa/fde/tto/fde_textout.cpp | 7 +- xfa/fde/tto/fde_textout.h | 2 +- 22 files changed, 898 insertions(+), 888 deletions(-) create mode 100644 xfa/fde/cfde_brush.h create mode 100644 xfa/fde/cfde_pen.h create mode 100644 xfa/fde/cfde_rendercontext.cpp create mode 100644 xfa/fde/cfde_rendercontext.h create mode 100644 xfa/fde/cfde_renderdevice.cpp create mode 100644 xfa/fde/cfde_renderdevice.h create mode 100644 xfa/fde/cfde_visualsetiterator.cpp create mode 100644 xfa/fde/cfde_visualsetiterator.h delete mode 100644 xfa/fde/fde_gedevice.cpp delete mode 100644 xfa/fde/fde_gedevice.h delete mode 100644 xfa/fde/fde_iterator.cpp delete mode 100644 xfa/fde/fde_iterator.h delete mode 100644 xfa/fde/fde_object.h delete mode 100644 xfa/fde/fde_render.cpp delete mode 100644 xfa/fde/fde_render.h delete mode 100644 xfa/fde/fde_visualset.h create mode 100644 xfa/fde/ifde_visualset.h (limited to 'xfa/fde') diff --git a/xfa/fde/cfde_brush.h b/xfa/fde/cfde_brush.h new file mode 100644 index 0000000000..7a070c8605 --- /dev/null +++ b/xfa/fde/cfde_brush.h @@ -0,0 +1,23 @@ +// 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_path.cpp b/xfa/fde/cfde_path.cpp index 32f67e31a0..4afa718978 100644 --- a/xfa/fde/cfde_path.cpp +++ b/xfa/fde/cfde_path.cpp @@ -7,7 +7,6 @@ #include "xfa/fde/cfde_path.h" #include "third_party/base/stl_util.h" -#include "xfa/fde/fde_object.h" void CFDE_Path::CloseFigure() { m_Path.ClosePath(); diff --git a/xfa/fde/cfde_pen.h b/xfa/fde/cfde_pen.h new file mode 100644 index 0000000000..ac49571bd0 --- /dev/null +++ b/xfa/fde/cfde_pen.h @@ -0,0 +1,24 @@ +// 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 new file mode 100644 index 0000000000..2e690e0ed9 --- /dev/null +++ b/xfa/fde/cfde_rendercontext.cpp @@ -0,0 +1,128 @@ +// Copyright 2014 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 + +#include "xfa/fde/cfde_rendercontext.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" + +#define FDE_PATHRENDER_Stroke 1 +#define FDE_PATHRENDER_Fill 2 + +CFDE_RenderContext::CFDE_RenderContext() + : m_eStatus(FDE_RENDERSTATUS_Reset), + m_pRenderDevice(nullptr), + m_Transform() { + m_Transform.SetIdentity(); +} + +CFDE_RenderContext::~CFDE_RenderContext() { + StopRender(); +} + +bool CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice, + CFDE_TxtEdtPage* pCanvasSet, + const CFX_Matrix& tmDoc2Device) { + if (m_pRenderDevice) + return false; + if (!pRenderDevice) + return false; + if (!pCanvasSet) + return false; + + m_eStatus = FDE_RENDERSTATUS_Paused; + m_pRenderDevice = pRenderDevice; + m_Transform = tmDoc2Device; + if (!m_pIterator) + m_pIterator = pdfium::MakeUnique(); + + return m_pIterator->AttachCanvas(pCanvasSet) && m_pIterator->FilterObjects(); +} + +FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) { + if (!m_pRenderDevice) + return FDE_RENDERSTATUS_Failed; + if (!m_pIterator) + return FDE_RENDERSTATUS_Failed; + + FDE_RENDERSTATUS eStatus = FDE_RENDERSTATUS_Paused; + CFX_Matrix rm; + rm.SetReverse(m_Transform); + CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect(); + if (rtDocClip.IsEmpty()) { + rtDocClip.left = rtDocClip.top = 0; + rtDocClip.width = (float)m_pRenderDevice->GetWidth(); + rtDocClip.height = (float)m_pRenderDevice->GetHeight(); + } + rm.TransformRect(rtDocClip); + IFDE_VisualSet* pVisualSet; + FDE_TEXTEDITPIECE* pPiece; + int32_t iCount = 0; + while (true) { + pPiece = m_pIterator->GetNext(pVisualSet); + if (!pPiece || !pVisualSet) { + eStatus = FDE_RENDERSTATUS_Done; + break; + } + if (!rtDocClip.IntersectWith(pVisualSet->GetRect(*pPiece))) + continue; + + switch (pVisualSet->GetType()) { + case FDE_VISUALOBJ_Text: + RenderText(static_cast(pVisualSet), pPiece); + iCount += 5; + break; + case FDE_VISUALOBJ_Canvas: + ASSERT(false); + break; + default: + break; + } + if (iCount >= 100 && pPause && pPause->NeedToPauseNow()) { + eStatus = FDE_RENDERSTATUS_Paused; + break; + } + } + return m_eStatus = eStatus; +} + +void CFDE_RenderContext::StopRender() { + m_eStatus = FDE_RENDERSTATUS_Reset; + m_pRenderDevice = nullptr; + m_Transform.SetIdentity(); + m_pIterator.reset(); + m_pBrush.reset(); + m_CharPos.clear(); +} + +void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet, + FDE_TEXTEDITPIECE* pText) { + ASSERT(m_pRenderDevice); + ASSERT(pTextSet && pText); + + CFX_RetainPtr pFont = pTextSet->GetFont(); + if (!pFont) + return; + + int32_t iCount = pTextSet->GetDisplayPos(*pText, nullptr, false); + if (iCount < 1) + return; + + if (!m_pBrush) + m_pBrush = pdfium::MakeUnique(); + + if (m_CharPos.size() < static_cast(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); +} diff --git a/xfa/fde/cfde_rendercontext.h b/xfa/fde/cfde_rendercontext.h new file mode 100644 index 0000000000..28b8780052 --- /dev/null +++ b/xfa/fde/cfde_rendercontext.h @@ -0,0 +1,50 @@ +// Copyright 2014 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_RENDERCONTEXT_H_ +#define XFA_FDE_CFDE_RENDERCONTEXT_H_ + +#include +#include + +#include "core/fxcrt/fx_coordinates.h" +#include "xfa/fde/cfde_renderdevice.h" +#include "xfa/fde/cfde_visualsetiterator.h" +#include "xfa/fde/ifde_visualset.h" + +class CFDE_RenderDevice; +class CFDE_TxtEdtTextSet; + +enum FDE_RENDERSTATUS { + FDE_RENDERSTATUS_Reset = 0, + FDE_RENDERSTATUS_Paused, + FDE_RENDERSTATUS_Done, + FDE_RENDERSTATUS_Failed, +}; + +class CFDE_RenderContext { + public: + CFDE_RenderContext(); + ~CFDE_RenderContext(); + + bool StartRender(CFDE_RenderDevice* pRenderDevice, + CFDE_TxtEdtPage* pCanvasSet, + const CFX_Matrix& tmDoc2Device); + FDE_RENDERSTATUS GetStatus() const { return m_eStatus; } + FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr); + void StopRender(); + void RenderText(CFDE_TxtEdtTextSet* pTextSet, FDE_TEXTEDITPIECE* pText); + + protected: + FDE_RENDERSTATUS m_eStatus; + CFDE_RenderDevice* m_pRenderDevice; + CFX_Matrix m_Transform; + std::vector m_CharPos; + std::unique_ptr m_pBrush; + std::unique_ptr m_pIterator; +}; + +#endif // XFA_FDE_CFDE_RENDERCONTEXT_H_ diff --git a/xfa/fde/cfde_renderdevice.cpp b/xfa/fde/cfde_renderdevice.cpp new file mode 100644 index 0000000000..d3456e17cb --- /dev/null +++ b/xfa/fde/cfde_renderdevice.cpp @@ -0,0 +1,355 @@ +// Copyright 2014 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 + +#include "xfa/fde/cfde_renderdevice.h" + +#include +#include + +#include "core/fxge/cfx_gemodule.h" +#include "core/fxge/cfx_graphstatedata.h" +#include "core/fxge/cfx_renderdevice.h" +#include "core/fxge/cfx_substfont.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" + +CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, + bool bOwnerDevice) + : m_pDevice(pDevice), m_bOwnerDevice(bOwnerDevice), m_iCharCount(0) { + ASSERT(pDevice); + + FX_RECT rt = m_pDevice->GetClipBox(); + m_rtClip = CFX_RectF(static_cast(rt.left), static_cast(rt.top), + static_cast(rt.Width()), + static_cast(rt.Height())); +} + +CFDE_RenderDevice::~CFDE_RenderDevice() { + if (m_bOwnerDevice) + delete m_pDevice; +} + +int32_t CFDE_RenderDevice::GetWidth() const { + return m_pDevice->GetWidth(); +} + +int32_t CFDE_RenderDevice::GetHeight() const { + return m_pDevice->GetHeight(); +} + +void CFDE_RenderDevice::SaveState() { + m_pDevice->SaveState(); +} + +void CFDE_RenderDevice::RestoreState() { + m_pDevice->RestoreState(false); + const FX_RECT& rt = m_pDevice->GetClipBox(); + m_rtClip = CFX_RectF(static_cast(rt.left), static_cast(rt.top), + static_cast(rt.Width()), + static_cast(rt.Height())); +} + +bool CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) { + m_rtClip = rtClip; + return m_pDevice->SetClip_Rect(FX_RECT((int32_t)FXSYS_floor(rtClip.left), + (int32_t)FXSYS_floor(rtClip.top), + (int32_t)FXSYS_ceil(rtClip.right()), + (int32_t)FXSYS_ceil(rtClip.bottom()))); +} + +const CFX_RectF& CFDE_RenderDevice::GetClipRect() { + return m_rtClip; +} + +bool CFDE_RenderDevice::SetClipPath(const CFDE_Path* pClip) { + return false; +} + +CFDE_Path* CFDE_RenderDevice::GetClipPath() const { + return nullptr; +} + +float CFDE_RenderDevice::GetDpiX() const { + return 96; +} + +float CFDE_RenderDevice::GetDpiY() const { + return 96; +} + +bool CFDE_RenderDevice::DrawImage(const CFX_RetainPtr& pDib, + const CFX_RectF* pSrcRect, + const CFX_RectF& dstRect, + const CFX_Matrix* pImgMatrix, + const CFX_Matrix* pDevMatrix) { + CFX_RectF srcRect; + if (pSrcRect) { + srcRect = *pSrcRect; + } else { + srcRect = CFX_RectF(0, 0, static_cast(pDib->GetWidth()), + static_cast(pDib->GetHeight())); + } + + if (srcRect.IsEmpty()) + return false; + + CFX_Matrix dib2fxdev; + if (pImgMatrix) { + dib2fxdev = *pImgMatrix; + } else { + dib2fxdev.SetIdentity(); + } + dib2fxdev.a = dstRect.width; + dib2fxdev.d = -dstRect.height; + dib2fxdev.e = dstRect.left; + dib2fxdev.f = dstRect.bottom(); + if (pDevMatrix) { + dib2fxdev.Concat(*pDevMatrix); + } + void* handle = nullptr; + m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0, + handle); + while (m_pDevice->ContinueDIBits(handle, nullptr)) { + } + m_pDevice->CancelDIBits(handle); + return !!handle; +} + +bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, + const CFX_RetainPtr& pFont, + const FXTEXT_CHARPOS* pCharPos, + int32_t iCount, + float fFontSize, + const CFX_Matrix* pMatrix) { + ASSERT(pBrush && 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; + float* pAM; + for (int32_t i = 0; i < iCount; ++i) { + static const float mc = 0.267949f; + pAM = pCP->m_AdjustMatrix; + pAM[2] = mc * pAM[0] + pAM[2]; + pAM[3] = mc * pAM[1] + pAM[3]; + pCP++; + } + } + FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; + CFX_RetainPtr pCurFont; + CFX_RetainPtr pSTFont; + FXTEXT_CHARPOS* pCurCP = nullptr; + int32_t iCurCount = 0; + +#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + uint32_t dwFontStyle = pFont->GetFontStyles(); + CFX_Font FxFont; + CFX_SubstFont* SubstFxFont = new CFX_SubstFont(); + FxFont.SetSubstFont(std::unique_ptr(SubstFxFont)); + SubstFxFont->m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; + SubstFxFont->m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0; + SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight; + SubstFxFont->m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic); +#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + + for (int32_t i = 0; i < iCount; ++i) { + pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex); + pCP->m_GlyphIndex &= 0x00FFFFFF; + pCP->m_bFontStyle = false; + if (pCurFont != pSTFont) { + if (pCurFont) { + pFxFont = pCurFont->GetDevFont(); +#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + FxFont.SetFace(pFxFont->GetFace()); + m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize, + pMatrix, argb, FXTEXT_CLEARTYPE); +#else + m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, + pMatrix, argb, FXTEXT_CLEARTYPE); +#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + } + pCurFont = pSTFont; + pCurCP = pCP; + iCurCount = 1; + } else { + iCurCount++; + } + pCP++; + } + if (pCurFont && iCurCount) { + pFxFont = pCurFont->GetDevFont(); +#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + FxFont.SetFace(pFxFont->GetFace()); + bool bRet = + m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize, + pMatrix, argb, FXTEXT_CLEARTYPE); + FxFont.SetFace(nullptr); + return bRet; +#else + return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, + pMatrix, argb, FXTEXT_CLEARTYPE); +#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + } + +#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + FxFont.SetFace(nullptr); +#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ + + return true; +} + +bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, + float fPenWidth, + const CFX_PointF& pt1, + const CFX_PointF& pt2, + const CFX_PointF& pt3, + const CFX_PointF& pt4, + const CFX_Matrix* pMatrix) { + std::vector points; + points.push_back(pt1); + points.push_back(pt2); + points.push_back(pt3); + points.push_back(pt4); + CFDE_Path path; + path.AddBezier(points); + return DrawPath(pPen, fPenWidth, &path, pMatrix); +} + +bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, + float fPenWidth, + const std::vector& points, + bool bClosed, + float fTension, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddCurve(points, bClosed, fTension); + return DrawPath(pPen, fPenWidth, &path, pMatrix); +} + +bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, + float fPenWidth, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddEllipse(rect); + return DrawPath(pPen, fPenWidth, &path, pMatrix); +} + +bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, + float fPenWidth, + const std::vector& points, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddLines(points); + return DrawPath(pPen, fPenWidth, &path, pMatrix); +} + +bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, + 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); +} + +bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen, + float fPenWidth, + const CFDE_Path* pPath, + const CFX_Matrix* pMatrix) { + CFDE_Path* pGePath = (CFDE_Path*)pPath; + if (!pGePath) + return false; + + CFX_GraphStateData graphState; + if (!CreatePen(pPen, fPenWidth, graphState)) { + return false; + } + return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix, + &graphState, 0, pPen->GetColor(), 0); +} + +bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, + float fPenWidth, + const std::vector& points, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddPolygon(points); + return DrawPath(pPen, fPenWidth, &path, pMatrix); +} + +bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, + float fPenWidth, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddRectangle(rect); + return DrawPath(pPen, fPenWidth, &path, pMatrix); +} + +bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush, + const std::vector& points, + float fTension, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddCurve(points, true, fTension); + return FillPath(pBrush, &path, pMatrix); +} + +bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddEllipse(rect); + return FillPath(pBrush, &path, pMatrix); +} + +bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush, + const std::vector& points, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddPolygon(points); + return FillPath(pBrush, &path, pMatrix); +} + +bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix) { + CFDE_Path path; + path.AddRectangle(rect); + return FillPath(pBrush, &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, + 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); +} diff --git a/xfa/fde/cfde_renderdevice.h b/xfa/fde/cfde_renderdevice.h new file mode 100644 index 0000000000..f429ac1703 --- /dev/null +++ b/xfa/fde/cfde_renderdevice.h @@ -0,0 +1,127 @@ +// Copyright 2014 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_RENDERDEVICE_H_ +#define XFA_FDE_CFDE_RENDERDEVICE_H_ + +#include + +#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 { + public: + CFDE_RenderDevice(CFX_RenderDevice* pDevice, bool bOwnerDevice); + ~CFDE_RenderDevice(); + + int32_t GetWidth() const; + int32_t GetHeight() const; + void SaveState(); + void RestoreState(); + bool SetClipPath(const CFDE_Path* pClip); + CFDE_Path* GetClipPath() const; + bool SetClipRect(const CFX_RectF& rtClip); + const CFX_RectF& GetClipRect(); + + float GetDpiX() const; + float GetDpiY() const; + + bool DrawImage(const CFX_RetainPtr& pDib, + const CFX_RectF* pSrcRect, + const CFX_RectF& dstRect, + const CFX_Matrix* pImgMatrix = nullptr, + const CFX_Matrix* pDevMatrix = nullptr); + bool DrawString(CFDE_Brush* pBrush, + const CFX_RetainPtr& pFont, + const FXTEXT_CHARPOS* pCharPos, + int32_t iCount, + float fFontSize, + const CFX_Matrix* pMatrix = nullptr); + bool DrawBezier(CFDE_Pen* pPen, + 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, + float fPenWidth, + const std::vector& points, + bool bClosed, + float fTension = 0.5f, + const CFX_Matrix* pMatrix = nullptr); + bool DrawEllipse(CFDE_Pen* pPen, + float fPenWidth, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix = nullptr); + bool DrawLines(CFDE_Pen* pPen, + float fPenWidth, + const std::vector& points, + const CFX_Matrix* pMatrix = nullptr); + bool DrawLine(CFDE_Pen* pPen, + float fPenWidth, + const CFX_PointF& pt1, + const CFX_PointF& pt2, + const CFX_Matrix* pMatrix = nullptr); + bool DrawPath(CFDE_Pen* pPen, + float fPenWidth, + const CFDE_Path* pPath, + const CFX_Matrix* pMatrix = nullptr); + bool DrawPolygon(CFDE_Pen* pPen, + float fPenWidth, + const std::vector& points, + const CFX_Matrix* pMatrix = nullptr); + bool DrawRectangle(CFDE_Pen* pPen, + float fPenWidth, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix = nullptr); + bool FillClosedCurve(CFDE_Brush* pBrush, + const std::vector& points, + float fTension = 0.5f, + const CFX_Matrix* pMatrix = nullptr); + bool FillEllipse(CFDE_Brush* pBrush, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix = nullptr); + bool FillPath(CFDE_Brush* pBrush, + const CFDE_Path* pPath, + const CFX_Matrix* pMatrix = nullptr); + bool FillPolygon(CFDE_Brush* pBrush, + const std::vector& points, + const CFX_Matrix* pMatrix = nullptr); + bool FillRectangle(CFDE_Brush* pBrush, + const CFX_RectF& rect, + const CFX_Matrix* pMatrix = nullptr); + + bool DrawSolidString(CFDE_Brush* pBrush, + const CFX_RetainPtr& pFont, + const FXTEXT_CHARPOS* pCharPos, + int32_t iCount, + float fFontSize, + const CFX_Matrix* pMatrix); + bool DrawStringPath(CFDE_Brush* pBrush, + const CFX_RetainPtr& 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); + + CFX_RenderDevice* const m_pDevice; + CFX_RectF m_rtClip; + bool m_bOwnerDevice; + int32_t m_iCharCount; +}; + +#endif // XFA_FDE_CFDE_RENDERDEVICE_H_ diff --git a/xfa/fde/cfde_txtedtpage.h b/xfa/fde/cfde_txtedtpage.h index 2cae7ce4ab..699a9086ce 100644 --- a/xfa/fde/cfde_txtedtpage.h +++ b/xfa/fde/cfde_txtedtpage.h @@ -11,7 +11,7 @@ #include #include -#include "xfa/fde/fde_visualset.h" +#include "xfa/fde/ifde_visualset.h" #include "xfa/fde/ifx_chariter.h" class CFDE_TxtEdtEngine; diff --git a/xfa/fde/cfde_txtedttextset.h b/xfa/fde/cfde_txtedttextset.h index 35f7472b1f..8e4c4d01bf 100644 --- a/xfa/fde/cfde_txtedttextset.h +++ b/xfa/fde/cfde_txtedttextset.h @@ -9,7 +9,7 @@ #include -#include "xfa/fde/fde_visualset.h" +#include "xfa/fde/ifde_visualset.h" class CFDE_TxtEdtPage; diff --git a/xfa/fde/cfde_visualsetiterator.cpp b/xfa/fde/cfde_visualsetiterator.cpp new file mode 100644 index 0000000000..5fd84ede8a --- /dev/null +++ b/xfa/fde/cfde_visualsetiterator.cpp @@ -0,0 +1,94 @@ +// Copyright 2014 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 + +#include "xfa/fde/cfde_visualsetiterator.h" + +#include "xfa/fde/cfde_txtedtpage.h" + +CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {} + +CFDE_VisualSetIterator::~CFDE_VisualSetIterator() {} + +bool CFDE_VisualSetIterator::AttachCanvas(CFDE_TxtEdtPage* pCanvas) { + ASSERT(pCanvas); + m_CanvasStack = std::stack(); + + FDE_CANVASITEM canvas; + canvas.hCanvas = nullptr; + canvas.pCanvas = pCanvas; + canvas.pos = pCanvas->GetFirstPosition(); + if (canvas.pos == 0) + return false; + + m_CanvasStack.push(canvas); + return true; +} + +bool CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) { + if (m_CanvasStack.empty()) + return false; + + while (m_CanvasStack.size() > 1) + m_CanvasStack.pop(); + + m_dwFilter = dwObjects; + + FDE_CANVASITEM* pCanvas = &m_CanvasStack.top(); + ASSERT(pCanvas && pCanvas->pCanvas); + + pCanvas->pos = pCanvas->pCanvas->GetFirstPosition(); + return pCanvas->pos != 0; +} + +void CFDE_VisualSetIterator::Reset() { + FilterObjects(m_dwFilter); +} + +FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext( + IFDE_VisualSet*& pVisualSet, + FDE_TEXTEDITPIECE** phCanvasObj, + CFDE_TxtEdtPage** ppCanvasSet) { + while (!m_CanvasStack.empty()) { + FDE_CANVASITEM* pCanvas = &m_CanvasStack.top(); + if (pCanvas->pos == 0) { + if (m_CanvasStack.size() == 1) + break; + + m_CanvasStack.pop(); + continue; + } + do { + FDE_TEXTEDITPIECE* pObj = + pCanvas->pCanvas->GetNext(&pCanvas->pos, pVisualSet); + ASSERT(pObj); + + FDE_VISUALOBJTYPE eType = pVisualSet->GetType(); + if (eType == FDE_VISUALOBJ_Canvas) { + FDE_CANVASITEM canvas; + canvas.hCanvas = pObj; + canvas.pCanvas = static_cast(pVisualSet); + canvas.pos = canvas.pCanvas->GetFirstPosition(); + m_CanvasStack.push(canvas); + break; + } + uint32_t dwObj = (uint32_t)eType; + if ((m_dwFilter & dwObj) != 0) { + if (ppCanvasSet) + *ppCanvasSet = pCanvas->pCanvas; + if (phCanvasObj) + *phCanvasObj = pCanvas->hCanvas; + return pObj; + } + } while (pCanvas->pos != 0); + } + if (ppCanvasSet) + *ppCanvasSet = nullptr; + if (phCanvasObj) + *phCanvasObj = nullptr; + + pVisualSet = nullptr; + return nullptr; +} diff --git a/xfa/fde/cfde_visualsetiterator.h b/xfa/fde/cfde_visualsetiterator.h new file mode 100644 index 0000000000..a8e311aafb --- /dev/null +++ b/xfa/fde/cfde_visualsetiterator.h @@ -0,0 +1,40 @@ +// Copyright 2014 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_VISUALSETITERATOR_H_ +#define XFA_FDE_CFDE_VISUALSETITERATOR_H_ + +#include + +#include "xfa/fde/ifde_visualset.h" + +class CFDE_TxtEdtPage; + +struct FDE_CANVASITEM { + CFDE_TxtEdtPage* pCanvas; + FDE_TEXTEDITPIECE* hCanvas; + size_t pos; +}; + +class CFDE_VisualSetIterator { + public: + CFDE_VisualSetIterator(); + ~CFDE_VisualSetIterator(); + + bool AttachCanvas(CFDE_TxtEdtPage* pCanvas); + bool FilterObjects(uint32_t dwObjects = 0xFFFFFFFF); + + void Reset(); + FDE_TEXTEDITPIECE* GetNext(IFDE_VisualSet*& pVisualSet, + FDE_TEXTEDITPIECE** phCanvasObj = nullptr, + CFDE_TxtEdtPage** ppCanvasSet = nullptr); + + protected: + uint32_t m_dwFilter; + std::stack m_CanvasStack; +}; + +#endif // XFA_FDE_CFDE_VISUALSETITERATOR_H_ diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp deleted file mode 100644 index 8af769aae5..0000000000 --- a/xfa/fde/fde_gedevice.cpp +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright 2014 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 - -#include "xfa/fde/fde_gedevice.h" - -#include -#include - -#include "core/fxge/cfx_gemodule.h" -#include "core/fxge/cfx_graphstatedata.h" -#include "core/fxge/cfx_renderdevice.h" -#include "core/fxge/cfx_substfont.h" -#include "xfa/fde/cfde_path.h" -#include "xfa/fde/fde_object.h" -#include "xfa/fgas/font/cfgas_fontmgr.h" -#include "xfa/fgas/font/cfgas_gefont.h" - -CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice, - bool bOwnerDevice) - : m_pDevice(pDevice), m_bOwnerDevice(bOwnerDevice), m_iCharCount(0) { - ASSERT(pDevice); - - FX_RECT rt = m_pDevice->GetClipBox(); - m_rtClip = CFX_RectF(static_cast(rt.left), static_cast(rt.top), - static_cast(rt.Width()), - static_cast(rt.Height())); -} - -CFDE_RenderDevice::~CFDE_RenderDevice() { - if (m_bOwnerDevice) - delete m_pDevice; -} - -int32_t CFDE_RenderDevice::GetWidth() const { - return m_pDevice->GetWidth(); -} - -int32_t CFDE_RenderDevice::GetHeight() const { - return m_pDevice->GetHeight(); -} - -void CFDE_RenderDevice::SaveState() { - m_pDevice->SaveState(); -} - -void CFDE_RenderDevice::RestoreState() { - m_pDevice->RestoreState(false); - const FX_RECT& rt = m_pDevice->GetClipBox(); - m_rtClip = CFX_RectF(static_cast(rt.left), static_cast(rt.top), - static_cast(rt.Width()), - static_cast(rt.Height())); -} - -bool CFDE_RenderDevice::SetClipRect(const CFX_RectF& rtClip) { - m_rtClip = rtClip; - return m_pDevice->SetClip_Rect(FX_RECT((int32_t)FXSYS_floor(rtClip.left), - (int32_t)FXSYS_floor(rtClip.top), - (int32_t)FXSYS_ceil(rtClip.right()), - (int32_t)FXSYS_ceil(rtClip.bottom()))); -} - -const CFX_RectF& CFDE_RenderDevice::GetClipRect() { - return m_rtClip; -} - -bool CFDE_RenderDevice::SetClipPath(const CFDE_Path* pClip) { - return false; -} - -CFDE_Path* CFDE_RenderDevice::GetClipPath() const { - return nullptr; -} - -float CFDE_RenderDevice::GetDpiX() const { - return 96; -} - -float CFDE_RenderDevice::GetDpiY() const { - return 96; -} - -bool CFDE_RenderDevice::DrawImage(const CFX_RetainPtr& pDib, - const CFX_RectF* pSrcRect, - const CFX_RectF& dstRect, - const CFX_Matrix* pImgMatrix, - const CFX_Matrix* pDevMatrix) { - CFX_RectF srcRect; - if (pSrcRect) { - srcRect = *pSrcRect; - } else { - srcRect = CFX_RectF(0, 0, static_cast(pDib->GetWidth()), - static_cast(pDib->GetHeight())); - } - - if (srcRect.IsEmpty()) - return false; - - CFX_Matrix dib2fxdev; - if (pImgMatrix) { - dib2fxdev = *pImgMatrix; - } else { - dib2fxdev.SetIdentity(); - } - dib2fxdev.a = dstRect.width; - dib2fxdev.d = -dstRect.height; - dib2fxdev.e = dstRect.left; - dib2fxdev.f = dstRect.bottom(); - if (pDevMatrix) { - dib2fxdev.Concat(*pDevMatrix); - } - void* handle = nullptr; - m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0, - handle); - while (m_pDevice->ContinueDIBits(handle, nullptr)) { - } - m_pDevice->CancelDIBits(handle); - return !!handle; -} - -bool CFDE_RenderDevice::DrawString(CFDE_Brush* pBrush, - const CFX_RetainPtr& pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - float fFontSize, - const CFX_Matrix* pMatrix) { - ASSERT(pBrush && 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; - float* pAM; - for (int32_t i = 0; i < iCount; ++i) { - static const float mc = 0.267949f; - pAM = pCP->m_AdjustMatrix; - pAM[2] = mc * pAM[0] + pAM[2]; - pAM[3] = mc * pAM[1] + pAM[3]; - pCP++; - } - } - FXTEXT_CHARPOS* pCP = (FXTEXT_CHARPOS*)pCharPos; - CFX_RetainPtr pCurFont; - CFX_RetainPtr pSTFont; - FXTEXT_CHARPOS* pCurCP = nullptr; - int32_t iCurCount = 0; - -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - uint32_t dwFontStyle = pFont->GetFontStyles(); - CFX_Font FxFont; - CFX_SubstFont* SubstFxFont = new CFX_SubstFont(); - FxFont.SetSubstFont(std::unique_ptr(SubstFxFont)); - SubstFxFont->m_Weight = dwFontStyle & FX_FONTSTYLE_Bold ? 700 : 400; - SubstFxFont->m_ItalicAngle = dwFontStyle & FX_FONTSTYLE_Italic ? -12 : 0; - SubstFxFont->m_WeightCJK = SubstFxFont->m_Weight; - SubstFxFont->m_bItalicCJK = !!(dwFontStyle & FX_FONTSTYLE_Italic); -#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - - for (int32_t i = 0; i < iCount; ++i) { - pSTFont = pFont->GetSubstFont((int32_t)pCP->m_GlyphIndex); - pCP->m_GlyphIndex &= 0x00FFFFFF; - pCP->m_bFontStyle = false; - if (pCurFont != pSTFont) { - if (pCurFont) { - pFxFont = pCurFont->GetDevFont(); -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - FxFont.SetFace(pFxFont->GetFace()); - m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize, - pMatrix, argb, FXTEXT_CLEARTYPE); -#else - m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, - pMatrix, argb, FXTEXT_CLEARTYPE); -#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - } - pCurFont = pSTFont; - pCurCP = pCP; - iCurCount = 1; - } else { - iCurCount++; - } - pCP++; - } - if (pCurFont && iCurCount) { - pFxFont = pCurFont->GetDevFont(); -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - FxFont.SetFace(pFxFont->GetFace()); - bool bRet = - m_pDevice->DrawNormalText(iCurCount, pCurCP, &FxFont, -fFontSize, - pMatrix, argb, FXTEXT_CLEARTYPE); - FxFont.SetFace(nullptr); - return bRet; -#else - return m_pDevice->DrawNormalText(iCurCount, pCurCP, pFxFont, -fFontSize, - pMatrix, argb, FXTEXT_CLEARTYPE); -#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - } - -#if _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - FxFont.SetFace(nullptr); -#endif // _FXM_PLATFORM_ != _FXM_PLATFORM_WINDOWS_ - - return true; -} - -bool CFDE_RenderDevice::DrawBezier(CFDE_Pen* pPen, - float fPenWidth, - const CFX_PointF& pt1, - const CFX_PointF& pt2, - const CFX_PointF& pt3, - const CFX_PointF& pt4, - const CFX_Matrix* pMatrix) { - std::vector points; - points.push_back(pt1); - points.push_back(pt2); - points.push_back(pt3); - points.push_back(pt4); - CFDE_Path path; - path.AddBezier(points); - return DrawPath(pPen, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::DrawCurve(CFDE_Pen* pPen, - float fPenWidth, - const std::vector& points, - bool bClosed, - float fTension, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddCurve(points, bClosed, fTension); - return DrawPath(pPen, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::DrawEllipse(CFDE_Pen* pPen, - float fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddEllipse(rect); - return DrawPath(pPen, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::DrawLines(CFDE_Pen* pPen, - float fPenWidth, - const std::vector& points, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddLines(points); - return DrawPath(pPen, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::DrawLine(CFDE_Pen* pPen, - 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); -} - -bool CFDE_RenderDevice::DrawPath(CFDE_Pen* pPen, - float fPenWidth, - const CFDE_Path* pPath, - const CFX_Matrix* pMatrix) { - CFDE_Path* pGePath = (CFDE_Path*)pPath; - if (!pGePath) - return false; - - CFX_GraphStateData graphState; - if (!CreatePen(pPen, fPenWidth, graphState)) { - return false; - } - return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix, - &graphState, 0, pPen->GetColor(), 0); -} - -bool CFDE_RenderDevice::DrawPolygon(CFDE_Pen* pPen, - float fPenWidth, - const std::vector& points, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddPolygon(points); - return DrawPath(pPen, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::DrawRectangle(CFDE_Pen* pPen, - float fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddRectangle(rect); - return DrawPath(pPen, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::FillClosedCurve(CFDE_Brush* pBrush, - const std::vector& points, - float fTension, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddCurve(points, true, fTension); - return FillPath(pBrush, &path, pMatrix); -} - -bool CFDE_RenderDevice::FillEllipse(CFDE_Brush* pBrush, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddEllipse(rect); - return FillPath(pBrush, &path, pMatrix); -} - -bool CFDE_RenderDevice::FillPolygon(CFDE_Brush* pBrush, - const std::vector& points, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddPolygon(points); - return FillPath(pBrush, &path, pMatrix); -} - -bool CFDE_RenderDevice::FillRectangle(CFDE_Brush* pBrush, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddRectangle(rect); - return FillPath(pBrush, &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, - 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); -} - diff --git a/xfa/fde/fde_gedevice.h b/xfa/fde/fde_gedevice.h deleted file mode 100644 index a3a1eaf111..0000000000 --- a/xfa/fde/fde_gedevice.h +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2014 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_FDE_GEDEVICE_H_ -#define XFA_FDE_FDE_GEDEVICE_H_ - -#include - -#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 { - public: - CFDE_RenderDevice(CFX_RenderDevice* pDevice, bool bOwnerDevice); - ~CFDE_RenderDevice(); - - int32_t GetWidth() const; - int32_t GetHeight() const; - void SaveState(); - void RestoreState(); - bool SetClipPath(const CFDE_Path* pClip); - CFDE_Path* GetClipPath() const; - bool SetClipRect(const CFX_RectF& rtClip); - const CFX_RectF& GetClipRect(); - - float GetDpiX() const; - float GetDpiY() const; - - bool DrawImage(const CFX_RetainPtr& pDib, - const CFX_RectF* pSrcRect, - const CFX_RectF& dstRect, - const CFX_Matrix* pImgMatrix = nullptr, - const CFX_Matrix* pDevMatrix = nullptr); - bool DrawString(CFDE_Brush* pBrush, - const CFX_RetainPtr& pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - float fFontSize, - const CFX_Matrix* pMatrix = nullptr); - bool DrawBezier(CFDE_Pen* pPen, - 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, - float fPenWidth, - const std::vector& points, - bool bClosed, - float fTension = 0.5f, - const CFX_Matrix* pMatrix = nullptr); - bool DrawEllipse(CFDE_Pen* pPen, - float fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - bool DrawLines(CFDE_Pen* pPen, - float fPenWidth, - const std::vector& points, - const CFX_Matrix* pMatrix = nullptr); - bool DrawLine(CFDE_Pen* pPen, - float fPenWidth, - const CFX_PointF& pt1, - const CFX_PointF& pt2, - const CFX_Matrix* pMatrix = nullptr); - bool DrawPath(CFDE_Pen* pPen, - float fPenWidth, - const CFDE_Path* pPath, - const CFX_Matrix* pMatrix = nullptr); - bool DrawPolygon(CFDE_Pen* pPen, - float fPenWidth, - const std::vector& points, - const CFX_Matrix* pMatrix = nullptr); - bool DrawRectangle(CFDE_Pen* pPen, - float fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - bool FillClosedCurve(CFDE_Brush* pBrush, - const std::vector& points, - float fTension = 0.5f, - const CFX_Matrix* pMatrix = nullptr); - bool FillEllipse(CFDE_Brush* pBrush, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - bool FillPath(CFDE_Brush* pBrush, - const CFDE_Path* pPath, - const CFX_Matrix* pMatrix = nullptr); - bool FillPolygon(CFDE_Brush* pBrush, - const std::vector& points, - const CFX_Matrix* pMatrix = nullptr); - bool FillRectangle(CFDE_Brush* pBrush, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - - bool DrawSolidString(CFDE_Brush* pBrush, - const CFX_RetainPtr& pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - float fFontSize, - const CFX_Matrix* pMatrix); - bool DrawStringPath(CFDE_Brush* pBrush, - const CFX_RetainPtr& 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); - - CFX_RenderDevice* const m_pDevice; - CFX_RectF m_rtClip; - bool m_bOwnerDevice; - int32_t m_iCharCount; -}; - -#endif // XFA_FDE_FDE_GEDEVICE_H_ diff --git a/xfa/fde/fde_iterator.cpp b/xfa/fde/fde_iterator.cpp deleted file mode 100644 index ff4fc0e73c..0000000000 --- a/xfa/fde/fde_iterator.cpp +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2014 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 - -#include "xfa/fde/fde_iterator.h" - -#include "xfa/fde/cfde_txtedtpage.h" - -CFDE_VisualSetIterator::CFDE_VisualSetIterator() : m_dwFilter(0) {} - -CFDE_VisualSetIterator::~CFDE_VisualSetIterator() {} - -bool CFDE_VisualSetIterator::AttachCanvas(CFDE_TxtEdtPage* pCanvas) { - ASSERT(pCanvas); - m_CanvasStack = std::stack(); - - FDE_CANVASITEM canvas; - canvas.hCanvas = nullptr; - canvas.pCanvas = pCanvas; - canvas.pos = pCanvas->GetFirstPosition(); - if (canvas.pos == 0) - return false; - - m_CanvasStack.push(canvas); - return true; -} - -bool CFDE_VisualSetIterator::FilterObjects(uint32_t dwObjects) { - if (m_CanvasStack.empty()) - return false; - - while (m_CanvasStack.size() > 1) - m_CanvasStack.pop(); - - m_dwFilter = dwObjects; - - FDE_CANVASITEM* pCanvas = &m_CanvasStack.top(); - ASSERT(pCanvas && pCanvas->pCanvas); - - pCanvas->pos = pCanvas->pCanvas->GetFirstPosition(); - return pCanvas->pos != 0; -} - -void CFDE_VisualSetIterator::Reset() { - FilterObjects(m_dwFilter); -} - -FDE_TEXTEDITPIECE* CFDE_VisualSetIterator::GetNext( - IFDE_VisualSet*& pVisualSet, - FDE_TEXTEDITPIECE** phCanvasObj, - CFDE_TxtEdtPage** ppCanvasSet) { - while (!m_CanvasStack.empty()) { - FDE_CANVASITEM* pCanvas = &m_CanvasStack.top(); - if (pCanvas->pos == 0) { - if (m_CanvasStack.size() == 1) - break; - - m_CanvasStack.pop(); - continue; - } - do { - FDE_TEXTEDITPIECE* pObj = - pCanvas->pCanvas->GetNext(&pCanvas->pos, pVisualSet); - ASSERT(pObj); - - FDE_VISUALOBJTYPE eType = pVisualSet->GetType(); - if (eType == FDE_VISUALOBJ_Canvas) { - FDE_CANVASITEM canvas; - canvas.hCanvas = pObj; - canvas.pCanvas = static_cast(pVisualSet); - canvas.pos = canvas.pCanvas->GetFirstPosition(); - m_CanvasStack.push(canvas); - break; - } - uint32_t dwObj = (uint32_t)eType; - if ((m_dwFilter & dwObj) != 0) { - if (ppCanvasSet) - *ppCanvasSet = pCanvas->pCanvas; - if (phCanvasObj) - *phCanvasObj = pCanvas->hCanvas; - return pObj; - } - } while (pCanvas->pos != 0); - } - if (ppCanvasSet) - *ppCanvasSet = nullptr; - if (phCanvasObj) - *phCanvasObj = nullptr; - - pVisualSet = nullptr; - return nullptr; -} diff --git a/xfa/fde/fde_iterator.h b/xfa/fde/fde_iterator.h deleted file mode 100644 index 99f9597aa5..0000000000 --- a/xfa/fde/fde_iterator.h +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 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_FDE_ITERATOR_H_ -#define XFA_FDE_FDE_ITERATOR_H_ - -#include - -#include "xfa/fde/fde_visualset.h" - -class CFDE_TxtEdtPage; - -struct FDE_CANVASITEM { - CFDE_TxtEdtPage* pCanvas; - FDE_TEXTEDITPIECE* hCanvas; - size_t pos; -}; - -class CFDE_VisualSetIterator { - public: - CFDE_VisualSetIterator(); - ~CFDE_VisualSetIterator(); - - bool AttachCanvas(CFDE_TxtEdtPage* pCanvas); - bool FilterObjects(uint32_t dwObjects = 0xFFFFFFFF); - - void Reset(); - FDE_TEXTEDITPIECE* GetNext(IFDE_VisualSet*& pVisualSet, - FDE_TEXTEDITPIECE** phCanvasObj = nullptr, - CFDE_TxtEdtPage** ppCanvasSet = nullptr); - - protected: - uint32_t m_dwFilter; - std::stack m_CanvasStack; -}; - -#endif // XFA_FDE_FDE_ITERATOR_H_ diff --git a/xfa/fde/fde_object.h b/xfa/fde/fde_object.h deleted file mode 100644 index 5c66b202b6..0000000000 --- a/xfa/fde/fde_object.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 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_FDE_OBJECT_H_ -#define XFA_FDE_FDE_OBJECT_H_ - -#include - -#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; -}; - -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_FDE_OBJECT_H_ diff --git a/xfa/fde/fde_render.cpp b/xfa/fde/fde_render.cpp deleted file mode 100644 index a502c7b6d8..0000000000 --- a/xfa/fde/fde_render.cpp +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2014 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 - -#include "xfa/fde/fde_render.h" - -#include "third_party/base/ptr_util.h" -#include "xfa/fde/cfde_txtedttextset.h" -#include "xfa/fde/fde_gedevice.h" -#include "xfa/fde/fde_object.h" - -#define FDE_PATHRENDER_Stroke 1 -#define FDE_PATHRENDER_Fill 2 - -CFDE_RenderContext::CFDE_RenderContext() - : m_eStatus(FDE_RENDERSTATUS_Reset), - m_pRenderDevice(nullptr), - m_Transform() { - m_Transform.SetIdentity(); -} - -CFDE_RenderContext::~CFDE_RenderContext() { - StopRender(); -} - -bool CFDE_RenderContext::StartRender(CFDE_RenderDevice* pRenderDevice, - CFDE_TxtEdtPage* pCanvasSet, - const CFX_Matrix& tmDoc2Device) { - if (m_pRenderDevice) - return false; - if (!pRenderDevice) - return false; - if (!pCanvasSet) - return false; - - m_eStatus = FDE_RENDERSTATUS_Paused; - m_pRenderDevice = pRenderDevice; - m_Transform = tmDoc2Device; - if (!m_pIterator) - m_pIterator = pdfium::MakeUnique(); - - return m_pIterator->AttachCanvas(pCanvasSet) && m_pIterator->FilterObjects(); -} - -FDE_RENDERSTATUS CFDE_RenderContext::DoRender(IFX_Pause* pPause) { - if (!m_pRenderDevice) - return FDE_RENDERSTATUS_Failed; - if (!m_pIterator) - return FDE_RENDERSTATUS_Failed; - - FDE_RENDERSTATUS eStatus = FDE_RENDERSTATUS_Paused; - CFX_Matrix rm; - rm.SetReverse(m_Transform); - CFX_RectF rtDocClip = m_pRenderDevice->GetClipRect(); - if (rtDocClip.IsEmpty()) { - rtDocClip.left = rtDocClip.top = 0; - rtDocClip.width = (float)m_pRenderDevice->GetWidth(); - rtDocClip.height = (float)m_pRenderDevice->GetHeight(); - } - rm.TransformRect(rtDocClip); - IFDE_VisualSet* pVisualSet; - FDE_TEXTEDITPIECE* pPiece; - int32_t iCount = 0; - while (true) { - pPiece = m_pIterator->GetNext(pVisualSet); - if (!pPiece || !pVisualSet) { - eStatus = FDE_RENDERSTATUS_Done; - break; - } - if (!rtDocClip.IntersectWith(pVisualSet->GetRect(*pPiece))) - continue; - - switch (pVisualSet->GetType()) { - case FDE_VISUALOBJ_Text: - RenderText(static_cast(pVisualSet), pPiece); - iCount += 5; - break; - case FDE_VISUALOBJ_Canvas: - ASSERT(false); - break; - default: - break; - } - if (iCount >= 100 && pPause && pPause->NeedToPauseNow()) { - eStatus = FDE_RENDERSTATUS_Paused; - break; - } - } - return m_eStatus = eStatus; -} - -void CFDE_RenderContext::StopRender() { - m_eStatus = FDE_RENDERSTATUS_Reset; - m_pRenderDevice = nullptr; - m_Transform.SetIdentity(); - m_pIterator.reset(); - m_pBrush.reset(); - m_CharPos.clear(); -} - -void CFDE_RenderContext::RenderText(CFDE_TxtEdtTextSet* pTextSet, - FDE_TEXTEDITPIECE* pText) { - ASSERT(m_pRenderDevice); - ASSERT(pTextSet && pText); - - CFX_RetainPtr pFont = pTextSet->GetFont(); - if (!pFont) - return; - - int32_t iCount = pTextSet->GetDisplayPos(*pText, nullptr, false); - if (iCount < 1) - return; - - if (!m_pBrush) - m_pBrush = pdfium::MakeUnique(); - - if (m_CharPos.size() < static_cast(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); -} - diff --git a/xfa/fde/fde_render.h b/xfa/fde/fde_render.h deleted file mode 100644 index ba56754a3e..0000000000 --- a/xfa/fde/fde_render.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 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_FDE_RENDER_H_ -#define XFA_FDE_FDE_RENDER_H_ - -#include -#include - -#include "core/fxcrt/fx_coordinates.h" -#include "xfa/fde/fde_gedevice.h" -#include "xfa/fde/fde_iterator.h" -#include "xfa/fde/fde_visualset.h" - -class CFDE_RenderDevice; -class CFDE_TxtEdtTextSet; - -enum FDE_RENDERSTATUS { - FDE_RENDERSTATUS_Reset = 0, - FDE_RENDERSTATUS_Paused, - FDE_RENDERSTATUS_Done, - FDE_RENDERSTATUS_Failed, -}; - -class CFDE_RenderContext { - public: - CFDE_RenderContext(); - ~CFDE_RenderContext(); - - bool StartRender(CFDE_RenderDevice* pRenderDevice, - CFDE_TxtEdtPage* pCanvasSet, - const CFX_Matrix& tmDoc2Device); - FDE_RENDERSTATUS GetStatus() const { return m_eStatus; } - FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr); - void StopRender(); - void RenderText(CFDE_TxtEdtTextSet* pTextSet, FDE_TEXTEDITPIECE* pText); - - protected: - FDE_RENDERSTATUS m_eStatus; - CFDE_RenderDevice* m_pRenderDevice; - CFX_Matrix m_Transform; - std::vector m_CharPos; - std::unique_ptr m_pBrush; - std::unique_ptr m_pIterator; -}; - -#endif // XFA_FDE_FDE_RENDER_H_ diff --git a/xfa/fde/fde_visualset.h b/xfa/fde/fde_visualset.h deleted file mode 100644 index e9ee9ab815..0000000000 --- a/xfa/fde/fde_visualset.h +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 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_FDE_VISUALSET_H_ -#define XFA_FDE_FDE_VISUALSET_H_ - -#include - -#include "core/fxcrt/cfx_retain_ptr.h" -#include "core/fxcrt/fx_coordinates.h" -#include "core/fxcrt/fx_system.h" -#include "core/fxge/fx_dib.h" -#include "xfa/fde/cfde_path.h" -#include "xfa/fde/fde_object.h" -#include "xfa/fgas/font/cfgas_fontmgr.h" - -class FXTEXT_CHARPOS; - -enum FDE_VISUALOBJTYPE { - FDE_VISUALOBJ_Canvas = 0x00, - FDE_VISUALOBJ_Text = 0x01 -}; - -struct FDE_TEXTEDITPIECE { - FDE_TEXTEDITPIECE(); - FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that); - ~FDE_TEXTEDITPIECE(); - - int32_t nStart; - int32_t nCount; - int32_t nBidiLevel; - CFX_RectF rtPiece; - uint32_t dwCharStyles; -}; -inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE() = default; -inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that) = - default; -inline FDE_TEXTEDITPIECE::~FDE_TEXTEDITPIECE() = default; - -class IFDE_VisualSet { - public: - virtual ~IFDE_VisualSet() {} - virtual FDE_VISUALOBJTYPE GetType() = 0; - virtual CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) = 0; -}; - -#endif // XFA_FDE_FDE_VISUALSET_H_ diff --git a/xfa/fde/ifde_visualset.h b/xfa/fde/ifde_visualset.h new file mode 100644 index 0000000000..144475f047 --- /dev/null +++ b/xfa/fde/ifde_visualset.h @@ -0,0 +1,49 @@ +// Copyright 2014 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_IFDE_VISUALSET_H_ +#define XFA_FDE_IFDE_VISUALSET_H_ + +#include + +#include "core/fxcrt/cfx_retain_ptr.h" +#include "core/fxcrt/fx_coordinates.h" +#include "core/fxcrt/fx_system.h" +#include "core/fxge/fx_dib.h" +#include "xfa/fde/cfde_path.h" +#include "xfa/fgas/font/cfgas_fontmgr.h" + +class FXTEXT_CHARPOS; + +enum FDE_VISUALOBJTYPE { + FDE_VISUALOBJ_Canvas = 0x00, + FDE_VISUALOBJ_Text = 0x01 +}; + +struct FDE_TEXTEDITPIECE { + FDE_TEXTEDITPIECE(); + FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that); + ~FDE_TEXTEDITPIECE(); + + int32_t nStart; + int32_t nCount; + int32_t nBidiLevel; + CFX_RectF rtPiece; + uint32_t dwCharStyles; +}; +inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE() = default; +inline FDE_TEXTEDITPIECE::FDE_TEXTEDITPIECE(const FDE_TEXTEDITPIECE& that) = + default; +inline FDE_TEXTEDITPIECE::~FDE_TEXTEDITPIECE() = default; + +class IFDE_VisualSet { + public: + virtual ~IFDE_VisualSet() {} + virtual FDE_VISUALOBJTYPE GetType() = 0; + virtual CFX_RectF GetRect(const FDE_TEXTEDITPIECE& hVisualObj) = 0; +}; + +#endif // XFA_FDE_IFDE_VISUALSET_H_ diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index c06a12fedf..c036c77931 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -12,13 +12,16 @@ #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/fde_gedevice.h" -#include "xfa/fde/fde_object.h" +#include "xfa/fde/cfde_pen.h" +#include "xfa/fde/cfde_renderdevice.h" #include "xfa/fgas/layout/fgas_textbreak.h" FDE_TTOPIECE::FDE_TTOPIECE() = default; + FDE_TTOPIECE::FDE_TTOPIECE(const FDE_TTOPIECE& that) = default; + FDE_TTOPIECE::~FDE_TTOPIECE() = default; CFDE_TextOut::CFDE_TextOut() diff --git a/xfa/fde/tto/fde_textout.h b/xfa/fde/tto/fde_textout.h index e48e25567e..2ca77217a6 100644 --- a/xfa/fde/tto/fde_textout.h +++ b/xfa/fde/tto/fde_textout.h @@ -15,7 +15,6 @@ #include "core/fxge/cfx_fxgedevice.h" #include "core/fxge/cfx_renderdevice.h" #include "core/fxge/fx_dib.h" -#include "xfa/fde/fde_object.h" #include "xfa/fgas/font/cfgas_fontmgr.h" #define FDE_TTOSTYLE_Underline 0x0001 @@ -38,6 +37,7 @@ #define FDE_TTOALIGNMENT_BottomRight 10 #define FDE_TTOALIGNMENT_BottomAuto 11 +class CFDE_Pen; class CFDE_RenderDevice; class CFX_RenderDevice; class CFX_TxtBreak; -- cgit v1.2.3