desktop/source/lib/init.cxx |    7 +++++++
 vcl/quartz/salgdicommon.cxx |   20 +++++---------------
 2 files changed, 12 insertions(+), 15 deletions(-)

New commits:
commit c1f15b7a6511fd26502a2217c18c5f68ee928a31
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Fri Mar 15 18:32:50 2019 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Fri Mar 15 18:35:29 2019 +0200

    tdf#124042: Remove unnecessary code for iOS
    
    We don't need to pop the Core Graphics context state stack completely
    before releasing the context. The code that tried to do that failed
    anyway when the context was a "foreign" one (from doc_paintWindowDPI()
    in core's init.cxx) thad had already been released there.
    
    Also removed another apparently unnecessary ifndef for iOS.
    
    Change-Id: Idcd1e6edd06ab259ec850fd66fcbabc3df0ae3af

diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 011c4297095d..fbd49f60d459 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -2052,26 +2052,11 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef 
xLayer, CGContextRef xContex
     mbPrinter = false;
     mbVirDev = true;
 
-#ifdef IOS
-    (void) nBitmapDepth;
-
-    if( !xContext )
-    {
-        // We will return early a few lines lower.
-        // Undo the "stack initialization" done at the initial call of
-        // this method, see end.
-        SAL_INFO( "vcl.cg", "CGContextRestoreGState(" << mrContext << ") " << 
mnContextStackDepth--);
-        CGContextRestoreGState( mrContext );
-    }
-#endif
-
     // set graphics properties
     mxLayer = xLayer;
     mrContext = xContext;
 
-#ifndef IOS
     mnBitmapDepth = nBitmapDepth;
-#endif
 
 #ifdef IOS
     mbForeignContext = xContext != NULL;
commit 7f0e669885fb1ac6efaceb5aea21c117825e3495
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Fri Mar 15 18:18:38 2019 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Fri Mar 15 18:31:55 2019 +0200

    tdf#124042: If mrContext is zero, calling Core Graphics APIs on it is futile
    
    If mrContext is zero, the CG calls using it won't do anything and will
    cause "invalid context" warnings when running under Xcode. So just
    return early. Such calls to drawPolyPolygon() are apparently not
    essential but accidental and of no real use. Possibly related to bogus
    "focus" indicator painting. Which does not make sense on iOS as we
    aren't drawing to any actual "windows" with "focus".
    
    Change-Id: Icc4a768d8b255c09a8972551443ce59f4ad56089

diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index d1beb08c1a66..011c4297095d 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -951,6 +951,11 @@ bool AquaSalGraphics::drawPolyLineBezier( sal_uInt32, 
const SalPoint*, const Pol
 bool AquaSalGraphics::drawPolyPolygon( const basegfx::B2DPolyPolygon& 
rPolyPoly,
                                        double fTransparency )
 {
+#ifdef IOS
+    if (!mrContext)
+        return true;
+#endif
+
     // short circuit if there is nothing to do
     const int nPolyCount = rPolyPoly.count();
     if( nPolyCount <= 0 )
commit 8a244ee9b43dce6bdcd930473586a2d8452dfb12
Author:     Tor Lillqvist <t...@collabora.com>
AuthorDate: Fri Mar 15 16:56:45 2019 +0200
Commit:     Tor Lillqvist <t...@collabora.com>
CommitDate: Fri Mar 15 17:11:01 2019 +0200

    tdf#124042: Add SAL_INFOs for iOS about the CGContext life cycle in LOKit
    
    Use the same logging tag as in vcl for uniformity. Helps in tracing
    the life cycle and usage of CGContexts.
    
    Change-Id: I89c33ac63fa26e10a8866c2aacecce89ef9b5f6b

diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index 88970631ce48..d79d086b66f9 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -2380,11 +2380,15 @@ static void doc_paintTile(LibreOfficeKitDocument* pThis,
 #if defined(IOS)
     CGContextRef cgc = CGBitmapContextCreate(pBuffer, nCanvasWidth, 
nCanvasHeight, 8, nCanvasWidth*4, CGColorSpaceCreateDeviceRGB(), 
kCGImageAlphaNoneSkipFirst | kCGImageByteOrder32Little);
 
+    // Use the vcl.cg tag even if this code is not in vcl, to match all other 
SAL_INFO logging about Core Graphics, in vcl.
+    SAL_INFO( "vcl.cg", "CGBitmapContextCreate(" << nCanvasWidth << "x" << 
nCanvasHeight << "x32) = " << cgc );
+
     CGContextTranslateCTM(cgc, 0, nCanvasHeight);
     CGContextScaleCTM(cgc, fDPIScaleX, -fDPIScaleX);
 
     doc_paintTileToCGContext(pThis, (void*) cgc, nCanvasWidth, nCanvasHeight, 
nTilePosX, nTilePosY, nTileWidth, nTileHeight);
 
+    SAL_INFO( "vcl.cg", "CGContextRelease(" << cgc << ")" );
     CGContextRelease(cgc);
 #else
     ScopedVclPtrInstance< VirtualDevice > pDevice(nullptr, Size(1, 1), 
DeviceFormat::DEFAULT) ;
@@ -3968,6 +3972,8 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* 
/*pThis*/, unsigned nLOKW
 
     CGContextRef cgc = CGBitmapContextCreate(pBuffer, nWidth, nHeight, 8, 
nWidth*4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipFirst | 
kCGImageByteOrder32Little);
 
+    SAL_INFO( "vcl.cg", "CGBitmapContextCreate(" << nWidth << "x" << nHeight 
<< "x32) = " << cgc);
+
     CGContextTranslateCTM(cgc, 0, nHeight);
     CGContextScaleCTM(cgc, fDPIScale, -fDPIScale);
 
@@ -3987,6 +3993,7 @@ static void doc_paintWindowDPI(LibreOfficeKitDocument* 
/*pThis*/, unsigned nLOKW
     pWindow->PaintToDevice(pDevice.get(), Point(0, 0), Size());
     comphelper::LibreOfficeKit::setDialogPainting(false);
 
+    SAL_INFO( "vcl.cg", "CGContextRelease(" << cgc << ")" );
     CGContextRelease(cgc);
 
 #else
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to