[Libreoffice-commits] core.git: 5 commits - unotools/source vcl/quartz

Tor Lillqvist tml at collabora.com
Thu Apr 10 07:45:29 PDT 2014


 unotools/source/config/fltrcfg.cxx |   16 +++++++++
 vcl/quartz/salbmp.cxx              |   39 ++++++++++++++++++++++
 vcl/quartz/salgdicommon.cxx        |   63 +++++++++++++++++++------------------
 3 files changed, 87 insertions(+), 31 deletions(-)

New commits:
commit 6807c13a39cfcfd16db221196e348f5fd374e967
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Apr 10 16:59:03 2014 +0300

    More iOS-only debugging hackery: write CGImages out as PNGs for inspection
    
    Change-Id: I966189a74414ea83b2ec7f5035cd7c9d4d674179

diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index 1e06fd43..45c3e1a 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -46,6 +46,38 @@ static const unsigned long k32BitRedColorMask   = 0x00ff0000;
 static const unsigned long k32BitGreenColorMask = 0x0000ff00;
 static const unsigned long k32BitBlueColorMask  = 0x000000ff;
 
+#if defined IOS && defined DBG_UTIL
+
+#include <MobileCoreServices/UTCoreTypes.h>
+#include <ImageIO/ImageIO.h>
+
+static void writeImageToFile(CGImageRef image, const char *baseName)
+{
+    static int counter = 0;
+    NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
+    NSString *documentsDirectory = [paths objectAtIndex:0];
+    NSString *path = [NSString stringWithFormat:@"%@/%s.%d.png", documentsDirectory, baseName, counter++];
+    CFURLRef url = (CFURLRef)[NSURL fileURLWithPath:path];
+    CGImageDestinationRef destination = CGImageDestinationCreateWithURL(url, kUTTypePNG, 1, NULL);
+    CGImageDestinationAddImage(destination, image, nil);
+
+    if (!CGImageDestinationFinalize(destination)) {
+        NSLog(@"Failed to write image to %@", path);
+    } else {
+        SAL_DEBUG("--- saved image " << baseName << " to " << [path UTF8String]);
+    }
+
+    CFRelease(destination);
+}
+
+#define DBG_WRITE_IMAGE(image, name) writeImageToFile(image, name)
+
+#else
+
+#define DBG_WRITE_IMAGE(image, name) /* empty */
+
+#endif
+
 static bool isValidBitCount( sal_uInt16 nBitCount )
 {
     return (nBitCount == 1) || (nBitCount == 4) || (nBitCount == 8) || (nBitCount == 16) || (nBitCount == 24) || (nBitCount == 32);
@@ -753,6 +785,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
 
     // CGImageCreateWithMask() only likes masks or greyscale images => convert if needed
     // TODO: isolate in an extra method?
+    DBG_WRITE_IMAGE(xMask, "xMask");
     if( !CGImageIsMask(xMask) || rMask.GetBitCount() != 8)//(CGImageGetColorSpace(xMask) != GetSalData()->mxGraySpace) )
     {
         const CGRect xImageRect=CGRectMake( 0, 0, nWidth, nHeight );//the rect has no offset
@@ -763,7 +796,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
         void* pMaskMem = rtl_allocateMemory( nMaskBytesPerRow * nHeight );
         CGContextRef xMaskContext = CGBitmapContextCreate( pMaskMem,
             nWidth, nHeight, 8, nMaskBytesPerRow, GetSalData()->mxGraySpace, kCGImageAlphaNone );
-        CG_TRACE( "CGBitmapContextCreate(" << nWidth << "x" << nHeight << "x8) = " << xMaskContext );
+        CG_TRACE( "CGBitmapContextCreate(" << nWidth << "x" << nHeight << "x8," << nMaskBytesPerRow << ") = " << xMaskContext );
         CG_TRACE( "CGContextDrawImage(" << xMaskContext << "," << xImageRect << "," << xMask << ")" );
         CGContextDrawImage( xMaskContext, xImageRect, xMask );
         CG_TRACE( "CFRelease(" << xMask << ")" );
@@ -773,6 +806,7 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
         static const CGFloat* pDecode = NULL;
         xMask = CGImageMaskCreate( nWidth, nHeight, 8, 8, nMaskBytesPerRow, xDataProvider, pDecode, false );
         CG_TRACE( "CGImageMaskCreate(" << nWidth << "," << nHeight << ",8,8) = " << xMask );
+        DBG_WRITE_IMAGE(xMask, "xMask.new");
         CFRelease( xDataProvider );
         CG_TRACE( "CFRelease(" << xMaskContext << ")" );
         CFRelease( xMaskContext );
@@ -784,6 +818,8 @@ CGImageRef QuartzSalBitmap::CreateWithMask( const QuartzSalBitmap& rMask,
     // combine image and alpha mask
     CGImageRef xMaskedImage = CGImageCreateWithMask( xImage, xMask );
     CG_TRACE( "CGImageCreateWithMask(" << xImage << "," << xMask << ") = " << xMaskedImage );
+    DBG_WRITE_IMAGE(xImage, "xImage");
+    DBG_WRITE_IMAGE(xMaskedImage, "xMaskedImage");
     CG_TRACE( "CFRelease(" << xMask << ")" );
     CFRelease( xMask );
     CG_TRACE( "CFRelease(" << xImage << ")" );
commit d0315bd4819416142b413c33f40db16c4fb2dbd8
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Apr 10 13:01:48 2014 +0300

    Set mbPrinter anc mbVirDev for iOS, too
    
    But, has no visible effect, doesn't fix rendering problems.
    
    Change-Id: Ic79b38b665e357a2dafe679c35979250c3bff538

diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index 5f90fef..ceb1ee5 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -2140,9 +2140,9 @@ void AquaSalGraphics::SetVirDevGraphics( CGLayerRef xLayer, CGContextRef xContex
 
 #ifndef IOS
     mbWindow    = false;
+#endif
     mbPrinter   = false;
     mbVirDev    = true;
-#endif
 
 #ifdef IOS
     (void) nBitmapDepth;
commit f5eae0955438dcaf9e7109ba61d7398fe2eebee1
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Apr 10 12:42:07 2014 +0300

    Mention early exits in the verbose debugging log
    
    Change-Id: I68e5aa92cb6ccff8b8d077c311d2ebc3f4676ae7

diff --git a/vcl/quartz/salgdicommon.cxx b/vcl/quartz/salgdicommon.cxx
index ba80504..5f90fef 100644
--- a/vcl/quartz/salgdicommon.cxx
+++ b/vcl/quartz/salgdicommon.cxx
@@ -58,10 +58,13 @@ extern int DBG_DRAW_ROUNDS, DBG_DRAW_COUNTER, DBG_DRAW_DEPTH;
             SAL_DEBUG("<=== " << s << " " << DBG_DRAW_COUNTER); \
     } while (false)
 
+#define DBG_DRAW_OPERATION_EXIT_EARLY(s) DBG_DRAW_OPERATION_EXIT(s << " exit early " << __LINE__)
+
 #else
 
 #define DBG_DRAW_OPERATION(s,v) /* empty */
 #define DBG_DRAW_OPERATION_EXIT(s) /* empty */
+#define DBG_DRAW_OPERATION_EXIT_EARLY(s) /* empty */
 
 #endif
 
@@ -569,7 +572,7 @@ bool AquaSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
     // An image mask can't have a depth > 8 bits (should be 1 to 8 bits)
     if( rAlphaBmp.GetBitCount() > 8 )
     {
-        DBG_DRAW_OPERATION_EXIT("drawAlphaBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawAlphaBitmap");
         return false;
     }
 
@@ -577,7 +580,7 @@ bool AquaSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
     // horizontal/vertical mirroring not implemented yet
     if( rTR.mnDestWidth < 0 || rTR.mnDestHeight < 0 )
     {
-        DBG_DRAW_OPERATION_EXIT("drawAlphaBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawAlphaBitmap");
         return false;
     }
 
@@ -588,7 +591,7 @@ bool AquaSalGraphics::drawAlphaBitmap( const SalTwoRect& rTR,
                                                          rTR.mnSrcHeight );
     if( !xMaskedImage )
     {
-        DBG_DRAW_OPERATION_EXIT("drawAlphaBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawAlphaBitmap");
         return false;
     }
 
@@ -615,7 +618,7 @@ bool AquaSalGraphics::drawTransformedBitmap(
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawTransformedBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawTransformedBitmap");
         return true;
     }
 
@@ -630,7 +633,7 @@ bool AquaSalGraphics::drawTransformedBitmap(
         xImage = rSrcSalBmp.CreateWithMask( *pMaskSalBmp, 0, 0, (int)aSize.Width(), (int)aSize.Height() );
     if( !xImage )
     {
-        DBG_DRAW_OPERATION_EXIT("drawTransformedBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawTransformedBitmap");
         return false;
     }
 
@@ -672,7 +675,7 @@ bool AquaSalGraphics::drawAlphaRect( long nX, long nY, long nWidth,
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawAlphaRect");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawAlphaRect");
         return true;
     }
 
@@ -711,7 +714,7 @@ void AquaSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rS
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawBitmap");
         return;
     }
 
@@ -720,7 +723,7 @@ void AquaSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rS
                                                     (int)rPosAry.mnSrcWidth, (int)rPosAry.mnSrcHeight );
     if( !xImage )
     {
-        DBG_DRAW_OPERATION_EXIT("drawBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawBitmap");
         return;
     }
 
@@ -747,7 +750,7 @@ void AquaSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rS
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawBitmap");
         return;
     }
 
