From 0eea1465a06119903fca5f5b6dfe5b05a80546ba Mon Sep 17 00:00:00 2001 From: Tim Eves Date: Fri, 18 Mar 2016 14:19:50 +0700 Subject: Fix failure to print when using the D2DWrite path It seems that D2D1DCRenderrTarget cannot bind to a DC on a printer device. Now whenever that attempt to bind the DC fails we run the legacy API path as a fallback. Change-Id: I6ad8d82e5280fd2dcf669310bab0f5bfc23a138a Reviewed-on: https://gerrit.libreoffice.org/23366 Tested-by: Jenkins Reviewed-by: Martin Hosken --- vcl/win/gdi/winlayout.cxx | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'vcl') diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index d67221e28253..572f6a946bab 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -3799,15 +3799,13 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC, return false; if (!BindFont(hDC)) - return false; - Rectangle bounds; - bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, bounds); - if (pRectToErase) { - // Isn't this equivalent to simply doing: bounds = *pRectToErase ? - bounds.Intersection(*pRectToErase); - bounds.Union(*pRectToErase); + // If for any reason we can't bind fallback to legacy APIs. + return ExTextOutRenderer()(rLayout, hDC, pRectToErase, pPos, pGetNextGlypInfo); } + + Rectangle bounds; + bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, bounds); succeeded &= BindDC(hDC, bounds); // Update the bounding rect. ID2D1SolidColorBrush* pBlackBrush = NULL; -- cgit