diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2017-03-04 00:51:15 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2017-03-04 02:47:50 +0200 |
commit | baf3940bcafbb1acbaf75e1149e4895986f4c50f (patch) | |
tree | 6d0cb9208a87447ad59ee97bbc75efcb00bb9897 | |
parent | 6cb9e6dad798ec59f055aebe84a9c4a21e4be40d (diff) |
Avoid needless dynamic_cast’s
It is all CommonSalLayout() for sometime now.
Change-Id: I3d4ad56df195f51242c3d007bc5257c071a03a50
-rw-r--r-- | vcl/inc/win/winlayout.hxx | 8 | ||||
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 19 |
2 files changed, 10 insertions, 17 deletions
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index b057819d17c4..29122fca42d3 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -177,7 +177,7 @@ public: virtual ~TextOutRenderer() = default; - virtual bool operator ()(SalLayout const &rLayout, HDC hDC, + virtual bool operator ()(CommonSalLayout const &rLayout, HDC hDC, const Rectangle* pRectToErase, Point* pPos, int* pGetNextGlypInfo) = 0; }; @@ -190,7 +190,7 @@ class ExTextOutRenderer : public TextOutRenderer public: explicit ExTextOutRenderer() = default; - bool operator ()(SalLayout const &rLayout, HDC hDC, + bool operator ()(CommonSalLayout const &rLayout, HDC hDC, const Rectangle* pRectToErase, Point* pPos, int* pGetNextGlypInfo) override; }; @@ -217,7 +217,7 @@ public: explicit D2DWriteTextOutRenderer(); virtual ~D2DWriteTextOutRenderer() override; - bool operator ()(SalLayout const &rLayout, HDC hDC, + bool operator ()(CommonSalLayout const &rLayout, HDC hDC, const Rectangle* pRectToErase, Point* pPos, int* pGetNextGlypInfo) override; @@ -249,7 +249,7 @@ private: D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete; bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const; - bool GetDWriteInkBox(SalLayout const &rLayout, Rectangle &) const; + bool GetDWriteInkBox(CommonSalLayout const &rLayout, Rectangle &) const; ID2D1Factory * mpD2DFactory; IDWriteFactory * mpDWriteFactory; diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 193d4b6b9459..4847d67b03a5 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -265,7 +265,7 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite) } -bool ExTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC, +bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout, HDC hDC, const Rectangle* pRectToErase, Point* pPos, int* pGetNextGlypInfo) { @@ -274,8 +274,7 @@ bool ExTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC, HFONT hFont = static_cast<HFONT>(GetCurrentObject( hDC, OBJ_FONT )); HFONT hAltFont = nullptr; bool bUseAltFont = false; - const CommonSalLayout* pCSL = dynamic_cast<const CommonSalLayout*>(&rLayout); - if (pCSL && pCSL->getFontSelData().mbVertical) + if (rLayout.getFontSelData().mbVertical) { LOGFONTW aLogFont; GetObjectW(hFont, sizeof(LOGFONTW), &aLogFont); @@ -343,7 +342,7 @@ D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer() CleanupModules(); } -bool D2DWriteTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC, +bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const &rLayout, HDC hDC, const Rectangle* pRectToErase, Point* pPos, int* pGetNextGlypInfo) { @@ -368,11 +367,8 @@ bool D2DWriteTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC, bool bGlyphs = false; if (succeeded) { - bool bVertical = false; float nYDiff = 0.0f; - const CommonSalLayout* pCSL = dynamic_cast<const CommonSalLayout*>(&rLayout); - if (pCSL) - bVertical = pCSL->getFontSelData().mbVertical; + bool bVertical = rLayout.getFontSelData().mbVertical; if (bVertical) { @@ -527,7 +523,7 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** p return succeeded; } -bool D2DWriteTextOutRenderer::GetDWriteInkBox(SalLayout const &rLayout, Rectangle & rOut) const +bool D2DWriteTextOutRenderer::GetDWriteInkBox(CommonSalLayout const &rLayout, Rectangle & rOut) const { rOut.SetEmpty(); @@ -551,11 +547,8 @@ bool D2DWriteTextOutRenderer::GetDWriteInkBox(SalLayout const &rLayout, Rectangl if (aBoxes.empty()) return false; - bool bVertical = false; double nYDiff = 0.0f; - const CommonSalLayout* pCSL = dynamic_cast<const CommonSalLayout*>(&rLayout); - if (pCSL) - bVertical = pCSL->getFontSelData().mbVertical; + bool bVertical = rLayout.getFontSelData().mbVertical; if (bVertical) { |