diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index a1bebedb4..27584ba49 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -181,7 +181,7 @@ #include #include #include -#ifdef _WIN32 +#if defined(_WIN32) || defined(MACOSX) #include #endif #include @@ -2603,10 +2603,15 @@ void CallbackFlushHandler::stop() stop(); } void CallbackFlushHandler::scheduleFlush() { +#if defined(MACOSX) + // Aqua never runs posted user events: flush inline. + invoke(); +#else if (!m_pFlushEvent) m_pFlushEvent = Application::PostUserEvent(LINK(this, CallbackFlushHandler, FlushQueue)); +#endif } IMPL_LINK_NOARG(CallbackFlushHandler, FlushQueue, void*, void) @@ -4274,7 +4274,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, return; } -#if defined(UNX) && !defined(MACOSX) || defined(_WIN32) +#if defined(UNX) || defined(_WIN32) // Painting of zoomed or HiDPI spreadsheets is special, we actually draw everything at 100%, // and only set cairo's (or CoreGraphic's, in the iOS case) scale factor accordingly, so that @@ -4317,9 +4317,14 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, // Set background to transparent by default. pDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); +#if defined(MACOSX) + // Aqua devices cannot paint client buffers: paint, then copy. + pDevice->SetOutputSizePixel(Size(nCanvasWidth, nCanvasHeight)); +#else pDevice->SetOutputSizePixelScaleOffsetAndLOKBuffer( Size(nCanvasWidth, nCanvasHeight), Fraction(1.0), Point(), pBuffer); +#endif pDoc->paintTile(*pDevice, nCanvasWidth, nCanvasHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight); @@ -4336,7 +4341,7 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, pDevice->DrawRect(aRect); } -#ifdef _WIN32 +#if defined(_WIN32) || defined(MACOSX) // pBuffer was not used there pDevice->EnableMapMode(false); Bitmap aBmp(pDevice->GetBitmap({ 0, 0 }, { nCanvasWidth, nCanvasHeight }));