diff options
author | Tomaž Vajngerl <tomaz.vajngerl@collabora.co.uk> | 2017-07-13 13:30:20 +0200 |
---|---|---|
committer | Andras Timar <andras.timar@collabora.com> | 2017-07-13 11:00:02 -0700 |
commit | 1e13a4098887b225ddf47c14be98f3cd2c48dec4 (patch) | |
tree | 3549c8722ae13dc63ec3b9ac9ecaaa94b8d6d140 /vcl/inc | |
parent | abb478cdad871ecd12d167a75075158bdba2bf02 (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.
Conflicts:
vcl/inc/win/winlayout.hxx
Change-Id: I79c7f0cf4d69f213370ed26a811a908ed16070ff
Diffstat (limited to 'vcl/inc')
-rw-r--r-- | vcl/inc/win/winlayout.hxx | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index 8ceebeac3882..d733e185d59d 100644 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -458,7 +458,10 @@ public: const Rectangle* pRectToErase, Point* pPos, int* pGetNextGlypInfo) override; - inline bool BindDC(HDC hDC, Rectangle const & rRect = Rectangle(0, 0, 0, 0)) { + inline bool BindDC(HDC hDC, Rectangle const & rRect = 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)); } |