summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2022-11-14 17:34:55 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2022-11-14 19:22:04 +0100
commitdbc307ef7c2351cd72e60ef46e647c908379db86 (patch)
treefd5906da86a13d5d754230c84928fac9d8f7a91b
parent9c33b6772022333ca6651a400064154f8705788d (diff)
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 <mike.kaganski@collabora.com>
-rw-r--r--desktop/source/lib/init.cxx4
1 files 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);