@@ -757,7 +760,7 @@ void AquaSalGraphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rS
                                                      rPosAry.mnSrcWidth, rPosAry.mnSrcHeight ) );
     if( !xMaskedImage )
     {
-        DBG_DRAW_OPERATION_EXIT("drawBitmap");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawBitmap");
         return;
     }
 
@@ -832,13 +835,13 @@ void AquaSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 )
         // #i109453# platform independent code expects at least one pixel to be drawn
         drawPixel( nX1, nY1 );
 
-        DBG_DRAW_OPERATION_EXIT("drawLine");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawLine");
         return;
     }
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawLine");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawLine");
         return;
     }
 
@@ -864,7 +867,7 @@ void AquaSalGraphics::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSal
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawMask");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawMask");
         return;
     }
 
@@ -874,7 +877,7 @@ void AquaSalGraphics::drawMask( const SalTwoRect& rPosAry, const SalBitmap& rSal
                                                  nMaskColor );
     if( !xImage )
     {
-        DBG_DRAW_OPERATION_EXIT("drawMask");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawMask");
         return;
     }
 
@@ -913,21 +916,21 @@ bool AquaSalGraphics::drawPolyLine(
     const int nPointCount = rPolyLine.count();
     if( nPointCount <= 0 )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyLine");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyLine");
         return true;
     }
 
     // reject requests that cannot be handled yet
     if( rLineWidths.getX() != rLineWidths.getY() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyLine");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyLine");
         return false;
     }
 
 #ifdef IOS
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyLine");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyLine");
         return false;
     }
 #endif
