diff options
author | Lei Zhang <thestig@chromium.org> | 2016-01-06 14:58:50 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2016-01-06 14:58:50 -0800 |
commit | cbed99098ad4cdc3f9f260cc1e8521f67c12d35d (patch) | |
tree | 4647ee4cc1d8edd615ec641cf597d3985107467d /fpdfsdk | |
parent | dcac57bc8b64fdc870d79d11a498ae7021cf8ae7 (diff) | |
download | pdfium-cbed99098ad4cdc3f9f260cc1e8521f67c12d35d.tar.xz |
Return const-ref object in a few CPWL_Wnd getters.
Also remove a bunch of dead code.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1565803003 .
Diffstat (limited to 'fpdfsdk')
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Utils.h | 1 | ||||
-rw-r--r-- | fpdfsdk/include/pdfwindow/PWL_Wnd.h | 13 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Utils.cpp | 1 | ||||
-rw-r--r-- | fpdfsdk/src/pdfwindow/PWL_Wnd.cpp | 52 |
4 files changed, 11 insertions, 56 deletions
diff --git a/fpdfsdk/include/pdfwindow/PWL_Utils.h b/fpdfsdk/include/pdfwindow/PWL_Utils.h index 56f7a27350..ef87ea36f4 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Utils.h +++ b/fpdfsdk/include/pdfwindow/PWL_Utils.h @@ -220,7 +220,6 @@ class CPWL_Utils { const CPWL_Color& crLeftTop, const CPWL_Color& crRightBottom, int32_t nStyle, - const CPWL_Dash& dash, int32_t nTransparancy); static void DrawFillArea(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device, diff --git a/fpdfsdk/include/pdfwindow/PWL_Wnd.h b/fpdfsdk/include/pdfwindow/PWL_Wnd.h index 0ea48b570d..4f59fc3d92 100644 --- a/fpdfsdk/include/pdfwindow/PWL_Wnd.h +++ b/fpdfsdk/include/pdfwindow/PWL_Wnd.h @@ -294,7 +294,6 @@ class CPWL_Wnd : public CPWL_TimerHandler { void Move(const CPDF_Rect& rcNew, FX_BOOL bReset, FX_BOOL bRefresh); virtual void InvalidateRect(CPDF_Rect* pRect = NULL); - void GetAppearanceStream(CFX_ByteString& sAppStream); void DrawAppearance(CFX_RenderDevice* pDevice, CFX_Matrix* pUser2Device); virtual FX_BOOL OnKeyDown(FX_WORD nChar, FX_DWORD nFlag); @@ -341,27 +340,21 @@ class CPWL_Wnd : public CPWL_TimerHandler { virtual void SetFontSize(FX_FLOAT fFontSize); void SetBackgroundColor(const CPWL_Color& color); - void SetBorderColor(const CPWL_Color& color); - void SetBorderWidth(int32_t nBorderWidth); void SetClipRect(const CPDF_Rect& rect); void SetBorderStyle(int32_t eBorderStyle); - void SetBorderDash(const CPWL_Dash& sDash); - CPDF_Rect GetOriginWindowRect() const; virtual CPDF_Rect GetWindowRect() const; virtual CPDF_Rect GetClientRect() const; CPDF_Point GetCenterPoint() const; - CPDF_Rect GetClientCenterSquare() const; - CPDF_Rect GetWindowCenterSquare() const; int32_t GetBorderWidth() const; FX_BOOL IsVisible() const { return m_bVisible; } FX_BOOL HasFlag(FX_DWORD dwFlags) const; void AddFlag(FX_DWORD dwFlags); void RemoveFlag(FX_DWORD dwFlags); - CPDF_Rect GetClipRect() const; + const CPDF_Rect& GetClipRect() const; CPWL_Wnd* GetParentWindow() const; int32_t GetBorderStyle() const; - CPWL_Dash GetBorderDash() const; + const CPWL_Dash& GetBorderDash() const; void* GetAttachedData() const; FX_BOOL WndHitTest(const CPDF_Point& point) const; @@ -427,7 +420,7 @@ class CPWL_Wnd : public CPWL_TimerHandler { void SetNotifyFlag(FX_BOOL bNotifying = TRUE) { m_bNotifying = bNotifying; } FX_BOOL IsValid() const; - PWL_CREATEPARAM GetCreationParam() const; + const PWL_CREATEPARAM& GetCreationParam() const; FX_BOOL IsNotifying() const { return m_bNotifying; } void InvalidateRectMove(const CPDF_Rect& rcOld, const CPDF_Rect& rcNew); diff --git a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp index 2c9ec99dc8..3b0f3beff9 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Utils.cpp @@ -1469,7 +1469,6 @@ void CPWL_Utils::DrawBorder(CFX_RenderDevice* pDevice, const CPWL_Color& crLeftTop, const CPWL_Color& crRightBottom, int32_t nStyle, - const CPWL_Dash& dash, int32_t nTransparancy) { FX_FLOAT fLeft = rect.left; FX_FLOAT fRight = rect.right; diff --git a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp index 5bedad127a..d0aaa78ea4 100644 --- a/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp +++ b/fpdfsdk/src/pdfwindow/PWL_Wnd.cpp @@ -302,14 +302,6 @@ void CPWL_Wnd::InvalidateRectMove(const CPDF_Rect& rcOld, InvalidateRect(&rcUnion); } -void CPWL_Wnd::GetAppearanceStream(CFX_ByteString& sAppStream) { - if (IsValid()) { - CFX_ByteTextBuf sTextBuf; - GetAppearanceStream(sTextBuf); - sAppStream += sTextBuf.GetByteString(); - } -} - void CPWL_Wnd::GetAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (IsValid() && IsVisible()) { GetThisAppearanceStream(sAppStream); @@ -366,11 +358,11 @@ void CPWL_Wnd::DrawThisAppearance(CFX_RenderDevice* pDevice, } if (HasFlag(PWS_BORDER)) - CPWL_Utils::DrawBorder( - pDevice, pUser2Device, rectWnd, (FX_FLOAT)GetBorderWidth(), - GetBorderColor(), GetBorderLeftTopColor(GetBorderStyle()), - GetBorderRightBottomColor(GetBorderStyle()), GetBorderStyle(), - GetBorderDash(), GetTransparency()); + CPWL_Utils::DrawBorder(pDevice, pUser2Device, rectWnd, + (FX_FLOAT)GetBorderWidth(), GetBorderColor(), + GetBorderLeftTopColor(GetBorderStyle()), + GetBorderRightBottomColor(GetBorderStyle()), + GetBorderStyle(), GetTransparency()); } } @@ -528,7 +520,7 @@ FX_BOOL CPWL_Wnd::IsValid() const { return m_bCreated; } -PWL_CREATEPARAM CPWL_Wnd::GetCreationParam() const { +const PWL_CREATEPARAM& CPWL_Wnd::GetCreationParam() const { return m_sPrivateParam; } @@ -536,10 +528,6 @@ CPWL_Wnd* CPWL_Wnd::GetParentWindow() const { return m_sPrivateParam.pParentWnd; } -CPDF_Rect CPWL_Wnd::GetOriginWindowRect() const { - return m_sPrivateParam.rcRectWnd; -} - CPDF_Rect CPWL_Wnd::GetWindowRect() const { return m_rcWindow; } @@ -561,15 +549,6 @@ CPDF_Point CPWL_Wnd::GetCenterPoint() const { (rcClient.top + rcClient.bottom) * 0.5f); } -CPDF_Rect CPWL_Wnd::GetClientCenterSquare() const { - return CPWL_Utils::GetCenterSquare(GetClientRect()); -} - -CPDF_Rect CPWL_Wnd::GetWindowCenterSquare() const { - return CPWL_Utils::GetCenterSquare( - CPWL_Utils::DeflateRect(GetWindowRect(), 0.1f)); -} - FX_BOOL CPWL_Wnd::HasFlag(FX_DWORD dwFlags) const { return (m_sPrivateParam.dwFlags & dwFlags) != 0; } @@ -626,11 +605,6 @@ int32_t CPWL_Wnd::GetInnerBorderWidth() const { return 0; } -void CPWL_Wnd::SetBorderWidth(int32_t nBorderWidth) { - if (HasFlag(PWS_BORDER)) - m_sPrivateParam.dwBorderWidth = nBorderWidth; -} - CPWL_Color CPWL_Wnd::GetBorderColor() const { if (HasFlag(PWS_BORDER)) return m_sPrivateParam.sBorderColor; @@ -638,12 +612,7 @@ CPWL_Color CPWL_Wnd::GetBorderColor() const { return CPWL_Color(); } -void CPWL_Wnd::SetBorderColor(const CPWL_Color& color) { - if (HasFlag(PWS_BORDER)) - m_sPrivateParam.sBorderColor = color; -} - -CPWL_Dash CPWL_Wnd::GetBorderDash() const { +const CPWL_Dash& CPWL_Wnd::GetBorderDash() const { return m_sPrivateParam.sDash; } @@ -651,11 +620,6 @@ void* CPWL_Wnd::GetAttachedData() const { return m_sPrivateParam.pAttachedData; } -void CPWL_Wnd::SetBorderDash(const CPWL_Dash& sDash) { - if (HasFlag(PWS_BORDER)) - m_sPrivateParam.sDash = sDash; -} - CPWL_ScrollBar* CPWL_Wnd::GetVScrollBar() const { if (HasFlag(PWS_VSCROLL)) return m_pVScrollBar; @@ -754,7 +718,7 @@ void CPWL_Wnd::SetClipRect(const CPDF_Rect& rect) { m_rcClip.Normalize(); } -CPDF_Rect CPWL_Wnd::GetClipRect() const { +const CPDF_Rect& CPWL_Wnd::GetClipRect() const { return m_rcClip; } |