From be993d2200ad4521e1031c7b9eb0f8f9b49fabb0 Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Wed, 9 Aug 2017 16:24:24 -0400 Subject: Remove unused code from CFDE_RenderDevice. Unused code, remove. Change-Id: Icbe53982f932eded350fc67e8022549178b92344 Reviewed-on: https://pdfium-review.googlesource.com/10452 Reviewed-by: Tom Sepez Commit-Queue: dsinclair --- xfa/fde/cfde_renderdevice.cpp | 172 +----------------------------------------- xfa/fde/cfde_renderdevice.h | 76 +------------------ 2 files changed, 3 insertions(+), 245 deletions(-) diff --git a/xfa/fde/cfde_renderdevice.cpp b/xfa/fde/cfde_renderdevice.cpp index 8a1b980724..65a81b5ea7 100644 --- a/xfa/fde/cfde_renderdevice.cpp +++ b/xfa/fde/cfde_renderdevice.cpp @@ -20,7 +20,7 @@ #include "xfa/fgas/font/cfgas_gefont.h" CFDE_RenderDevice::CFDE_RenderDevice(CFX_RenderDevice* pDevice) - : m_pDevice(pDevice), m_iCharCount(0) { + : m_pDevice(pDevice) { ASSERT(pDevice); FX_RECT rt = m_pDevice->GetClipBox(); @@ -62,59 +62,6 @@ 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); - } - std::unique_ptr handle; - m_pDevice->StartDIBits(pDib, 255, 0, (const CFX_Matrix*)&dib2fxdev, 0, - &handle); - while (m_pDevice->ContinueDIBits(handle.get(), nullptr)) { - } - return !!handle; -} - bool CFDE_RenderDevice::DrawString(FX_ARGB color, const CFX_RetainPtr& pFont, const FXTEXT_CHARPOS* pCharPos, @@ -198,62 +145,6 @@ bool CFDE_RenderDevice::DrawString(FX_ARGB color, return true; } -bool CFDE_RenderDevice::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) { - 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(color, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::DrawCurve(FX_ARGB color, - float fPenWidth, - const std::vector& points, - bool bClosed, - float fTension, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddCurve(points, bClosed, fTension); - return DrawPath(color, fPenWidth, &path, pMatrix); -} - -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(color, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::DrawLines(FX_ARGB color, - float fPenWidth, - const std::vector& points, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddLines(points); - return DrawPath(color, fPenWidth, &path, pMatrix); -} - -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(color, fPenWidth, &path, pMatrix); -} - bool CFDE_RenderDevice::DrawPath(FX_ARGB color, float fPenWidth, const CFDE_Path* pPath, @@ -271,64 +162,3 @@ bool CFDE_RenderDevice::DrawPath(FX_ARGB color, return m_pDevice->DrawPath(&pGePath->m_Path, (const CFX_Matrix*)pMatrix, &graphState, 0, color, 0); } - -bool CFDE_RenderDevice::DrawPolygon(FX_ARGB color, - float fPenWidth, - const std::vector& points, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddPolygon(points); - return DrawPath(color, fPenWidth, &path, pMatrix); -} - -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(color, fPenWidth, &path, pMatrix); -} - -bool CFDE_RenderDevice::FillClosedCurve(FX_ARGB color, - const std::vector& points, - float fTension, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddCurve(points, true, fTension); - return FillPath(color, &path, pMatrix); -} - -bool CFDE_RenderDevice::FillEllipse(FX_ARGB color, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddEllipse(rect); - return FillPath(color, &path, pMatrix); -} - -bool CFDE_RenderDevice::FillPolygon(FX_ARGB color, - const std::vector& points, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddPolygon(points); - return FillPath(color, &path, pMatrix); -} - -bool CFDE_RenderDevice::FillRectangle(FX_ARGB color, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix) { - CFDE_Path path; - path.AddRectangle(rect); - return FillPath(color, &path, pMatrix); -} - -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; - 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 a372c23f9d..0f0ce9e1cd 100644 --- a/xfa/fde/cfde_renderdevice.h +++ b/xfa/fde/cfde_renderdevice.h @@ -22,99 +22,27 @@ class 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(FX_ARGB color, const CFX_RetainPtr& pFont, const FXTEXT_CHARPOS* pCharPos, int32_t iCount, float fFontSize, const CFX_Matrix* pMatrix = nullptr); - 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(FX_ARGB color, - float fPenWidth, - const std::vector& points, - bool bClosed, - float fTension = 0.5f, - const CFX_Matrix* pMatrix = nullptr); - bool DrawEllipse(FX_ARGB color, - float fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - bool DrawLines(FX_ARGB color, - float fPenWidth, - const std::vector& points, - const CFX_Matrix* pMatrix = nullptr); - bool DrawLine(FX_ARGB color, - float fPenWidth, - const CFX_PointF& pt1, - const CFX_PointF& pt2, - const CFX_Matrix* pMatrix = nullptr); bool DrawPath(FX_ARGB color, float fPenWidth, const CFDE_Path* pPath, const CFX_Matrix* pMatrix = nullptr); - bool DrawPolygon(FX_ARGB color, - float fPenWidth, - const std::vector& points, - const CFX_Matrix* pMatrix = nullptr); - bool DrawRectangle(FX_ARGB color, - float fPenWidth, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - bool FillClosedCurve(FX_ARGB color, - const std::vector& points, - float fTension = 0.5f, - const CFX_Matrix* pMatrix = nullptr); - bool FillEllipse(FX_ARGB color, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - bool FillPath(FX_ARGB color, - const CFDE_Path* pPath, - const CFX_Matrix* pMatrix = nullptr); - bool FillPolygon(FX_ARGB color, - const std::vector& points, - const CFX_Matrix* pMatrix = nullptr); - bool FillRectangle(FX_ARGB color, - const CFX_RectF& rect, - const CFX_Matrix* pMatrix = nullptr); - - bool DrawSolidString(FX_ARGB color, - const CFX_RetainPtr& pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - float fFontSize, - const CFX_Matrix* pMatrix); - bool DrawStringPath(FX_ARGB color, - const CFX_RetainPtr& pFont, - const FXTEXT_CHARPOS* pCharPos, - int32_t iCount, - float fFontSize, - const CFX_Matrix* pMatrix); private: CFX_RenderDevice* const m_pDevice; CFX_RectF m_rtClip; - int32_t m_iCharCount; }; #endif // XFA_FDE_CFDE_RENDERDEVICE_H_ -- cgit v1.2.3