@@ -938,7 +941,7 @@ bool AquaSalGraphics::drawPolyLine(
     if( (basegfx::B2DLINEJOIN_NONE == eLineJoin) &&
         (rLineWidths.getX() > 1.3) )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyLine");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyLine");
         return false;
     }
 
@@ -1029,14 +1032,14 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol
     const int nPolyCount = rPolyPoly.count();
     if( nPolyCount <= 0 )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyPolygon");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyPolygon");
         return true;
     }
 
     // ignore invisible polygons
     if( (fTransparency >= 1.0) || (fTransparency < 0) )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyPolygon");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyPolygon");
         return true;
     }
 
@@ -1073,7 +1076,7 @@ bool AquaSalGraphics::drawPolyPolygon( const ::basegfx::B2DPolyPolygon& rPolyPol
             SAL_WARN( "vcl.quartz", "Neither pen nor brush visible" );
             CG_TRACE( "CGPathRelease(" << xPath << ")" );
             CGPathRelease( xPath );
-            DBG_DRAW_OPERATION_EXIT("drawPolyPolygon");
+            DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyPolygon");
             return true;
         }
 
@@ -1111,13 +1114,13 @@ void AquaSalGraphics::drawPolyPolygon( sal_uInt32 nPolyCount, const sal_uInt32 *
 
     if( nPolyCount <= 0 )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyPolygon");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyPolygon");
         return;
     }
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyPolygon");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyPolygon");
         return;
     }
 
