desktop/source/lib/init.cxx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
New commits: commit dd1d74281a119f076e58598c8e022ee30232e5bf Author: Patrick Luby <plub...@neooffice.org> AuthorDate: Wed Jul 12 13:08:29 2023 -0400 Commit: Patrick Luby <plub...@neooffice.org> CommitDate: Wed Jul 12 22:14:58 2023 +0200 Natively draw to pixel buffer with RBGA pixel format in iOS app Change-Id: I31917f914ed22bebffc52777cb974224d08bed83 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154367 Reviewed-by: Michael Meeks <michael.me...@collabora.com> Tested-by: Michael Meeks <michael.me...@collabora.com> (cherry picked from commit 272de6ec30021fdbda38a1bd84a3036a0afc73d6) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/154325 Tested-by: Jenkins Reviewed-by: Patrick Luby <plub...@neooffice.org> diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index dbd236858ce8..99ba738c17d5 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -3964,9 +3964,11 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis, #if defined(IOS) double fDPIScale = 1.0; + // Onine uses the LOK_TILEMODE_RGBA by default so flip the normal flags + // to kCGImageAlphaPremultipliedLast | kCGImageByteOrder32Big CGContextRef pCGContext = CGBitmapContextCreate(pBuffer, nCanvasWidth, nCanvasHeight, 8, nCanvasWidth * 4, CGColorSpaceCreateDeviceRGB(), - kCGImageAlphaPremultipliedFirst | kCGImageByteOrder32Little); + kCGImageAlphaPremultipliedLast | kCGImageByteOrder32Big); CGContextTranslateCTM(pCGContext, 0, nCanvasHeight); CGContextScaleCTM(pCGContext, fDPIScale, -fDPIScale); @@ -4234,7 +4236,7 @@ static void doc_paintPartTile(LibreOfficeKitDocument* pThis, static int doc_getTileMode(SAL_UNUSED_PARAMETER LibreOfficeKitDocument* /*pThis*/) { SetLastExceptionMsg(); -#if ENABLE_CAIRO_RGBA +#if ENABLE_CAIRO_RGBA || defined IOS return LOK_TILEMODE_RGBA; #else return LOK_TILEMODE_BGRA; @@ -6613,8 +6615,9 @@ static void doc_paintWindowForView(LibreOfficeKitDocument* pThis, unsigned nLOKW comphelper::LibreOfficeKit::setDPIScale(fDPIScale); #if defined(IOS) - - CGContextRef cgc = CGBitmapContextCreate(pBuffer, nWidth, nHeight, 8, nWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipFirst | kCGImageByteOrder32Little); + // Onine uses the LOK_TILEMODE_RGBA by default so flip the normal flags + // to kCGImageAlphaNoneSkipLast | kCGImageByteOrder32Big + CGContextRef cgc = CGBitmapContextCreate(pBuffer, nWidth, nHeight, 8, nWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipLast | kCGImageByteOrder32Big); CGContextTranslateCTM(cgc, 0, nHeight); CGContextScaleCTM(cgc, fDPIScale, -fDPIScale);