From dbc307ef7c2351cd72e60ef46e647c908379db86 Mon Sep 17 00:00:00 2001 From: Mike Kaganski Date: Mon, 14 Nov 2022 17:34:55 +0300 Subject: gtktiledviewer: Fix getting tiles on Windows The "CanvasSize + 1" hack was implemented by myself in commit ebb3a72ba0c4f070c9c254c439147beea8b2d93d (Paint tiles on Windows; Oct 24 09:01:32 2022 +0200) to workaround a rounding error, where converting pixels to logic and back resulted in 1 pixel smaller size (when I worked in Writer). This hack breaks in Calc, because the size then is 1 pixel larger than expected, failing the assert below. This fixes the problem by disabling the map mode, as everywhere else in such cases. Change-Id: I37f0f03ae4cb19f2de0e7995064843d17b0c7189 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142714 Tested-by: Jenkins Reviewed-by: Mike Kaganski --- desktop/source/lib/init.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index f4aeaf2760cf..41f05517082f 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3703,8 +3703,8 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, #ifdef _WIN32 // pBuffer was not used there - tools::Rectangle r(pDevice->PixelToLogic({ Point(0, 0), Size(nCanvasWidth + 1, nCanvasHeight + 1) })); - BitmapEx aBmpEx = pDevice->GetBitmapEx(r.TopLeft(), r.GetSize()); + pDevice->EnableMapMode(false); + BitmapEx aBmpEx = pDevice->GetBitmapEx({ 0, 0 }, { nCanvasWidth, nCanvasHeight }); Bitmap aBmp = aBmpEx.GetBitmap(); Bitmap aAlpha = aBmpEx.GetAlpha(); Bitmap::ScopedReadAccess sraBmp(aBmp); -- cgit