From fe433f15d60f92ccde7a928160c2e7cc77dcb8bf Mon Sep 17 00:00:00 2001 From: dsinclair Date: Mon, 6 Jun 2016 12:03:31 -0700 Subject: Remove FDE_HDEVICESTATE. The value returned is always NULL and when passed as a param is never used. Review-Url: https://codereview.chromium.org/2044623002 --- xfa/fde/fde_gedevice.cpp | 5 ++--- xfa/fde/fde_gedevice.h | 6 ++---- xfa/fde/fde_render.cpp | 14 ++++++-------- xfa/fde/fde_render.h | 6 ++---- xfa/fde/tto/fde_textout.cpp | 4 ++-- xfa/fxfa/app/xfa_textlayout.cpp | 4 ++-- 6 files changed, 16 insertions(+), 23 deletions(-) diff --git a/xfa/fde/fde_gedevice.cpp b/xfa/fde/fde_gedevice.cpp index 8370b2fbef..005387f83a 100644 --- a/xfa/fde/fde_gedevice.cpp +++ b/xfa/fde/fde_gedevice.cpp @@ -36,11 +36,10 @@ int32_t CFDE_RenderDevice::GetWidth() const { int32_t CFDE_RenderDevice::GetHeight() const { return m_pDevice->GetHeight(); } -FDE_HDEVICESTATE CFDE_RenderDevice::SaveState() { +void CFDE_RenderDevice::SaveState() { m_pDevice->SaveState(); - return NULL; } -void CFDE_RenderDevice::RestoreState(FDE_HDEVICESTATE hState) { +void CFDE_RenderDevice::RestoreState() { m_pDevice->RestoreState(false); const FX_RECT& rt = m_pDevice->GetClipBox(); m_rtClip.Set((FX_FLOAT)rt.left, (FX_FLOAT)rt.top, (FX_FLOAT)rt.Width(), diff --git a/xfa/fde/fde_gedevice.h b/xfa/fde/fde_gedevice.h index 872133c9c4..4f30bd57a4 100644 --- a/xfa/fde/fde_gedevice.h +++ b/xfa/fde/fde_gedevice.h @@ -10,8 +10,6 @@ #include "core/fxge/include/fx_ge.h" #include "xfa/fgas/crt/fgas_memory.h" -typedef struct FDE_HDEVICESTATE_ { void* pData; } * FDE_HDEVICESTATE; - class CFDE_Brush; class CFDE_Path; class CFDE_Pen; @@ -24,8 +22,8 @@ class CFDE_RenderDevice : public CFX_Target { int32_t GetWidth() const; int32_t GetHeight() const; - FDE_HDEVICESTATE SaveState(); - void RestoreState(FDE_HDEVICESTATE hState); + void SaveState(); + void RestoreState(); FX_BOOL SetClipPath(const CFDE_Path* pClip); CFDE_Path* GetClipPath() const; FX_BOOL SetClipRect(const CFX_RectF& rtClip); diff --git a/xfa/fde/fde_render.cpp b/xfa/fde/fde_render.cpp index 283cd80ffb..57ad5bff72 100644 --- a/xfa/fde/fde_render.cpp +++ b/xfa/fde/fde_render.cpp @@ -134,17 +134,15 @@ void CFDE_RenderContext::RenderText(IFDE_TextSet* pTextSet, FX_FLOAT fFontSize = pTextSet->GetFontSize(hText); FX_ARGB dwColor = pTextSet->GetFontColor(hText); m_pBrush->SetColor(dwColor); - FDE_HDEVICESTATE hState; - FX_BOOL bClip = ApplyClip(pTextSet, hText, hState); + FX_BOOL bClip = ApplyClip(pTextSet, hText); m_pRenderDevice->DrawString(m_pBrush.get(), pFont, m_pCharPos, iCount, fFontSize, &m_Transform); if (bClip) - RestoreClip(hState); + RestoreClip(); } FX_BOOL CFDE_RenderContext::ApplyClip(IFDE_VisualSet* pVisualSet, - FDE_HVISUALOBJ hObj, - FDE_HDEVICESTATE& hState) { + FDE_HVISUALOBJ hObj) { CFX_RectF rtClip; if (!pVisualSet->GetClip(hObj, rtClip)) return FALSE; @@ -155,10 +153,10 @@ FX_BOOL CFDE_RenderContext::ApplyClip(IFDE_VisualSet* pVisualSet, m_Transform.TransformRect(rtClip); const CFX_RectF& rtDevClip = m_pRenderDevice->GetClipRect(); rtClip.Intersect(rtDevClip); - hState = m_pRenderDevice->SaveState(); + m_pRenderDevice->SaveState(); return m_pRenderDevice->SetClipRect(rtClip); } -void CFDE_RenderContext::RestoreClip(FDE_HDEVICESTATE hState) { - m_pRenderDevice->RestoreState(hState); +void CFDE_RenderContext::RestoreClip() { + m_pRenderDevice->RestoreState(); } diff --git a/xfa/fde/fde_render.h b/xfa/fde/fde_render.h index 1a80bce926..302ae2d5b4 100644 --- a/xfa/fde/fde_render.h +++ b/xfa/fde/fde_render.h @@ -35,10 +35,8 @@ class CFDE_RenderContext : public CFX_Target { FDE_RENDERSTATUS DoRender(IFX_Pause* pPause = nullptr); void StopRender(); void RenderText(IFDE_TextSet* pTextSet, FDE_HVISUALOBJ hText); - FX_BOOL ApplyClip(IFDE_VisualSet* pVisualSet, - FDE_HVISUALOBJ hObj, - FDE_HDEVICESTATE& hState); - void RestoreClip(FDE_HDEVICESTATE hState); + FX_BOOL ApplyClip(IFDE_VisualSet* pVisualSet, FDE_HVISUALOBJ hObj); + void RestoreClip(); protected: FDE_RENDERSTATUS m_eStatus; diff --git a/xfa/fde/tto/fde_textout.cpp b/xfa/fde/tto/fde_textout.cpp index 7a0107d0f4..d9ada61d77 100644 --- a/xfa/fde/tto/fde_textout.cpp +++ b/xfa/fde/tto/fde_textout.cpp @@ -775,7 +775,7 @@ void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) { CFDE_Brush* pBrush = new CFDE_Brush; pBrush->SetColor(m_TxtColor); CFDE_Pen* pPen = NULL; - FDE_HDEVICESTATE hDev = m_pRenderDevice->SaveState(); + m_pRenderDevice->SaveState(); if (rtClip.Width() > 0.0f && rtClip.Height() > 0.0f) { m_pRenderDevice->SetClipRect(rtClip); } @@ -795,7 +795,7 @@ void CFDE_TextOut::OnDraw(const CFX_RectF& rtClip) { DrawLine(pPiece, pPen); } } - m_pRenderDevice->RestoreState(hDev); + m_pRenderDevice->RestoreState(); delete pBrush; delete pPen; } diff --git a/xfa/fxfa/app/xfa_textlayout.cpp b/xfa/fxfa/app/xfa_textlayout.cpp index df35c39ed4..3c7497c660 100644 --- a/xfa/fxfa/app/xfa_textlayout.cpp +++ b/xfa/fxfa/app/xfa_textlayout.cpp @@ -1174,7 +1174,7 @@ FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, std::unique_ptr pDevice( new CFDE_RenderDevice(pFxDevice, FALSE)); - FDE_HDEVICESTATE state = pDevice->SaveState(); + pDevice->SaveState(); pDevice->SetClipRect(rtClip); std::unique_ptr pSolidBrush(new CFDE_Brush); @@ -1223,7 +1223,7 @@ FX_BOOL CXFA_TextLayout::DrawString(CFX_RenderDevice* pFxDevice, tmDoc2Device); } } - pDevice->RestoreState(state); + pDevice->RestoreState(); FX_Free(pCharPos); return iPieceLines; } -- cgit v1.2.3