summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomaž Vajngerl <tomaz.vajngerl@collabora.co.uk>2017-07-13 13:30:20 +0200
committerJan Holesovsky <kendy@collabora.com>2017-07-21 14:20:10 +0200
commit8b804eb3aec9e3fe957ecdb077649742cd2d978c (patch)
tree1d95bace93b6ed5adf179a2680934fd1f64fcea1
parentfe2610d88d809611cedd588b62bd89d245aac36f (diff)
tdf#107166 BindDC doesn't handle 0 width/height rect consistently
When binding a GDI device context to D2D we need to provide a rectangle where the surface will have effect. When we just need some font information we need to bind the DC too, but we aren't really interested what the rectangle is, so we just provided a 0,0,0,0 rectangle in that case. This sometimes fails with a "out of memory" result and is dependent on the renderer. Instead of 0,0,0,0 rectangle we rather define a 0,0,1,1 rectangle which should never fail. This is not problematic as for actual rendering we later rebind with an actual rectangle. Change-Id: I79c7f0cf4d69f213370ed26a811a908ed16070ff Reviewed-on: https://gerrit.libreoffice.org/39902 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com> (cherry picked from commit 35f8c78b5fbdbb3619b1c0f9fdee5f84ac1a6f73) Reviewed-on: https://gerrit.libreoffice.org/40273 Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Reviewed-by: Michael Stahl <mstahl@redhat.com> Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jan Holesovsky <kendy@collabora.com>
-rw-r--r--vcl/inc/win/winlayout.hxx5
1 files changed, 4 insertions, 1 deletions
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx
index 9d2a40eba5be..128ff1f96a47 100644
--- a/vcl/inc/win/winlayout.hxx
+++ b/vcl/inc/win/winlayout.hxx
@@ -225,7 +225,10 @@ public:
SalGraphics &rGraphics,
HDC hDC) override;
- bool BindDC(HDC hDC, tools::Rectangle const & rRect = tools::Rectangle(0, 0, 0, 0)) {
+ bool BindDC(HDC hDC, tools::Rectangle const & rRect = tools::Rectangle(0, 0, 1, 1))
+ {
+ if (rRect.GetWidth() == 0 || rRect.GetHeight() == 0)
+ return false;
RECT const rc = { rRect.Left(), rRect.Top(), rRect.Right(), rRect.Bottom() };
return SUCCEEDED(mpRT->BindDC(hDC, &rc));
}