desktop/source/lib/init.cxx |   11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 272de6ec30021fdbda38a1bd84a3036a0afc73d6
Author:     Patrick Luby <[email protected]>
AuthorDate: Wed Jul 12 13:08:29 2023 -0400
Commit:     Michael Meeks <[email protected]>
CommitDate: Wed Jul 12 19:15:20 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 <[email protected]>
    Tested-by: Michael Meeks <[email protected]>

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e8586fb5af7e..45bd9e608e70 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -3944,9 +3944,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);
@@ -4214,7 +4216,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;
@@ -6480,8 +6482,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);

Reply via email to