@@ -1165,7 +1168,7 @@ void AquaSalGraphics::drawPolyPolygon( sal_uInt32 nPolyCount, const sal_uInt32 *
     else
     {
         SAL_WARN( "vcl.quartz", "Neither pen nor brush visible" );
-        DBG_DRAW_OPERATION_EXIT("drawPolyPolygon");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyPolygon");
         return;
     }
 
@@ -1238,13 +1241,13 @@ void AquaSalGraphics::drawPolygon( sal_uInt32 nPoints, const SalPoint *pPtAry )
 
     if( nPoints <= 1 )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolygon");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolygon");
         return;
     }
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolygon");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolygon");
         return;
     }
 
@@ -1325,7 +1328,7 @@ void AquaSalGraphics::drawRect( long nX, long nY, long nWidth, long nHeight )
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawRect");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawRect");
         return;
     }
 
@@ -1359,13 +1362,13 @@ void AquaSalGraphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint *pPtAry )
 
     if( nPoints < 1 )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyLine");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyLine");
         return;
     }
 
     if( !CheckContext() )
     {
-        DBG_DRAW_OPERATION_EXIT("drawPolyLine");
+        DBG_DRAW_OPERATION_EXIT_EARLY("drawPolyLine");
         return;
     }
 
commit 6a8d7ddf9a451955856d32c35accd416f9982cce
Author: Tor Lillqvist <tml at collabora.com>
Date:   Thu Apr 10 12:10:28 2014 +0300

    CF_TRACE also the CFRetain to avoid confusion
    
    Change-Id: Iae712de4efbbe254ba381a036e2c84d5e27d5e40

diff --git a/vcl/quartz/salbmp.cxx b/vcl/quartz/salbmp.cxx
index 973a675..1e06fd43 100644
--- a/vcl/quartz/salbmp.cxx
+++ b/vcl/quartz/salbmp.cxx
@@ -721,6 +721,7 @@ CGImageRef QuartzSalBitmap::CreateCroppedImage( int nX, int nY, int nNewWidth, i
     if( !nX && !nY && (mnWidth == nNewWidth) && (mnHeight == nNewHeight) )
     {
           xCroppedImage = mxCachedImage;
+          CG_TRACE( "CFRetain(" << xCroppedImage << ")" );
           CFRetain( xCroppedImage );
     }
     else
commit f66d64ab2e85f574a4b9f644ef709ff981483836
Author: Tor Lillqvist <tml at collabora.com>
Date:   Wed Apr 9 18:38:00 2014 +0300

    Intermediate commit: un-revert last change
    
    Change-Id: I3d18f8d6844377edc0864d81284c7fb9dbb9dbf9

diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx
index 6c2c473..dc8dbbd 100644
--- a/unotools/source/config/fltrcfg.cxx
+++ b/unotools/source/config/fltrcfg.cxx
@@ -584,8 +584,24 @@ void SvtFilterOptions::SetImpress2PowerPoint( bool bFlag )
     SetModified();
 }
 
+static bool lcl_DoTiledRendering()
+{
+#if !HAVE_FEATURE_DESKTOP
+    // We do tiled rendering only for iOS at the moment, actually, but
+    // let's see what happens if we assume it for Android, too.
+    return true;
+#else
+    // We need some way to know globally if this process will use
+    // tiled rendering or not. Or should this be a per-window setting?
+    // Or what?
+    return false;
+#endif
+}
+
 bool SvtFilterOptions::IsSmartArt2Shape() const
 {
+    if (lcl_DoTiledRendering())
+        return true;
     return pImp->IsFlag( FILTERCFG_SMARTART_SHAPE_LOAD );
 }
 


More information about the Libreoffice-commits mailing list