diff options
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/gdi/DWriteTextRenderer.cxx | 5 | ||||
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 7 |
2 files changed, 9 insertions, 3 deletions
diff --git a/vcl/win/gdi/DWriteTextRenderer.cxx b/vcl/win/gdi/DWriteTextRenderer.cxx index da8eab0e6ce0..185925ae7967 100644 --- a/vcl/win/gdi/DWriteTextRenderer.cxx +++ b/vcl/win/gdi/DWriteTextRenderer.cxx @@ -30,6 +30,7 @@ #include <winver.h> #include <comphelper/windowserrorstring.hxx> +#include <o3tl/safeint.hxx> #include <sal/log.hxx> namespace @@ -190,7 +191,9 @@ bool D2DWriteTextOutRenderer::Ready() const HRESULT D2DWriteTextOutRenderer::BindDC(HDC hDC, tools::Rectangle const & rRect) { - RECT const rc = { rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() }; + RECT const rc = { + o3tl::narrowing<LONG>(rRect.Left()), o3tl::narrowing<LONG>(rRect.Top()), + o3tl::narrowing<LONG>(rRect.Right()), o3tl::narrowing<LONG>(rRect.Bottom()) }; return CHECKHR(mpRT->BindDC(hDC, &rc)); } diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 7863a3c353d2..398196438fb7 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -21,6 +21,8 @@ #include <config_features.h> #include <memory> + +#include <o3tl/safeint.hxx> #include <osl/module.h> #include <osl/file.h> #include <sal/log.hxx> @@ -594,8 +596,9 @@ void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) // we are making changes to the DC, make sure we got a new one assert(aDC->getCompatibleHDC() != hDC); - RECT aWinRect = { aRect.Left(), aRect.Top(), aRect.Left() + aRect.GetWidth(), - aRect.Top() + aRect.GetHeight() }; + RECT aWinRect = { o3tl::narrowing<LONG>(aRect.Left()), o3tl::narrowing<LONG>(aRect.Top()), + o3tl::narrowing<LONG>(aRect.Left() + aRect.GetWidth()), + o3tl::narrowing<LONG>(aRect.Top() + aRect.GetHeight()) }; ::FillRect(aDC->getCompatibleHDC(), &aWinRect, static_cast<HBRUSH>(::GetStockObject(WHITE_BRUSH))); |