diff options
author | Tor Lillqvist <tml@collabora.com> | 2018-11-03 01:44:16 +0200 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2018-11-03 15:33:19 +0100 |
commit | f575cf3320684efe7db9844da89a5ebdb3083498 (patch) | |
tree | b96553bae1103593a1759d3acda0dae8a6722ce1 /desktop | |
parent | 617479a003b5f3fa876e371fe16d3a5678f2c501 (diff) |
Create a CG bitmap context in doc_paintWindow(), too, for iOS
Just like in doc_paintTile().
Now at least some of the dialogs work in the iOS app, yay.
Change-Id: I10c7eeb1f121ba68a1af723d45575890b1d598da
Reviewed-on: https://gerrit.libreoffice.org/62800
Tested-by: Jenkins
Reviewed-by: Tor Lillqvist <tml@collabora.com>
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/lib/init.cxx | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 2496f9285c05..cc49f86e6d85 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -2159,6 +2159,9 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, #ifdef IOS +// This function is separate only to be used by LibreOfficeLight. If that app can be retired, this +// function's code can be inlined into the iOS part of doc_paintTile(). + static void doc_paintTileToCGContext(LibreOfficeKitDocument* pThis, void* rCGContext, const int nCanvasWidth, const int nCanvasHeight, @@ -3572,6 +3575,33 @@ static void doc_paintWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWind return; } +#if defined(IOS) + + CGContextRef cgc = CGBitmapContextCreate(pBuffer, nWidth, nHeight, 8, nWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipFirst | kCGImageByteOrder32Little); + + CGContextTranslateCTM(cgc, 0, nHeight); + CGContextScaleCTM(cgc, 1, -1); + + SystemGraphicsData aData; + aData.rCGContext = cgc; + + ScopedVclPtrInstance<VirtualDevice> pDevice(&aData, Size(1, 1), DeviceFormat::DEFAULT); + pDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); + + pDevice->SetOutputSizePixel(Size(nWidth, nHeight)); + + MapMode aMapMode(pDevice->GetMapMode()); + aMapMode.SetOrigin(Point(-nX, -nY)); + pDevice->SetMapMode(aMapMode); + + comphelper::LibreOfficeKit::setDialogPainting(true); + pWindow->PaintToDevice(pDevice.get(), Point(0, 0), Size()); + comphelper::LibreOfficeKit::setDialogPainting(false); + + CGContextRelease(cgc); + +#else + ScopedVclPtrInstance<VirtualDevice> pDevice(nullptr, Size(1, 1), DeviceFormat::DEFAULT); pDevice->SetBackground(Wallpaper(COL_TRANSPARENT)); @@ -3584,6 +3614,8 @@ static void doc_paintWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWind comphelper::LibreOfficeKit::setDialogPainting(true); pWindow->PaintToDevice(pDevice.get(), Point(0, 0), Size()); comphelper::LibreOfficeKit::setDialogPainting(false); + +#endif } static void doc_postWindow(LibreOfficeKitDocument* /*pThis*/, unsigned nLOKWindowId, int nAction) |